Using backslash with -sep operator

Started by empedia, November 07, 2012, 11:12:01 AM

Previous topic - Next topic

empedia

Hi,

I am using exiftool to extract metadata from DICOM files.

The tags I am specifically interested in are

ImagePositionPatient and ImageOrientationPatient which are tags used by Philips Dicom format

When I run the cmd line version of exiftool on Windows I get the following sort of output

Image Position Patient          : -29.635969161987\42.2112464904785\12.0020151138305
Image Orientation Patient       : 0.42902336858444\0.89619832565966\0.11299340818506\0.26550329955296\-0.0055465998779\-0.9640939960171

The values are delimited by backslashes and I would like to be able to use the -sep operator to separate the string into a list - and ideally also to use the -p operator to output each item in the list separately. Ultimately to generate an xml snippet something like this

<ImagePositionPatient>
<value>-29.64</value>
<value>42.41</value>
<value>12.00</value>
</ImagePositionPatient>

I've shortened the values for brevity

However when I use - sep "\" exiftool just gives me the help text - I also tried "\\" which did not recognise the tag separator.

So is what I am trying to do possible and if so how?

Many thanks,

Matthew Dexter

Phil Harvey

Hi Matthew,

Unfortunately all DICOM tags like this are stored as simple strings, not as lists of items, which is why the -sep option has no effect.

I can't suggest anything I can do to make your job simpler.  At some point you'll have to process the string yourself to achieve the result you are looking for.  If it helps, you can use an ExifTool user-defined Composite tag to do some of the reformatting.

- 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 ($).