[vtkusers] Combination of two images

Adrien Marion adrien.marion at creatis.insa-lyon.fr
Wed Apr 13 08:42:04 EDT 2011


Hi,
I have two vtkImageData (called currentImage and img), each containing 
values from 0 to 250.
I would like to combine these images to obtain a resulting image 
(resImage) doing for each pixel:
- if Mask == 0, resImage = currentImage
- else resImage = Mask

I currently work with VTK wrapped version in Java and I cannot afford a 
triple loop with getScalarAsDoubleComponent to do that.

Does someone have a simple solution to do that ?

I already tried with vtkImageStencil but It does not give the good solution:

         vtkImageToImageStencil IIS = new vtkImageToImageStencil();
         IIS.SetInput(img);
         vtkImageStencil IS = new vtkImageStencil();
         IS.SetStencil(IIS.GetOutput());
         IS.SetInput(currentImage);
         IS.Update();
         result = IS.GetOutput();

I think I did not understand how vtkImageStencil works.

Thank you in advance for your help,
Adrien

-- 
Adrien MARION, Docteur/PhD
Chercheur post-doctorant (ANR VIP)
Laboratoire CREATIS, INSA de Lyon
CNRS UMR 5220, INSERM U1044
Bâtiment Blaise Pascal, 4ème étage
7, avenue Jean Capelle
69621 Villeurbanne cedex FRANCE
Tel : (+33) 4 72 43 87 86
Fax:  (+33) 4 72 43 85 26
e-mail : adrien.marion at creatis.insa-lyon.fr
http://www.creatis.insa-lyon.fr/~amarion




More information about the vtkusers mailing list