[Insight-users] DicomSeriesReadSeriesWrite ITK-3.6 change image position?

Cherry Ballangan ballangan at gmail.com
Sun May 25 22:03:06 EDT 2008


Hi Mathieu,

Thanks for your reply.

I used Insight/Examples/IO/DicomSeriesReadSeriesWrite.cxx (built with
ITK 3.6) to read and write a series of dicom images. The result seems
ok, except that the Image Position patients for z direction are set to
0.

I changed the code in Insight/Code/IO/itkGDCMImageIO.cxx revision
1.135 (for ITK3.6) line 1100 from "str << 0." to "str <<
header->GetZOrigin()" and it solved my problem. I still dont
understand though why they are read as 2D instead of 3D.

I attached a section of the code that I changed below. Thanks.

Kind regards,

Cherry

// At the point we can only have 2 or 3 dim images:
  assert( m_Origin.size() == 2 || m_Origin.size() == 3 );
  str.str("");
  str << m_Origin[0] << "\\" << m_Origin[1] << "\\";

  if( m_Origin.size() == 3 )
    {
    str << m_Origin[2];
    }
  else // We are coming from the default SeriesWriter which is passing
us a 2D image
      // therefore default to a Z position = 0, this will make the
image at least valid
      // if not correct
    {
    str << header->GetZOrigin(); // originally str << 0;
    }
  header->InsertValEntry(str.str(),0x0020,0x0032); // Image Position (Patient)


On Sat, May 24, 2008 at 5:31 AM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> Hi Cherry,
>
>   Is there a simple way to reproduce the issue ?
>
> Thanks
> -Mathieu
>
> On Thu, May 22, 2008 at 2:37 PM, Cherry Ballangan <ballangan at gmail.com> wrote:
>> Dear ITK users,
>>
>> I am using DicomSeriesReadSeriesWrite from ITK 3.6 example to read and
>> write a set of dicom series (CT images). The results have a change in
>> the Image Position (Patient) - dicom tag 0020, 0032. The z direction
>> of the image position changed to 0 in all of the images in every set
>> (I have tried 4 different sets).
>>
>> This is not the case for ITK 3.4. I have used it for the same datasets
>> before and the image positions remained the same.
>>
>> Any clue why it happens in ver. 3.6? I need to use this version
>> because it keeps the intensity (rescale slope). Thanks for any
>> suggestion and comments.
>>
>> Kind regards,
>>
>> Cherry.
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>
>
>
> --
> Mathieu
>


More information about the Insight-users mailing list