Hi Luis,<div><br></div><div>I would like to have the fMRI image (4D image) in Radiological convention.</div><div>could you give an help to understand where my code is wrong?</div><div><br></div><div>Thank you.</div><div><br>
</div><div>Serena.</div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On Sun, Sep 12, 2010 at 7:15 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>Hi Serena,<br><br>Do you actually want to<br><br>A) resample the image ?<br><br>or <br><br>B) Do you just want to change the content of the DirectionMatrix ?<br>
<br><br>If (A), you could use the ResampleImageFilter, along with <br>
an AffineTransform in 4D.<br><br><br>if (B), you could use the ChangeInformationImageFilter.<br><br><br><br> Regards,<br><br><br> Luis<br><br><br>---------------------------------------------------------------------------------<br>
<div class="gmail_quote"><div><div></div><div class="h5">On Thu, Sep 9, 2010 at 7:24 PM, sere f <span dir="ltr"><<a href="mailto:serenaf33@gmail.com" target="_blank">serenaf33@gmail.com</a>></span> wrote:<br></div>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div class="h5">
Dear Users,<div><font face="Menlo" size="3"><span style="font-size:11px"><font face="arial"><span style="font-size:small"><br>
</span></font></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px">I want to change the orientation of 4D image and OrientImageFilter works only for 3D image.</span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px">I extrapolate 3D images with <span style="color:rgb(209, 44, 37)">ExtractImageFilter<span style="color:rgb(0, 0, 0)">, apply the Filter on OrientImageFilter and then I paste the 3D image on 4D image with <span style="color:rgb(209, 44, 37)">PasteImageFilter.</span></span></span></span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)">The final 4D image is empty and I don't understand where the error is.</span></span></span></span></span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)">Could somebody give me a help please?</span></span></span></span></span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br>
</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px">This is the code:</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br>
</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><p style="margin:0px;font:11px Menlo">
regionPasteM.SetIndex( Origin );</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>regionPasteM.SetSize( m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize());<span style="color:rgb(0, 132, 28)">/</span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasteimageINM->SetRegions( regionPasteM ); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasteimageINM->Allocate(); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasteimageINM->SetSpacing( m_file1_reader->GetOutput()->GetSpacing() ); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasteimageINM->SetOrigin( m_file1_reader->GetOutput()->GetOrigin()); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasteimageINM->FillBuffer( <span style="color:rgb(42, 43, 211)">0</span> ); </p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;color:rgb(0, 132, 28)"><span style="color:rgb(0, 0, 0)"><span style="white-space:pre-wrap">        </span>pasterM->SetInput(pasteimageINM); </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasterM->SetSourceImage(m_file1_reader->GetOutput()); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>pasterM->SetDestinationImage(pasteimageINM);</p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span> </p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span><span style="color:rgb(187, 43, 159)">for</span>(<span style="color:rgb(187, 43, 159)">unsigned</span> <span style="color:rgb(187, 43, 159)">int</span> i=<span style="color:rgb(42, 43, 211)">0</span>;i<m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[<span style="color:rgb(42, 43, 211)">3</span>];i++)</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>{</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>std::cout<<<span style="color:rgb(209, 44, 37)">"i: "</span><<i<<std::endl;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>InputImageType::IndexType start;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>InputImageType::SizeType size;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>start[<span style="color:rgb(42, 43, 211)">0</span>] =<span style="color:rgb(42, 43, 211)">0</span> ;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>start[<span style="color:rgb(42, 43, 211)">1</span>] =<span style="color:rgb(42, 43, 211)">0</span> ;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>start[<span style="color:rgb(42, 43, 211)">2</span>] =<span style="color:rgb(42, 43, 211)">0</span> ;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>start[<span style="color:rgb(42, 43, 211)">3</span>] =i;</p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>size[<span style="color:rgb(42, 43, 211)">0</span>] =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[<span style="color:rgb(42, 43, 211)">0</span>];</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>size[<span style="color:rgb(42, 43, 211)">1</span>] =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[<span style="color:rgb(42, 43, 211)">1</span>];</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>size[<span style="color:rgb(42, 43, 211)">2</span>] =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[<span style="color:rgb(42, 43, 211)">2</span>];</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>size[<span style="color:rgb(42, 43, 211)">3</span>] =<span style="color:rgb(42, 43, 211)">0</span>; </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>InputImageType::RegionType desiredRegion;</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>desiredRegion.SetSize( size );</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>desiredRegion.SetIndex( start );</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>m_extractfilter->SetExtractionRegion(desiredRegion );</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>m_extractfilter->SetInput(m_file1_reader->GetOutput()); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>orienter->SetInput( m_extractfilter->GetOutput() );</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>orienter->SetUseImageDirection(<span style="color:rgb(187, 43, 159)">true</span>);</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation:: ITK_COORDINATE_ORIENTATION_RPI);</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>orienter->Update();</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">                </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>pasterM->SetDestinationIndex( start);</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>sourceregionM.SetSize( size );</p>
<p style="margin:0px;font:11px Menlo;color:rgb(0, 132, 28)"><span style="color:rgb(0, 0, 0)"><span style="white-space:pre-wrap">                </span>sourceregionM.SetIndex( start);</span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>pasterM->SetSourceRegion(sourceregionM);</p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>pasterM->Update(); </p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">                </span>pasteimageINM=pasterM->GetOutput();<span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo"><span style="white-space:pre-wrap">        </span>}<span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><span style="white-space:pre-wrap">        </span></p>
<p style="margin:0px;font:11px Menlo;min-height:13px"><br></p></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br>
</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br>
</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)">Thank you very much in advance.</span></span></span></span></span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)">Serena.</span></span></span></span></span></font></div>
<div><font face="Menlo" size="3"><span style="font-size:11px"><br></span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><br>
</span></font></div><div><font face="Menlo" size="3"><span style="font-size:11px"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"><span style="color:rgb(209, 44, 37)"><span style="color:rgb(0, 0, 0)"> </span></span></span></span></span></font></div>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div>