Skip to content

Commit

Permalink
Discards all DICOMs with greater than 300 tags. This results in solvi…
Browse files Browse the repository at this point in the history
…ng the Memory Error caused by sparse dataframes.
  • Loading branch information
anbhimi committed Mar 8, 2022
1 parent d38595c commit cce6022
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/png-extraction/ImageExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit cce6022

Please sign in to comment.