ExifTool Forum

ExifTool => Newbies => Topic started by: Maurizio on May 11, 2012, 06:00:08 PM

Title: find dicom file by tag value in a multidirectory structure
Post by: Maurizio on May 11, 2012, 06:00:08 PM
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..... :-\

Title: Re: find dicom file by tag value in a multidirectory structure
Post by: Phil Harvey on May 11, 2012, 06:08:47 PM
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
Title: Re: find dicom file by tag value in a multidirectory structure
Post by: Maurizio on May 11, 2012, 06:33:02 PM
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
Title: Re: find dicom file by tag value in a multidirectory structure
Post by: Phil Harvey on May 11, 2012, 08:56:27 PM
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
Title: Re: find dicom file by tag value in a multidirectory structure
Post by: Maurizio on May 13, 2012, 10:13:50 AM
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