[vtk-developers] The ImageStencil Issue

Karthik Krishnan Karthik.Krishnan at kitware.com
Mon Aug 28 14:26:42 EDT 2006



David Gobbi wrote:

> Karthik Krishnan wrote:
>
>> Karthik Krishnan wrote:
>>
>>> Hi David,
>>>
>>> I find stencils very useful. I've been using them as a data 
>>> structure for representing segmentations.
>>>
>>> One of the things I would like to contribute to stencils is 
>>> minkowski operators or "set" operations on stencils. For instance 
>>> union of two stencils, stencilA-stencilB, intersection of stencils 
>>> etc.. The need for these arises when a 3D volume has a few 
>>> disconnected hand-drawn segmentations and as a user, I would like to 
>>> discard a segment etc.. I've been using these separately in a 
>>> derived class, but I could move them to the vtkImageStencilData 
>>> class itself.
>>
>>
>> They've have been added to the vtkImageStencilData class.
>>
>> Thanks
>> -karthik
>
>
> Great, that should do it.  You don't also happen to have 
> vtkAlgorithm-type class for pipelining these operations, do you?  If 
> not, I can add it to the wish list for stencils.

No I don't. Sorry. Have been relying on the MTime so far.

Thanks
-karthik

>
> - David
>
>
>>> Another addition, I would hope to see would be grayscale stencils 
>>> for fuzzy segmentations. Imagine a brush widget dabbing a fuzzy / 
>>> dithered stroke and you would like to use the stencildata to 
>>> represent opacity. It would be great if the stencils could store a 
>>> DataArray in addition to maintaining the ExtentLists. This could 
>>> possibly be done in a sublcass.
>>>
>>> Thanks
>>> -karthik
>>>
>>>
>>> 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
>>>>
>
>



More information about the vtk-developers mailing list