[vtkusers] vtkImageMathematics and vtkImageCast problem:
Obada Mahdi
omahdi at gmx.de
Thu Aug 17 12:09:39 EDT 2006
Hi Anja!
Anja Ende wrote:
> 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.
Try to have slicer1 update its output before examining its output scalar
type:
> Here is some code as to what I have tried so far:
>
> vtkImageCast * cast = vtkImageCast::New();
slicer1->Update();
> 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());
If the pipeline has not been executed before, the output image data
might just be empty and report some default scalar type.
Regards
Obada
More information about the vtkusers
mailing list