[vtkusers] vtkImageErode3D

Bill Lorensen bill.lorensen at gmail.com
Thu Nov 28 13:51:09 EST 2013


Sorry,

I meant to say:
ImageDilateErode works on BIINARY images, not GRAYSCALE images. The CT
image is a grayscale image. The Insight Toolkit (ITK) grayscale
erosion/dilation.

On Thu, Nov 28, 2013 at 7:54 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Elena,
>
> ImageDilateErode works on grayscale images, not binary images. The CT
> image is a grayscale image. The Insight Toolkit (ITK) grayscale
> erosion/dilation.
>
> Perhaps you can tell us what you want to accomplish.
>
> Bill
>
> On Thu, Nov 28, 2013 at 3:34 AM, elena bresciani
> <elena.bresciani87 at gmail.com> wrote:
>> I tried to set different values of kernel size and erode/dilate values
>> without seeing any difference in the output; also I added the Update() call
>> and tried using he two filters separately, still no changes.
>>
>> here's my code (I'm using python):
>>
>> # imageReader is a vtkBMPReader
>>
>> # apply the dilate/erode filter to the image
>>
>> erode = vtk.vtkImageDilateErode3D()
>> erode.SetInputConnection(imageReader.GetOutputPort())
>> erode.SetErodeValue(3)
>> erode.SetKernelSize(5, 5, 1)
>> erode.ReleaseDataFlagOff()
>> erode.Update()
>>
>> dilate = vtk.vtkImageDilateErode3D()
>> dilate.SetInputConnection(erode.GetOutputPort())
>> dilate.SetDilateValue(3)
>> dilate.SetKernelSize(5, 5, 1)
>> dilate.ReleaseDataFlagOff()
>> dilate.Update()
>>
>> # create the actors one for the original image ad one for the
>> # processed one
>> originalActor = vtk.vtkImageActor()
>> originalActor.GetMapper().SetInputConnection(imageReader.GetOutputPort())
>>
>> processedActor = vtk.vtkImageActor()
>> processedActor.GetMapper().SetInputConnection(dilate.GetOutputPort())
>>
>> # rendering stuff...
>>
>>
>> 2013/11/27 Jon Haitz Legarreta <jhlegarreta at vicomtech.org>
>>>
>>> Dear Elena,
>>> another alternative would be to vary the kernel size to some extreme
>>> values so that you can really be aware of any changes.
>>> Another possibility would be to use the erode/dilate filters separately.
>>> And yes, you are right, if you erode an object to the ground it cannot be
>>> dilated anymore however hard you try.
>>>
>>> HTH,
>>> JON HAITZ
>>>
>>>
>>>
>>> On 27 November 2013 13:29, Marco Nawijn <nawijn at gmail.com> wrote:
>>>>
>>>> Hi Elena,
>>>>
>>>> Although I probably cannot help you directly, I would advise you
>>>> isolate your problem to the smallest compilable piece of code
>>>> and post this so experts can take a look at it. One thing that
>>>> bit me in the past is that ones you apply a filter, you have to
>>>> a.) call Update() on it and b.) call GetOutput() to get the result
>>>> you are looking for. Without seeing your code however it is
>>>> difficult to judge.
>>>>
>>>> Kind regards,
>>>>
>>>> Marco
>>>>
>>>> P.S. There is nothing wrong with your english!
>>>>
>>>>
>>>>
>>>> On Wed, Nov 27, 2013 at 12:24 PM, elena bresciani
>>>> <elena.bresciani87 at gmail.com> wrote:
>>>>>
>>>>> I'm getting started with vtk and I'm still unable to solve a lot of
>>>>> problems.
>>>>>
>>>>> I'm trying to apply the vtk filter vtkImageDilateErode3D to a CT image
>>>>> but I
>>>>> can't obtain the result I'm looking for.
>>>>> In fact I expect the result to be a at least slightly different image
>>>>> but
>>>>> the output is instead an image identical to the one given as input (I
>>>>> even
>>>>> checked subtracting the two images with vtkImageMathematics and after
>>>>> the
>>>>> operation there's really nothing left!).
>>>>> I don't understand if the problem is in the setting of the Erode and
>>>>> Dilate
>>>>> values and in the kernel size or maybe in the function of the filter
>>>>> itself,
>>>>> i.e. I expect that the output image has something less compared to the
>>>>> original one after erosion and dilatation (what has been eroded "to the
>>>>> ground" canot be dilated back - is this correct?)
>>>>>
>>>>> Thank you in advance
>>>>> Sorry for the bad english
>>>>>
>>>>> Elena
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>
>>
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list