[vtkusers] insert 2D image into 3D Volume

David Gobbi david.gobbi at gmail.com
Thu Nov 4 12:13:17 EDT 2010


Hi Andre,

You can use vtkImageBlend to replace a portion of one vtkImageData by
another vtkImageData.  The trick is that you have to translate the
extent of your slice so that vtkImageBlend knows what slice it should
replace.

For your slice, use vtkImageChangeInformation like so:

changeInformation->SetInputConnection(your slice image);
changeInformation->SetExtentTranslation(0, 0, 15);

For blend, do something like this:

blend->SetInputConnection(your volume);
blend->AddInputConnection(changeInformation->GetOutputPort());
blend->SetOpacity(1, 1.0);

Through a combination of cropping and translation, it is possible to
replace any portion of one image with any portion of another image, as
long as the images have the same datatype and voxel spacing.

  David


On Thu, Nov 4, 2010 at 9:49 AM, Andre Bongers <a.bongers at mediri.com> wrote:
> Hi,
>
> I would like to insert a 2D image (which I extracted before) into a 3D Image
> Volume of medical data.
>
> The 3D Volume has the dimensions  256 x 256 x 20 and I would like to replace
> slice 15 (in z-direction)  by a 2D slice  of same x-y dimensions 256 x 256 x
> 1. z-position which I got from a different source.
>
> Since I did't find any clue, how to do that I would be glad if anyone can
> give me a hint...
>
> E.g. is there a filter which does something like that ?
>
> Thanks
>
> Andre
>
>
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list