[vtkusers] vtkImageMathematics (Add operation)

Bill Lorensen bill.lorensen at gmail.com
Thu Aug 16 08:25:01 EDT 2012


It appears that vtkImageVariance produces only float output.
vtkImageMathamtics should have reported an error that its two inputs were
of a different type.

On Wed, Aug 15, 2012 at 8:01 PM, Matheus Viana <vianamp at gmail.com> wrote:

> 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
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120816/67a163ad/attachment.htm>


More information about the vtkusers mailing list