Hoffman2:Scripts:dcmheader.py: Difference between revisions
(→Usage:) |
|||
Line 14: | Line 14: | ||
===Options:=== | ===Options:=== | ||
--print (or -p) | |||
Showing the full header of a dcm file | |||
python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/file -p (or --print ) | python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/file -p (or --print ) | ||
(This option can take only a single dicom file as argument) | |||
Example of a part of the output from option --print | |||
(0010, 0010) Patient's Name PN: '12345' | (0010, 0010) Patient's Name PN: '12345' | ||
(0010, 0020) Patient ID LO: 12345 | (0010, 0020) Patient ID LO: 12345 | ||
(0010, 0030) Patient's Birth Date DA: '20000101' | (0010, 0030) Patient's Birth Date DA: '20000101' | ||
(0010, 0040) Patient's Sex CS: 'F' | (0010, 0040) Patient's Sex CS: 'F' | ||
(0010, 1010) Patient's Age AS: '020Y' | (0010, 1010) Patient's Age AS: '020Y' | ||
(0010, 0010) is the tag for item “Patient's Name”, you need this for -c (--check) and -u (--update) options. | (0010, 0010) is the tag for item “Patient's Name”, you'll need this information for using -c (--check) and -u (--update) options. | ||
-c (--check) option: | -c (--check) option: |
Revision as of 22:24, 27 April 2020
Purpose:
To view and edit a Dicom file header information or header of Dicom files under the same subject folder
Usage:
To use this script, you need to load python module first and export the library location:
module load python/3.6.1_shared PYTHONPATH=/u/project/CCN/apps/python_libs/3.6/site-packages/
To see the usage of this script
python3 /u/project/CCN/apps/scripts/dcmheader.py -h
Options:
--print (or -p)
Showing the full header of a dcm file python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/file -p (or --print )
(This option can take only a single dicom file as argument)
Example of a part of the output from option --print
(0010, 0010) Patient's Name PN: '12345' (0010, 0020) Patient ID LO: 12345 (0010, 0030) Patient's Birth Date DA: '20000101' (0010, 0040) Patient's Sex CS: 'F' (0010, 1010) Patient's Age AS: '020Y'
(0010, 0010) is the tag for item “Patient's Name”, you'll need this information for using -c (--check) and -u (--update) options.
-c (--check) option: This option is to view specific header items in a dcm file or the same items in all files inside the subject folder
View a single item: python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/file -c "(0010, 0010)"
View a single item in a subject folder by specifying the folder instead of a file: python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/ -c "(0010, 0010)"
View multiple items: python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/file -c "(0010, 0010) (0010, 0020)" python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/ -c "(0010, 0010) (0010, 0020)"
-u (--update) option: This option is for updating specific header items, using the format as "tag=new_value" Example: update a single item (in this example, change the Patient's Name value to 12345_1): python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/file -u "(0010, 0010)=12345_1" update the same item for the whole subject folder python3 /u/project/CCN/apps/scripts/dcmheader.py -f /path/to/my/dicom/subject/ -u "(0010, 0010)=12345_1"