[vtk-developers] The ImageStencil Issue

dean.inglis at camris.ca dean.inglis at camris.ca
Tue Aug 22 18:27:25 EDT 2006


Hi David,

I find stencils extremely valuable!  In fact,
I have had to base most of my production code 
on a modified pre-executives VTK branch to keep
my image region of interest pipelines functioning.
I'm all in favor of any  fixes/enhancements/expansions.

Dean

> 
> 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