[Insight-users] Change orientation to 4D image

Luis Ibanez luis.ibanez at kitware.com
Sun Sep 12 13:15:32 EDT 2010


Hi Serena,

Do you actually want to

A)  resample the image ?

or

B)  Do you just want to change the content of the DirectionMatrix ?


If (A), you could use the ResampleImageFilter, along with
an AffineTransform in 4D.


if (B), you could use the ChangeInformationImageFilter.



    Regards,


         Luis


---------------------------------------------------------------------------------
On Thu, Sep 9, 2010 at 7:24 PM, sere f <serenaf33 at gmail.com> wrote:

> Dear Users,
>
> I want to change the orientation of 4D image and OrientImageFilter works
> only for 3D image.
> I  extrapolate  3D images with ExtractImageFilter, apply the Filter
> on OrientImageFilter and then I paste the 3D image on 4D image with
> PasteImageFilter.
> The final 4D image is empty and I don't understand where the error is.
>
> Could somebody give me a help please?
>
>
> This is the code:
>
>
> regionPasteM.SetIndex( Origin );
>
> regionPasteM.SetSize(
> m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize());/
>
> pasteimageINM->SetRegions( regionPasteM );
>
> pasteimageINM->Allocate();
>
> pasteimageINM->SetSpacing( m_file1_reader->GetOutput()->GetSpacing() );
>
> pasteimageINM->SetOrigin(  m_file1_reader->GetOutput()->GetOrigin());
>
> pasteimageINM->FillBuffer( 0 );
>
>   pasterM->SetInput(pasteimageINM);
>
> pasterM->SetSourceImage(m_file1_reader->GetOutput());
>
> pasterM->SetDestinationImage(pasteimageINM);
>
>
>
>  for(unsigned int i=0
> ;i<m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[3
> ];i++)
>
> {
>
> std::cout<<"i: "<<i<<std::endl;
>
> InputImageType::IndexType start;
>
> InputImageType::SizeType size;
>
> start[0] =0 ;
>
> start[1] =0 ;
>
> start[2] =0 ;
>
> start[3] =i;
>
>  size[0]
> =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0];
>
> size[1]
> =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1];
>
> size[2]
> =m_file1_reader->GetOutput()->GetLargestPossibleRegion().GetSize()[2];
>
> size[3] =0;
>
>   InputImageType::RegionType desiredRegion;
>
> desiredRegion.SetSize(  size  );
>
> desiredRegion.SetIndex( start );
>
> m_extractfilter->SetExtractionRegion(desiredRegion );
>
> m_extractfilter->SetInput(m_file1_reader->GetOutput());
>
>   orienter->SetInput( m_extractfilter->GetOutput() );
>
> orienter->SetUseImageDirection(true);
>
> orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::
> ITK_COORDINATE_ORIENTATION_RPI);
>
> orienter->Update();
>
>   pasterM->SetDestinationIndex( start);
>
> sourceregionM.SetSize( size );
>
> sourceregionM.SetIndex( start);
>
> pasterM->SetSourceRegion(sourceregionM);
>
> pasterM->Update();
>
> pasteimageINM=pasterM->GetOutput();
>
>  }
>
>
>
>
>
>
> Thank you very much in advance.
>
> Serena.
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100912/6fbe24c4/attachment.htm>


More information about the Insight-users mailing list