[vtkusers] Expanding/Dilating a threshold

Cory Quammen cory.quammen at kitware.com
Fri Dec 4 15:14:08 EST 2015


Stephen,

It sounds like you would need to first create a dilated binary mask, then
mask out your original data.

vtkImageThreshold should let you get the initial binary mask. Then you can
use vtkImageDilateErode3D to dilate the mask. Finally, use vtkImageMask to
pull out the original image masked by the dilated threshold.

HTH,
Cory

On Thu, Dec 3, 2015 at 8:05 PM, Stephen Hamilton <stephenshamilton at gmail.com
> wrote:

> VTK List,
>
> Hi-I'm trying to perform a function that I can't seem to figure out in
> VTK.  I'm using Python and I'm trying to perform a threshold function on
> vtk Image Data with an expansion caveat.  Currently I can threshold a 3D
> block of cells with no problems.  What I want to do is expand that
> threshold with a kernel value that I decide (even 1 would be fine for
> now).  So the idea would be something like this (2d example to make it
> easier to see):
>
> Given a small set of values in a 2D vtkImageData:
> 001520
> 015553
> 015500
>
> If we did a threshold of > 3, we get an unstructured grid as follows:
>  5
> 555
> 55
>
> This works great in VTK.  What I want to do is include neighboring cells,
> which would result in a threshold like this for a value of 1:
>
>   152
>  15553
>  1550
>
> Is this possible in VTK?  I've looked at the vtkImageDilateErode3D
> function.  The example doesn't quite work for me because it sets the Erode
> and Dilate values to a specific value (0 and 255), whereas my values aren't
> consistent and I need to include them based on their spatial relation, not
> their value.  The example I'm referring to is at
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageDilateErode3D
>
> Any help would be appreciated!
>
> Stephen
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151204/1022d439/attachment.html>


More information about the vtkusers mailing list