[Insight-users] Enlarge the image

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 12 10:28:17 EDT 2009


Hi Arturo,

Have you tried the itkPasteImageFilter ?

http://www.itk.org/Insight/Doxygen/html/classitk_1_1PasteImageFilter.html

This should do the trick.

For example, if you have two images:

   A) Image1 of size in pixels 512 x 512 x 200

   B) Image2 of size in pixels 150 x 200 x 70

you can "embed" or "paste" Image2 inside Image1, by simply
selecting the location in Image1 where you want the first
corner of Image2 to land.

Let's say that you want to put that corner of Image2 in
the pixel of index (27, 29, 50) in Image1. You will then do

   ImageType::IndexType destIndex;
   destIndex[0] = 27;
   destIndex[1] = 29;
   destIndex[2] = 50;

   pasteImageFilter->SetDestinationImage( image1 );
   pasteImageFilter->SetSourceImage( image2 );
   pasteImageFilter->SetSourceRegion( image2->GetBufferedRegion() );
   pasteImageFilter->SetDestinationIndex( destIndex );

   pasteImageFilter->Update();

   ImageType::ConstPointer enlargedImage =
                              pasteImageFilter->GetOutput();


The "enlargedImage" should have the size of Image1, and its
pixels values everywhere, except in the region:

         X index range : 27 -->  27 + 150
         Y index range : 29 -->  29 + 200
         Z index range : 50 -->  50 +  70

where the pixel values will be those of Image2.



You could, of course, do this manually by using the Iterators,
but then it will be harder to integrate with your code if you
have an existing pipeline....


Please let us know if you find any problem when running the
PastImageFilter.


    Thanks






----------------------
Arturo Caissut wrote:
> Hi,
> 
> I'm working on a VTK/ITK pipeline, and I just need to embed a itk 3D 
> image inside of a larger one. I hope my question to be not as silly as I 
> thought, but I'd appreciate very much some hint on the 
> ImageRegionIterator approach you were suggesting some days ago: I'm 
> quite new on ITK programming, and I cannot figure out how to set the 
> needed offset.
> Could you please send me a "raw" example of such an embedding process?
> 
> Thank you in advance,
> Arturo Caissut
> 
> 
> 
>


More information about the Insight-users mailing list