[Insight-users] Point set to image registration resampling (Luis)
please check my code
tony hakki
tony2007vtk at yahoo.com
Wed Feb 7 10:20:44 EST 2007
hello Luis;
I prepared following code to resampling moving image after the implementation of Point set to image registration. Could you please check it for me,Is there a logic situation problem?
.
.
.
TransformType::Pointer finalTransform = TransformType::New();
finalTransform->SetParameters( finalParameters );
typedef unsigned char 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( movingImageReader->GetOutput() );
// defining spacing, origin and size (The parameters of the output image are taken from the input image.)
rawreader->Update();
const MovingImageType::SpacingType&
spacing = rawreader->GetOutput()->GetSpacing();
const MovingImageType::PointType&
origin = rawreader->GetOutput()->GetOrigin();
MovingImageType::SizeType size =
rawreader->GetOutput()->GetLargestPossibleRegion().GetSize();
resample->SetOutputOrigin( origin );
resample->SetOutputSpacing( spacing );
resample->SetSize( size );
typedef unsigned char OutputPixelType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef itk::CastImageFilter<
MovingImageType,
OutputImageType > CastFilterType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
CastFilterType::Pointer caster = CastFilterType::New();
writer->SetFileName("result_of_registration");
caster->SetInput( resample->GetOutput() );
writer->SetInput( caster->GetOutput() );
writer->Update();
Tony
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070207/d516972c/attachment.htm
More information about the Insight-users
mailing list