[vtk-developers] vtkImageWeightedSum

David Gobbi dgobbi at atamai.com
Wed Apr 19 17:14:10 EDT 2006


Mathieu Malaterre wrote:
> I am in the process of converting some filters from slicer(*), and 
> after discussion we thought this would be better if some filters from 
> slicer would be merged in VTK (wider community, better testing...).
> So I'd like to have something similar to vtkImageWeightedSum in VTK.
>
> http://www.slicer.org/vtk/html/classvtkImageWeightedSum.html
>
> I have a few options:
>
> 1. Just move the class in VTK,
> 2. Merge the change into vtkImageAppend to have a notion of normalized 
> sum,
> 3. Enhance vtkImageMathematics to have multiple inputs.
>
> I don't think option #1 is the right one. I like #2 since it's fairly 
> easy, but might not be obvious that a weighted sum could be found in 
> an image append. And option #3 make the most sense, but require quite 
> a few internal change.

I don't like #2 since, like you say, it is counterintuitive.

Changing vtkImageMathematics seems like the best solution but it is a 
lot of work.  The one problem I can see is that the way 
vtkImageMathematics is written right now it has a big "switch" statement 
inside the innermost loop, this is an inefficient way of doing things. 
The performance will be less than the original vtkImageWeightedSum class.

So if it was me doing the work, I would just move the class to VTK and 
convert it to the new pipeline.


Now, I'm going to ramble a bit here and talk about vtkImageMathematics.  
Back when I was writing vtkImageMapToColors, Ken Martin decided that 
there should be a generic class for converting scalar values to RGBA 
values, and he called this class vtkScalarsToColors.  It seems that the 
same thing should be done with mathematics: the same code should be 
shared between both the graphics pipeline and the imaging pipeline somehow.

Apologies for the rambling..

 - David


> Comments welcome,
> Mathieu
>
> (*)http://slicer.org
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>




More information about the vtk-developers mailing list