[vtkusers] vtkImageMathematics and vtkImageCast problem:

Anja Ende anja.ende at googlemail.com
Thu Aug 17 11:05:54 EDT 2006


I have 2 reslicers in my application and I pipe the input of one of them to
a vtkImageCast object and set the output as the output type of the other
second reslicer.

Then, I pass the input to a vtkImageMathematics object and try to subtract
these values. However, it always returns with the error:

vtkImageMathematics (): Execute: input2 ScalarType, 11, must match output
ScalarType 5.

Here is some code as to what I have tried so far:

vtkImageCast * cast = vtkImageCast::New();
cast->SetOutputScalarType(slicer1->GetOutput()->GetScalarType());
cast->SetInputConnection(slicer2->GetOutputPort());
cast->ClampOverflowOn();

vtkImageMathematics * math = vtkImageMathematics::New();
math->SetOperationToSubtract();
math->SetInput1(slicer1->GetOutput());
math->SetInput2(cast->GetOutput());

I think that this should work. Obviously, I have missed something. I would
be grateful if someone can point out what I am doing wrong here...

Thanks :)

Anna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060817/ab04eb93/attachment.htm>


More information about the vtkusers mailing list