[Insight-users] Copy Image Region to a Larger Image

Luis Ibanez luis.ibanez at kitware.com
Wed Feb 25 11:36:25 EST 2009


Hi Sabine

It looks like what you need is the

     itk::PasteImageFilter
http://public.kitware.com/Insight/Doxygen/html/classitk_1_1PasteImageFilter.html


Unless you are not just copying a region, but
also applying a geometrical transformation
such as rotation or scaling.


Please let us know,


     Thanks


          Luis


--------------------------------------------------------
On Wed, Feb 25, 2009 at 11:09 AM, slorentz <professor_rumsdiegeige at yahoo.com
> wrote:

>
> 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
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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/20090225/cefddadf/attachment.htm>


More information about the Insight-users mailing list