[Insight-users] Change orientation to 4D image

sere f serenaf33 at gmail.com
Thu Sep 9 19:24:30 EDT 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100910/f6012563/attachment.htm>


More information about the Insight-users mailing list