find dicom file by tag value in a multidirectory structure

Started by Maurizio, May 11, 2012, 06:00:08 PM

Previous topic - Next topic

Maurizio

HI to all,
i'm a very Newbie.....

I must find the location of some dicom images in a very large directory.
There are several subdirectories and i know only PatientID tag value and AcquisitionDate tag value (that is the same of creation date of the image file)

I try to find an Exiftool option like /s in dos DIR command whit any success....

I must find that images inside all subdirectorie of D:\IMGWRK\ filtering by date of creation
this command could be useful but i don't know how specify multiple subdir and how to filter by date of creation

"exiftool -T -PatientID -StudyinstanceUID D:\imgwrk\4437595869_1\1.2.840.113619.2.5.1762892610.1701.1335798935.471 >out.txt"

Thanks to all for any type oh help.

ps sorry for my english..... :-\


Phil Harvey

You can filter on the value of any tag using a Perl logic expression.  For example, to print the directory and filename of all files with createdate between 2011:01 and 2011:04, you could do this:

exiftool -p "$directory/$filename" -if "$createdate gt '2011:01' and $createdate lt '2011:04'" -r D:\imgwrk

The -r option causes sub-directories to be processed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Maurizio

Thank very much Phil..
but i past your example and seems not run..

this work fine.
exiftool -p "$directory/$filename" -r D:\imgwrk

but if i use the perl logic expression  it doesn't work
exiftool -p "$directory/$filename" -if "$createdate gt '2012:04' and $createdate lt '2012:05'" -r D:\imgwrk

where's my mistake?
thanks a lot
Maurizio

Phil Harvey

Hi Maurizio,

Just saying "it doesn't work" doesn't help me much.  Are there any messages?  Could it just be there are no images between the specified dates?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Maurizio

hi Phil,
i forgot to say that filter did not work because i used a wrong tag name $createdate instead $AcquisitionDate.

this is the rigth instruction when i have Id Patient:
exiftool -T -PatientID -StudyinstanceUID -if "$PatientID eq '4437595869'" -r D:\imgwrk >prova.txt

This is the right instruction when i have the Acquisition date. In Dicom Files this is the right Tag.
exiftool -T -PatientID -StudyinstanceUID -if "$AcquisitionDate eq '2012:04:30'" -r D:\imgwrk >prova.txt

So i have solved my problem!!
Thank you very much!!
Maurizio