[vtkusers] logical operations between binary images
Mark E Roberts
mroberts at andrew.cmu.edu
Tue Oct 2 13:06:30 EDT 2007
Anne-Laure,
I've found success using vtkImageMathematics for my own applications. I'm not completely sure what your final product should look like, but this might help.
full = vtkImageMathematics::New();
full->SetInput1(slice[i]->GetOutput());
full->SetInput2(final[i]->GetOutput());
full->SetOperationToMax();
full->Update();
Some tips on using it:
SetInput2 is the base image. So if you are adding one image to another, you are adding image 1 to image 2. Not adding image 1 and image 2 together. It's a slight difference, but when the operation compares two values, that's how the algorithm works.
For your application, you probably don't want to use SetOperationToMax, but something along the lines of subtraction. Check out the documentation at vtk.org for a list of all the operations.
Finally, after some image mathematics, the file is in the format of image mathematics, not the original file. So you are going to have to recast the image back into the file format that you want.
Hope that points you in the right direction.
Mark Roberts
>
> Hi, I'd like to obtain an image (.raw) which is the substraction of 2
> others binary images. For example : Final_Image=Binary_Initial_Image -
> Binary_Image2 thus, I will be able to have the lungs segmentation. Is it
> possible to do this sort of things with vtk or itk? Thank you so much, Best
> regards, Anne-Laure -- View this message in context:
> http://www.nabble.com/logical-operations-between-binary-images-tf4553493.
> html#a12994379 Sent from the VTK - Users mailing list archive at
> Nabble.com.
>
>
>
--
Mark Roberts
Masters of Science, Project Student
CER Lab
Carnegie Mellon University
301-806-6529
MRoberts at andrew.cmu.edu
MeerkyJ at gmail.com
More information about the vtkusers
mailing list