[ITK Community] Resampling and origin patient for DICOM files

Guillaume Lemaître g.lemaitre58 at gmail.com
Mon Mar 17 15:17:28 EDT 2014


Thanks for the guide.

Best,


On 17 March 2014 18:59, Luis Ibanez <luis.ibanez at kitware.com> wrote:

> Guillaume,
>
> Yes, using the GDCM classes in ITK, for processing all the DICOM series
> (both for reading and writing) will be a good way of enforcing consistency
> on the management of the coordinate systems.
>
>    Regards,
>
>        Luis
>
>
>
> On Mon, Mar 17, 2014 at 11:59 AM, Guillaume Lemaître <
> g.lemaitre58 at gmail.com> wrote:
>
>> Thanks Luis,
>>
>> I didn't think yet about suggestion A) and it solves already one of the
>> issue that I observed.
>>
>> Regarding the other orientation problem, I think I see the problem more
>> clearly. The relevant thing that I didn't consider at first is:
>>
>>    1. Extract Image<http://www.itk.org/Doxygen/html/classitk_1_1Image.html> Orientation
>>    & Image <http://www.itk.org/Doxygen/html/classitk_1_1Image.html> Position
>>    from DICOM images, and then calculate the ordering based on the 3D
>>    coordinate of the slice
>>
>> And I saw that the last image in the serie becomes the origin so it
>> should be something related with the acquisition performed in the "reverse
>> way" when considering the 3D coordinates.
>> Probably, I could start by receiving all the series using GDCM, which
>> would avoid any trouble with the header after.
>>
>> Thanks,
>>
>> Best regards,
>>
>>
>> On 17 March 2014 16:36, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>
>>> Hi Guillaume,
>>>
>>>
>>> Thanks for the detailed description of what you are trying to do.
>>>
>>>
>>> A) When resampling an image mask, please make sure to use the
>>>
>>>                          NearestNeighbor interpolator,
>>>
>>>     so that the values of the mask are not blended in the borders.
>>>
>>>
>>> B) Your expectation on the behavior of the origin is correct.
>>>
>>>     You are correctly feeding to the ResampleImageFilter the
>>>     parameters of the target image:
>>>
>>>            Origin
>>>            Spacing
>>>            Direction
>>>            Size
>>>
>>> C) Make sure that the "targetVolume" source of the image
>>>     has been updated BEFORE you take the values from
>>>     it output.  That is, if the targetVolume class is a file reader,
>>>     then you may want to do something like:
>>>
>>>      targetVolume->Update();
>>>      const TargetImageType * targetImage = targetVolume->GetOutput();
>>>
>>>      resampler->SetOutputOrigin( targetImage->GetOrigin() );
>>>      resampler->SetOutputSpacing( targetImage->GetSpacing() );
>>>      resampler->SetOutputDirection(
>>> targetImage->GetOutput()->GetDirection() );
>>>      resampler->SetSize(
>>> targetImage->GetLargestPossibleRegion().GetSize() );
>>>
>>>      resampler->Update();
>>>
>>>
>>> D) At the moment of registering, what really matters is the Origin value
>>>     inside ITK, regardless of whether it matches the one in the DICOM
>>> tags.
>>>
>>> E) At the moment of saving the resampled mask into a DICOM file(s),
>>>     you can then cross check whether the origin tags in the resampled
>>>     mask DICOM file, matches the ones from the targetVolume DICOM files.
>>>
>>>     That is, give ITK and GDCM the opportunity to the the proper magic
>>>      in the process of reading and writing the image.
>>>
>>>
>>> Please let us know if you run into any questions, as you do this.
>>>
>>>
>>>    Thanks
>>>
>>>
>>>        Luis
>>>
>>>
>>>
>>>
>>> On Mon, Mar 17, 2014 at 7:38 AM, Guillaume Lemaître <
>>> g.lemaitre58 at gmail.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am currently working on the following task. I got two DICOM series
>>>> from different modality with different spacing, and origin. A third DICOM
>>>> serie correspond to binary segmentation of one the previous serie. I would
>>>> like to "project" this segmentation into the other serie. I think that the
>>>> resampling filter should make this work quite well. It should look
>>>> something like that:
>>>>
>>>>   ResampleFilterType::Pointer resampler = ResampleFilterType::New();
>>>>   resampler->SetInput( maskVolume->GetOutput() );
>>>>   resampler->SetTransform( transform );
>>>>   resampler->SetInterpolator( interpolator );
>>>>   resampler->SetOutputOrigin( targetVolume->GetOutput()->GetOrigin() );
>>>>   resampler->SetOutputSpacing( targetVolume->GetOutput()->GetSpacing()
>>>> );
>>>>   resampler->SetOutputDirection(
>>>> targetVolume->GetOutput()->GetDirection() );
>>>>   resampler->SetSize(
>>>> targetVolume->GetOutput()->GetLargestPossibleRegion().GetSize() );
>>>>   resampler->Update();
>>>>
>>>> However, I got trapped with what seems to be a problem of origin. I
>>>> search around and different discussions and got quite confused. From what I
>>>> found is the following:
>>>> Using gdcminfo to read the origin of targetVolume will give me the same
>>>> information than the tag (0020,0032) of the DICOM header. However, it will
>>>> be different from targetVolume->GetOuput()->GetOrigin() which imply a shift
>>>> when saving my data later.
>>>>
>>>> What should the proper way to do such task?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Best regards,
>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> *LEMAÎTRE Guillaume PhD CandiateMSc Erasmus Mundus ViBOT
>>>> (Vision-roBOTic)MSc Business Innovation and Technology Management (in
>>>> progress) *
>>>> g.lemaitre58 at gmail.com
>>>>
>>>> *ViCOROB - Computer Vision and Robotic Team*
>>>> Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona
>>>> Tel. +34 972 41 98 12 - Fax. +34 972 41 82 59
>>>> http://vicorob.udg.es/
>>>>
>>>> *LE2I - Le Creusot*IUT Le Creusot, Laboratoire LE2I, 12 rue de la
>>>> Fonderie, 71200 Le Creusot
>>>> Tel. +33 3 85 73 10 90 - Fax. +33 3 85 73 10 97
>>>> http://le2i.cnrs.fr
>>>>
>>>> https://sites.google.com/site/glemaitre58/
>>>> Vice - Chairman of A.S.C. Fours UFOLEP
>>>> Chairman of A.S.C. Fours FFC
>>>> Webmaster of http://ascfours.free.fr
>>>>
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>>>
>>>>
>>>
>>
>>
>> --
>>
>>
>>
>>
>> *LEMAÎTRE Guillaume PhD CandiateMSc Erasmus Mundus ViBOT
>> (Vision-roBOTic)MSc Business Innovation and Technology Management (in
>> progress) *
>> g.lemaitre58 at gmail.com
>>
>> *ViCOROB - Computer Vision and Robotic Team*
>> Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona
>> Tel. +34 972 41 98 12 - Fax. +34 972 41 82 59
>> http://vicorob.udg.es/
>>
>> *LE2I - Le Creusot*IUT Le Creusot, Laboratoire LE2I, 12 rue de la
>> Fonderie, 71200 Le Creusot
>> Tel. +33 3 85 73 10 90 - Fax. +33 3 85 73 10 97
>> http://le2i.cnrs.fr
>>
>> https://sites.google.com/site/glemaitre58/
>> Vice - Chairman of A.S.C. Fours UFOLEP
>> Chairman of A.S.C. Fours FFC
>> Webmaster of http://ascfours.free.fr
>>
>
>


-- 




*LEMAÎTRE GuillaumePhD CandiateMSc Erasmus Mundus ViBOT (Vision-roBOTic)MSc
Business Innovation and Technology Management (in progress)*
g.lemaitre58 at gmail.com

*ViCOROB - Computer Vision and Robotic Team*
Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona
Tel. +34 972 41 98 12 - Fax. +34 972 41 82 59
http://vicorob.udg.es/

*LE2I - Le Creusot*IUT Le Creusot, Laboratoire LE2I, 12 rue de la Fonderie,
71200 Le Creusot
Tel. +33 3 85 73 10 90 - Fax. +33 3 85 73 10 97
http://le2i.cnrs.fr

https://sites.google.com/site/glemaitre58/
Vice - Chairman of A.S.C. Fours UFOLEP
Chairman of A.S.C. Fours FFC
Webmaster of http://ascfours.free.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140317/5a144b0d/attachment-0002.html>


More information about the Community mailing list