From cce602267393d1738e3f4481dc8b13bfa3875a60 Mon Sep 17 00:00:00 2001 From: Ananth Reddy Date: Tue, 8 Mar 2022 11:58:02 -0500 Subject: [PATCH] Discards all DICOMs with greater than 300 tags. This results in solving the Memory Error caused by sparse dataframes. --- modules/png-extraction/ImageExtractor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/png-extraction/ImageExtractor.py b/modules/png-extraction/ImageExtractor.py index 76782fa..fbf8216 100644 --- a/modules/png-extraction/ImageExtractor.py +++ b/modules/png-extraction/ImageExtractor.py @@ -148,8 +148,9 @@ def extract_headers(f_list_elem): # dicom images should not have more than 300 dicom tags if len(kv)>300: logging.debug(str(len(kv)) + " dicom tags produced by " + ff) - kv.append(('file', f_list_elem[1])) # adds my custom field with the original filepath - kv.append(('has_pix_array',c)) # adds my custom field with if file has image + else: + kv.append(('file', f_list_elem[1])) # adds my custom field with the original filepath + kv.append(('has_pix_array',c)) # adds my custom field with if file has image if c: # adds my custom category field - useful if classifying images before processing kv.append(('category','uncategorized'))