[Originally posted by samynosot on 2009-11-19 02:00:49-08]
Hi, all
Some private dicom field : 0019, 105a tells a mri sequence duration.
Unfortunately it's in float, like 5.145648e+07
An idea would be to modify this header to x min y sec.
I end up my search with a strftime like conversion, but really don't know if there is a trick to use it (or another option) in my exiftool command line ?
The nirvana would be recursively search in a database directory all new dicom files (less than 5 min) and change the 019,105a from Float to a x min y sec.
The filesystem tasks are possible via the OS, but find out if exiftool superpower is able to achieve directly my Nirvana is way beyond my great exiftool experience with pictures files.
Any idea ?
Many thanks
[Originally posted by exiftool on 2009-11-19 11:31:55-08]The option here is to create a user-defined tag to do the required
formatting:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::DICOM::Main' => {
'0018,605A' => {
Name => 'AcquisitionDuration',
VR => 'FL',
ValueConv => '$val * 1e6',
PrintConv => 'ConvertDuration($val)',
},
},
);
1; #end
My example above assumes that the units are microseconds,
so I multiply by 1e6 in the ValueConv to convert to seconds.
If the value is already in seconds, the ValueConv line can be
removed. (What are the units for this stored value?)
The PrintConv calls an exiftool function to format
the duration in a more readable way.
- Phil
[Originally posted by samynosot on 2009-11-20 01:22:44-08]Thanks a lot Phil,
I tried your method with the right header number : 0019,105A and a dicom image with 1.562e+08 as FLOT value and got a weird field :
Acquisition Duration : 43388888888:53:20
(The correct answer is a few minutes and seconds)
I used this code as config file :
%Image::ExifTool::UserDefined = (
'Image::ExifTool::DICOM::Main' => {
'0019,105A' => {
Name => 'AcquisitionDuration',
VR => 'FL',
ValueConv => '$val * 1e6',
PrintConv => 'ConvertDuration($val)',
},
},
);
1; #end
[Originally posted by davitof on 2009-11-20 07:20:48-08]Hello everyone
try
'$val / 1e6'
instead of
'$val * 1e6'
This should give you a little more than 2 minutes and 36 seconds. Is this what you expected?
Phil, you don't mind that I suggested an answer before you?
[Originally posted by exiftool on 2009-11-20 11:18:04-08]
Thanks davitof. Yes. I multiplied when I should have divided.
- Phil
[Originally posted by samynosot on 2009-11-24 23:47:26-08]
Great it works perfectly !
This will help me a lot.
Any plan to make exiftool support Write dicom files ?
Thanks !
[Originally posted by exiftool on 2009-11-25 00:01:47-08]
You might notice I now decode these private GE DICOM tags
in version 8.00, although I haven't implemented any
conversions for this tag.
I haven't had any requests for DICOM write feature yet, so
there weren't any plans to add this feature. But I will
consider this a request so I will put it on the list,
although it isn't very high priority item right now.
- Phil