<div dir="ltr">Hi Guillaume,<div><br></div><div><br></div><div>Thanks for the detailed description of what you are trying to do.</div><div><br></div><div><br></div><div>A) When resampling an image mask, please make sure to use the </div>
<div><br></div><div> NearestNeighbor interpolator,</div><div><br></div><div> so that the values of the mask are not blended in the borders.</div><div><br></div><div><br></div><div>B) Your expectation on the behavior of the origin is correct.</div>
<div><br></div><div> You are correctly feeding to the ResampleImageFilter the</div><div> parameters of the target image:</div><div><br></div><div> Origin</div><div> Spacing<br></div><div> Direction<br>
</div><div> Size<br></div><div><br></div><div>C) Make sure that the "targetVolume" source of the image</div><div> has been updated BEFORE you take the values from</div><div> it output. That is, if the targetVolume class is a file reader,</div>
<div> then you may want to do something like:</div><div><br></div><div> targetVolume->Update();</div><div> const TargetImageType * targetImage = targetVolume->GetOutput();</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">
<div> resampler->SetOutputOrigin( targetImage->GetOrigin() );</div><div> resampler->SetOutputSpacing( targetImage->GetSpacing() );</div><div> resampler->SetOutputDirection( targetImage->GetOutput()->GetDirection() );</div>
<div> resampler->SetSize( targetImage->GetLargestPossibleRegion().GetSize() );</div><div><br></div><div> resampler->Update();</div><div><br></div><div><br></div><div>D) At the moment of registering, what really matters is the Origin value</div>
<div> inside ITK, regardless of whether it matches the one in the DICOM tags.</div><div><br></div><div>E) At the moment of saving the resampled mask into a DICOM file(s),</div><div> you can then cross check whether the origin tags in the resampled</div>
<div> mask DICOM file, matches the ones from the targetVolume DICOM files.<br><br></div><div> That is, give ITK and GDCM the opportunity to the the proper magic</div><div> in the process of reading and writing the image.</div>
<div><br></div><div><br></div><div>Please let us know if you run into any questions, as you do this.</div><div><br></div><div><br></div><div> Thanks</div><div><br></div><div><br></div><div> Luis</div><div><br></div>
<div> </div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 17, 2014 at 7:38 AM, Guillaume Lemaître <span dir="ltr"><<a href="mailto:g.lemaitre58@gmail.com" target="_blank">g.lemaitre58@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>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:</div>
<div><br></div><div><div> ResampleFilterType::Pointer resampler = ResampleFilterType::New();</div><div> resampler->SetInput( maskVolume->GetOutput() );</div><div> resampler->SetTransform( transform );</div><div>
resampler->SetInterpolator( interpolator );</div><div> resampler->SetOutputOrigin( targetVolume->GetOutput()->GetOrigin() );</div><div> resampler->SetOutputSpacing( targetVolume->GetOutput()->GetSpacing() );</div>
<div> resampler->SetOutputDirection( targetVolume->GetOutput()->GetDirection() );</div><div> resampler->SetSize( targetVolume->GetOutput()->GetLargestPossibleRegion().GetSize() );</div><div> resampler->Update();</div>
</div><div><br></div><div>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:</div><div>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.</div>
<div><br></div><div>What should the proper way to do such task?<br clear="all"><div><br></div><div>Thanks in advance,</div><div><br></div><div>Best regards,</div>-- <br><div dir="ltr"><div><span style="font-family:'Times New Roman';font-size:medium"><table style="width:638px" border="0" cellpadding="0">
<tbody><tr style="height:37.5pt"><td style="width:228px;height:37.5pt;padding:0.75pt" align="left" valign="top"><b><span style="font-family:Arial,Helvetica;font-size:8pt">LEMAÎTRE Guillaume</span><span style="font-size:8pt;font-family:Helvetica"><br>
</span><font size="1"><span style="font-family:Arial">PhD Candiate<br>MSc Erasmus Mundus ViBOT (Vision-roBOTic)<br></span></font><span style="font-size:7.5pt;font-family:Arial" lang="EN-GB"><font color="#000000">MSc Business Innovation and Technology Management (in progress)<br>
</font></span></b><span style="font-size:7.5pt;font-family:Arial" lang="EN-GB"><b><br></b><font color="#0DB02B"><a href="mailto:g.lemaitre58@gmail.com" target="_blank">g.lemaitre58@gmail.com</a><br><br></font></span><p></p>
</td><td style="width:400px;height:37.5pt;padding:0.75pt" align="left" valign="top"><span style="font-size:8pt"><b><span style="font-family:Arial,Helvetica"><font color="#000000">ViCOROB - Computer Vision and Robotic Team</font></span></b></span><span style="font-size:7.5pt;font-family:Arial"><font color="#000000"><br>
Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona<br>Tel. <a href="tel:%2B34%20972%2041%2098%2012" value="+34972419812" target="_blank">+34 972 41 98 12</a> - Fax. <a href="tel:%2B34%20972%2041%2082%2059" value="+34972418259" target="_blank">+34 972 41 82 59</a> </font></span><br>
<span lang="EN-GB"><a href="http://vicorob.udg.es/" style="font-family:Arial;font-size:7.5pt" target="_blank">http://vicorob.udg.es/</a><br>
<font color="#000000"><b><font face="Arial, Helvetica"><span style="font-size:11px">LE2I - Le Creusot</span></font><br></b><font face="Arial" size="1">IUT Le Creusot, Laboratoire LE2I, 12 rue de la Fonderie, 71200 Le Creusot<br>
Tel. <a href="tel:%2B33%203%2085%2073%2010%2090" value="+33385731090" target="_blank">+33 3 85 73 10 90</a></font></font><span style="font-family:Arial;font-size:x-small"> - Fax. <a href="tel:%2B33%203%2085%2073%2010%2097" value="+33385731097" target="_blank">+33 3 85 73 10 97</a></span><span style="font-family:Arial;font-size:x-small"> </span><span style="font-family:Arial;font-size:x-small"><br>
</span><span lang="EN-GB" style="font-family:Arial;font-size:7.5pt"><a href="http://le2i.cnrs.fr" target="_blank">http://le2i.cnrs.fr</a></span></span></td></tr></tbody></table></span></div><div style="text-align:left"><img src="https://sites.google.com/site/glemaitre58/_/rsrc/1340103962984/config/le2i.png"> <img src="https://sites.google.com/site/glemaitre58/_/rsrc/1340103388011/config/vico.png"> <img src="https://sites.google.com/site/glemaitre58/_/rsrc/1340103887254/config/ub.png"> <img src="https://sites.google.com/site/glemaitre58/_/rsrc/1340103809482/config/udg.png"> <img src="https://sites.google.com/site/glemaitre58/_/rsrc/1340104225210/config/vibot.png"></div>
<a href="https://sites.google.com/site/glemaitre58/" target="_blank">https://sites.google.com/site/glemaitre58/</a><br>Vice - Chairman of A.S.C. Fours UFOLEP<br>Chairman of A.S.C. Fours FFC<br>Webmaster of <a href="http://ascfours.free.fr" target="_blank">http://ascfours.free.fr</a></div>
</div></div>
<br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div>