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

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Jun 2 10:40:20 EDT 2008


Hi Cherry,

  Just so that we do not loose track of the issue.
  What I did was simply check that the dimension was indeed > 2 before
using idx=2 of a vector. I believe that this is perfectly safe. but
what you are saying is that (for some reason) in ITK 3.4 the value at
idx=2 was set.

Thanks
-Mathieu

On Mon, May 26, 2008 at 2:13 PM, Cherry Ballangan <ballangan at gmail.com> wrote:
> Hi Mathieu,
>
> The value printed for m_Origin.size() is 2. Did you get the same value
> when you run the DicomSeriesReadSeriesWrite using itk 3.6?
>
> Cherry
>
> On Mon, May 26, 2008 at 5:43 PM, Mathieu Malaterre
> <mathieu.malaterre at gmail.com> wrote:
>> [off list]
>>
>> Cherry, what is the value printed for m_Origin.size() when you run
>> your code ? Just simply add a :
>>
>>  cout << m_Origin.size() << endl;
>>
>> the line before
>>
>>   str << m_Origin[2];
>>
>> Thanks
>> -M
>>
>> On Mon, May 26, 2008 at 4:03 AM, Cherry Ballangan <ballangan at gmail.com> wrote:
>>> 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
>>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
>>
>> --
>> Mathieu
>>
>



-- 
Mathieu


More information about the Insight-developers mailing list