[vtkusers] vtkImageMathematics (Add operation)

Matheus Viana vianamp at gmail.com
Wed Aug 15 20:01:23 EDT 2012


Hi David.

Thank you for replying. I fixed the problem replacing the line "cast ->
SetOutputScalarTypeToDouble();" to "cast -> SetOutputScalarTypeToFloat();".

Not sure why float type is required, but it works.

Best,
*Matheus Viana*
*Postdoctoral Research Employee*
*Developmental and Cell Biology*
*University of California Irvine*
*
**
*



2012/8/15 David Doria <daviddoria at gmail.com>

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120815/9df4858c/attachment.htm>


More information about the vtkusers mailing list