[ITK Community] Resampling and origin patient for DICOM files

Luis Ibanez luis.ibanez at kitware.com
Mon Mar 17 11:36:02 EDT 2014


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140317/83a9795f/attachment.html>


More information about the Community mailing list