[vtk-developers] The ImageStencil Issue

David Cole david.cole at kitware.com
Wed Aug 23 08:17:18 EDT 2006


I'd like to rephrase the main question of this discussion:
Would anybody object to David Gobbi making stencils use the new pipeline 
properly?
And would anybody object to those changes being propagated into the 
VTK-5-0 branch if possible?

David Gobbi,
Would it be a lot of work to make stencils use the new pipeline properly?
Do you foresee any difficulty merging those changes into VTK-5-0...?

I'm all for you making these changes: conforming to the new pipeline is 
good in general and you are obviously the man for this particular job.
If you're going to redress ugliness, you may as well redress it in the 
5.0 branch, too... I'd be happy to help with merging the changes into 
the 5.0 branch after you commit them to CVS HEAD.

Thanks,
David Cole


David Gobbi wrote:

> Hi All,
>
> I'd like to redress some ugliness that I introduced to VTK a few years 
> back.
>
> The vtkImageStencilSource class requires the Spacing and Origin of 
> whichever image eventually uses the stencil to be propagated the wrong 
> way along the pipeline.  Ouch!
>
> Obviously the vtkImageStencilSource should actually take an Image as 
> an input and should then use that image to get the Spacing and Origin 
> to use for the stencil.  This is a fairly minor change.  For VTK 5.2, 
> I can then make VTK produce a deprecation warning if people don't set 
> an input.
>
> I would call the method SetInformationInput() to make it clear that 
> only the information (the Spacing, Origin, and WholeExtent) of the 
> data would be used.  Also, vtkPolyDataToImageStencil() needs it 
> SetInput() method for the polydata input.
>
> For example:
>
> stencilSource = vtkImplicitFunctionToImageStencil()
> stencilSource.SetInput(vtkSphere())
> stencilSource.SetInformationInput(input)
>
> histogram = vtkImageAccumulate()
> histogram.SetStencil(stencilSource.GetOutput())
> histogram.SetInput(input)
>
> Do people think this is a good change?  Are there many people out 
> there who even use stencils in VTK?  How many people know what a 
> stencil is?  (Hint: it is an image mask stored in an efficient 
> run-length format instead of vtkImageData format).
>
> Also, I'm not sure what the methods should be named in light of the 
> VTK 5 pipeline changes.   Maybe I should name them as follows:
>
> SetInformationInputConnection(vtkAlgorithmInput *) instead of 
> SetInformationInput(vtkImageData *)
> SetStencilInputConnection(vtkAlgorithmInput *) instead of 
> SetStencil(vtkImageStencilData *)
>
> I'd like to get this right, and I think that only small changes are 
> necessary to do so.
>
> Also, of course, I'd like to see more of the filters in Imaging 
> utilizing stencils.  Right now only a handful do (Blend, Reslice, 
> Stencil, Accumulate).  The potential here is very high... a stencil 
> allows you to perform an operation only within a specified region of 
> interest, where the shape of the region can be whatever you desire.  
> The ROI can even be described by a vtkPolyData mesh or by a 
> vtkImplicitFunction, since these types can be converted efficiently 
> into vtkImageStencilData.
>
> - David
>
>
>
>
>
>
>
> _______________________________________________
> 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