MantisBT - ITK
View Issue Details
0006617ITKpublic2008-03-16 01:552011-01-13 17:00
Bing Jian 
Stephen Aylward 
normalfeaturehave not tried
closedreopened 
 
 
0006617: Unable to Read/Write AcquisitionDate
According to Luis's reply to my question on Mar 14, 2008
"This seems to be a bug in the MetaImage library,
The file
    Insight/Utilities/MetaImage/metaObject.cxx
in line 1130, takes care of reading this field:
   MET_InitReadField(mF, "AcquisitionDate", MET_STRING, false);
as part of the method: M_SetupReadFields(void)
but is misses to write it as part of the method:
      M_SetupWriteFields(void)
It seems that we are missing a line like:
 mF = new MET_FieldRecordType;
 MET_InitWriteField(mF, "AcquisitionDate", MET_STRING,
 strlen(m_ObjectTypeName), m_ObjectTypeName);
around lines 1272.
Fix committed to SVN. Used patch from Tom.
No tags attached.
patch metaio-acqdate-2010-05-25.patch (588) 2010-05-26 14:00
https://public.kitware.com/Bug/file/3143/metaio-acqdate-2010-05-25.patch
patch metaio-acqdate-2010-05-28.patch (986) 2010-05-28 10:12
https://public.kitware.com/Bug/file/3151/metaio-acqdate-2010-05-28.patch
Issue History
2008-03-16 01:55Bing JianNew Issue
2008-04-08 19:13Stephen AylwardStatusnew => assigned
2008-04-08 19:13Stephen AylwardAssigned To => Stephen Aylward
2008-04-08 19:13Stephen AylwardNote Added: 0011198
2008-04-08 19:13Stephen AylwardStatusassigned => confirmed
2008-04-09 06:10Stephen AylwardNote Added: 0011200
2008-04-30 11:10Stephen AylwardStatusconfirmed => resolved
2008-04-30 11:10Stephen AylwardResolutionopen => fixed
2008-04-30 11:10Stephen AylwardNote Added: 0011605
2010-05-26 13:57Tom VercauterenNote Added: 0020823
2010-05-26 13:57Tom VercauterenStatusresolved => feedback
2010-05-26 13:57Tom VercauterenResolutionfixed => reopened
2010-05-26 14:00Tom VercauterenFile Added: metaio-acqdate-2010-05-25.patch
2010-05-28 10:12Tom VercauterenFile Added: metaio-acqdate-2010-05-28.patch
2010-05-28 10:13Tom VercauterenNote Added: 0020856
2010-05-28 16:33Stephen AylwardStatusfeedback => resolved
2010-05-28 16:33Stephen AylwardAdditional Information Updated
2010-10-21 12:31Gabe HartStatusresolved => closed
2011-01-13 17:00Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00Source_changeset_attached => VTK master 020ef709

Notes
(0011198)
Stephen Aylward   
2008-04-08 19:13   
Change required is a bit more than listed. A candidate solution is being tested.
(0011200)
Stephen Aylward   
2008-04-09 06:10   
Code in CVS
(0011605)
Stephen Aylward   
2008-04-30 11:10   
Fixed and submitted to cvs
(0020823)
Tom Vercauteren   
2010-05-26 13:57   
This bug appears not to be fixed.

A simple test like this one:

MetaObject mobj("test.txt");
mobj.AcquisitionDate( "26-05-2010" );
mobj.Write();

generates the following file:

ObjectType = Object
NDims = 0
BinaryData = False
TransformMatrix =
Offset =
CenterOfRotation =
ElementSpacing =

The culprit is a missing
  m_Fields.push_back(mF);
after the
  MET_InitWriteField(mF, "AcquisitionDate", [...] )

A patch is attached.
(0020856)
Tom Vercauteren   
2010-05-28 10:13   
I also encountered a valgrind issue with AcquisitionDate. It seems that the string was not always null terminated which led to problems with strlen. The updated patch (2010-05-28) should fix this issue as well.