[vtkusers] vtkImageMathematics (Add operation)
David Doria
daviddoria at gmail.com
Wed Aug 15 19:32:57 EDT 2012
On Wed, Aug 15, 2012 at 6:37 PM, matheus_viana <vianamp at gmail.com> wrote:
> Hi Folks,
>
> I'm trying to sum two ImageDatas, but I'm getting a blank image as result.
> This is my code:
>
> vtkImageCast *cast = vtkImageCast::New();
> cast -> SetInput(ImageData);
> cast -> SetOutputScalarTypeToDouble();
> cast -> Update();
>
> vtkImageGaussianSmooth *Gauss = vtkImageGaussianSmooth::New();
> Gauss -> ReleaseDataFlagOff();
> Gauss -> SetInput(cast -> GetOutput());
> Gauss -> SetDimensionality(3);
> Gauss -> SetRadiusFactors(1,1,1);
> Gauss -> SetStandardDeviations(1,1,1);
> Gauss -> Update();
>
> vtkImageVariance3D *Variance = vtkImageVariance3D::New();
> Variance -> SetInput(cast->GetOutput());
> Variance -> SetKernelSize(3,3,3);
> Variance -> Update();
>
> vtkImageMathematics *mat = vtkImageMathematics::New();
> mat -> SetOperationToAdd();
> mat -> SetInput1(Gauss->GetOutput());
> mat -> SetInput2(Variance->GetOutput());
> mat -> Update();
>
> You guys have any idea?
Please make a self-contained, compilable example of the problem. You
can start with this as a shell:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageMathematics
David
More information about the vtkusers
mailing list