Last active
January 28, 2025 12:06
-
-
Save MattGrayYes/f55a67a127992066f9f2170c59b73071 to your computer and use it in GitHub Desktop.
Rename DICOM file based on Instance Creation Date/Time, and Patient Comments. Handy if you're using an ex-medical X-Ray machine for electronic components, and are using the patient comments metadata field to differentiate between which scan is which.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for i in EI*.dcm; | |
| do comments=`exiftool -s3 -PatientComments $i` | |
| date=`exiftool -s3 -InstanceCreationDate $i | tr -d ":"` | |
| time=`exiftool -s3 -InstanceCreationTime $i | cut -d"." -f1 | tr -d ":"` | |
| name="$date $time I $comments" | |
| cp $i "out/$name.dcm" | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment