Page 1 of 1

Using properties to mass rename images

Posted: 2016-10-13T03:36:42-07:00
by Frogger
Hi,

I have got a ton of dicom files that I want to mass rename using their properties tags.

My question is, what is the syntax for taking a property tag(such as dcm:SeriesNumber) for every image and using it to rename the images in the directory?

I'm guessing it involves breaking it down to the relevant tag using -identify -verbose and then somehow passing that string over to the filename property?

Really would appreciate the help(using win10 command line).

Re: Using properties to mass rename images

Posted: 2016-10-13T05:43:11-07:00
by Frogger
Almost got it.

Code: Select all

convert *.dcm -set filename:f "%[dcm:SeriesNumber]%[dcm:AcquisitionNumber]" "%[filename:f].jpg"
How do I set an underscore in-between dcm:SeriesNumber and dcm:AcquistionNumber?

Re: Using properties to mass rename images

Posted: 2016-10-13T05:54:45-07:00
by Frogger
Aaand got it.

Code: Select all

convert *.dcm -set filename:f "%[dcm:SeriesNumber]"_"%[dcm:AcquisitionNumber]" "%[filename:f].jpg"

Re: Using properties to mass rename images

Posted: 2016-10-13T09:03:10-07:00
by GeeMack
Frogger wrote:How do I set an underscore in-between dcm:SeriesNumber and dcm:AcquistionNumber?
You shouldn't even need to use two sets of quote marks. I haven't tried it, but I'd make a pretty confident guess that this will work...

Code: Select all

convert *.dcm -set filename:f "%[dcm:SeriesNumber]_%[dcm:AcquisitionNumber]" "%[filename:f].jpg"

Re: Using properties to mass rename images

Posted: 2016-10-13T11:13:59-07:00
by snibgo
If you don't have spaces in the sub-fields, you probably don't needs quotes at all.