[Insight-users]  Copy Image Region to a Larger Image
    slorentz 
    professor_rumsdiegeige at yahoo.com
       
    Wed Feb 25 11:09:46 EST 2009
    
    
  
Hello!
I try to do the following:I have two images. The first one is called
"ResultImage", and the second one is called "ImageToAdd". I want to add
everything of "ImageToAdd" that is not visible in the first frame to
"ResultImage". So, first I compute the registration parameters:
// compute optimal registration parameters
registration->SetFixedImage(  ResultImage );
registration->SetMovingImage( ImageToAdd );
registration->SetInitialTransformParameters( initialParameters );
registration->Update(); 
ParametersType finalParameters = registration->GetLastTransformParameters();
Then I'd like to copy the new part of the image "ImageToAdd" in order to
have "ResultImage" + the new part of "ImageToAdd"... I tried this:
ImageType::SizeType S = (ResultImage->GetLargestPossibleRegion()).GetSize();						
ImageType::PointType O = ResultImage->GetOrigin(); //O[0] -= 40;
resampler->SetSize( size );
resampler->SetInput( Y );
resampler->SetTransform( registration->GetOutput()->Get() );
resampler->SetOutputOrigin( O );
resampler->SetOutputSpacing( ResultImage->GetSpacing() );
resampler->SetDefaultPixelValue( 50 );
// this should be the new, stitched image
ImageType::Pointer Z = resampler->GetOutput();
// write the result to a file
typedef itk::ImageFileWriter< ImageType > WriterType;
WriterType::Pointer wt = WriterType::New();
wt->SetFileName("test.bmp"); 
wt->SetInput( Z );
wt->Update();
but it doesn't really work.... Is the way to use the resampling filter
correct at all?
Regards,
Sabine Lorentz
-- 
View this message in context: http://www.nabble.com/Copy-Image-Region-to-a-Larger-Image-tp22198624p22198624.html
Sent from the ITK - Users mailing list archive at Nabble.com.
    
    
More information about the Insight-users
mailing list