Skip to content

Commit

Permalink
Added extracting Private DICOM tags fuction
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitesh639 committed Mar 19, 2022
1 parent 50349d1 commit 754adec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/png-extraction/ImageExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import pathlib
configs = {}

with open('config.json', 'r') as f:
niffler = json.load(f)
print_only_public_headers = bool(niffler['PublicHeadersOnly'])

def initialize_config_and_execute(config_values):
global configs
Expand Down Expand Up @@ -131,6 +134,14 @@ def get_tuples(plan, outlist = None, key = ""):
value = str(value)
outlist.append((key + aa, value))
# appends name, value pair for this file. these are later concatenated to the dataframe
# appends the private tags
if not print_only_public_headers:
x = plan.keys()
x = list(x)
for i in x:
if i.is_private:
outlist.append((plan[i].name, plan[i].value))

return outlist


Expand Down Expand Up @@ -477,6 +488,7 @@ def execute(pickle_file, dicom_home, output_directory, print_images, print_only_
ap.add_argument("--SplitIntoChunks", default=niffler['SplitIntoChunks'])
ap.add_argument("--PrintImages", default=niffler['PrintImages'])
ap.add_argument("--CommonHeadersOnly", default=niffler['CommonHeadersOnly'])
ap.add_argument("--PublicHeadersOnly", default=niffler['PublicHeadersOnly'])
ap.add_argument("--UseProcesses", default=niffler['UseProcesses'])
ap.add_argument("--FlattenedToLevel", default=niffler['FlattenedToLevel'])
ap.add_argument("--is16Bit", default=niffler['is16Bit'])
Expand Down
1 change: 1 addition & 0 deletions modules/png-extraction/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"SplitIntoChunks": 1,
"PrintImages": true,
"CommonHeadersOnly": false,
"PublicHeadersOnly": true,
"UseProcesses": 0,
"FlattenedToLevel": "patient",
"is16Bit":true,
Expand Down

0 comments on commit 754adec

Please sign in to comment.