[Insight-users] writing registration result to the folder

tony hakki tony2007vtk at yahoo.com
Wed Feb 14 10:53:11 EST 2007


Hi;
I would like to write registration result to ths folder,I searched through the internet  but I have not seen any example like that. Here is my code ,in fact I am not an expert of ITK So I want you to check following code for me. Is that true?I integrated that code to my project but I did not get any result. On the other hand When I compile it, compiler says no any error?

Please Check that code for me;

transform->SetParameters( finalParameters );
 
TransformType::Pointer finalTransform = TransformType::New();
finalTransform->SetParameters( finalParameters );
typedef unsigned short OutputPixelType;
// typedef itk::Image< MovingImageType, Dimension > MovingImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef itk::ResampleImageFilter<MovingImageType,OutputImageType> FilterType;
FilterType::Pointer resample = FilterType::New();
resample->SetTransform( finalTransform );
resample->SetInput( input );
// defining spacing, origin and size (The parameters of the output image are taken from the input image.)
const MovingImageType::SpacingType&
spacing = input->GetSpacing();
const MovingImageType::PointType&
origin = input->GetOrigin();
MovingImageType::SizeType size = 
input->GetLargestPossibleRegion().GetSize();
resample->SetOutputOrigin( origin );
resample->SetOutputSpacing( spacing );
resample->SetSize( size );
typedef itk::Image< OutputPixelType, Dimension > OutputImageType; 
typedef itk::ImageFileWriter< OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("result_of_registration.mhd"); // Here I set the file name
writer->SetInput( resample->GetOutput());
writer->Update();


 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070214/c852a2c8/attachment.html


More information about the Insight-users mailing list