Discussion:
[ITK-users] Problem with LabelSetErodeImageFilter
Aurelie Le breton
2018-04-10 08:02:46 UTC
Permalink
Hi,
I have a question about the LabelSetErodeImageFilter.
Is there a structurant element radius max, for the erode filter ?
I need to use a closing filter, i've chosen to use the
LabelSetDilateImageFilter followed by a LabelSetErodeImageFilter.
My problem is that, when i set the radius to 15 pix, both of the dilate and
erode filters give a result, but when the radius is set to 16 pix, only the
dilate filter returns a correct output, the erode filter returns a black
image, filled with '0' values. But there is no reason for the filter to
fail..
Images are 1024*1024, containing only '0' and '1'.
I've tested several datasets, i've the same behaviour.


Here is my code (very basic) :


typedef itk::Image<char, 3> Mask3dType;

// dilate
auto dilateFilter = itk::LabelSetDilateImageFilter<Mask3dType,
Mask3dType>::New();
dilateFilter->SetInput(input);
dilateFilter->SetRadius(radius);

// Erode
auto erodeFilter = itk::LabelSetErodeImageFilter<Mask3dType,
Mask3dType>::New();
erodeFilter->SetInput(dilateFilter->GetOutput());
erodeFilter->SetRadius(radius);

erodeFilter->Update();


Thanks in advance.
Richard Beare
2018-04-10 09:18:46 UTC
Permalink
There isn't meant to be a limit to size of structuring element. A couple of
possibilities I can think of. If your test involves single pixels set to 1,
then perhaps there's a rounding error leading to the blank image. Single
pixels are a slightly tricky corner case when dealing with large
structuring elements, and probably not what you're going to be using in
practice. If it is what you're using for the test, try a larger component
instead.

Secondly, something to consider. Are you actually after label operations?
Testing with 1s and 0s only is a binary case and can be addressed with the
ParabolicMorphology module. The computational bits are similar but there
isn't the overhead of tracking the labels.

Finally closings on label sets are somewhat poorly defined, which is why
there isn't a label closing filter. You need to consider the precise
behaviour you want when performing the erosion - should it separate
touching labels or not. Also, you can construct arrangements of labels
which will result in some components disappearing, which wouldn't happen if
the operation was applied to each component separately - consider one label
completely surrounded by another - the dilation wouldn't change the
surrounded label, allowing the subsequent erosion operation to delete it if
the structuring element is large enough.
Post by Aurelie Le breton
Hi,
I have a question about the LabelSetErodeImageFilter.
Is there a structurant element radius max, for the erode filter ?
I need to use a closing filter, i've chosen to use the
LabelSetDilateImageFilter followed by a LabelSetErodeImageFilter.
My problem is that, when i set the radius to 15 pix, both of the dilate
and erode filters give a result, but when the radius is set to 16 pix, only
the dilate filter returns a correct output, the erode filter returns a
black image, filled with '0' values. But there is no reason for the filter
to fail..
Images are 1024*1024, containing only '0' and '1'.
I've tested several datasets, i've the same behaviour.
typedef itk::Image<char, 3> Mask3dType;
// dilate
auto dilateFilter = itk::LabelSetDilateImageFilter<Mask3dType,
Mask3dType>::New();
dilateFilter->SetInput(input);
dilateFilter->SetRadius(radius);
// Erode
auto erodeFilter = itk::LabelSetErodeImageFilter<Mask3dType,
Mask3dType>::New();
erodeFilter->SetInput(dilateFilter->GetOutput());
erodeFilter->SetRadius(radius);
erodeFilter->Update();
Thanks in advance.
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
https://itk.org/mailman/listinfo/insight-users
lilipj
2018-04-12 08:32:01 UTC
Permalink
I've passed a 200*200 image containing a 60*60 square filled with '1' values
in the center of the image, results are the same, erosion radius = 15 is ok,
radius=16 and more returns an empty image.

I've tried the ParabolicErodeFilter with a scale equal to radius*radius / 2
+ 1, and it works,
Thanks a lot.



--
Sent from: http://itk-insight-users.2283740.n2.nabble.com/
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users
Richard Beare
2018-04-12 21:41:10 UTC
Permalink
Thanks - I'll have to check that out. Most likely a casting/comparison not
quite right.
Post by lilipj
I've passed a 200*200 image containing a 60*60 square filled with '1' values
in the center of the image, results are the same, erosion radius = 15 is ok,
radius=16 and more returns an empty image.
I've tried the ParabolicErodeFilter with a scale equal to radius*radius / 2
+ 1, and it works,
Thanks a lot.
--
Sent from: http://itk-insight-users.2283740.n2.nabble.com/
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
https://itk.org/mailman/listinfo/insight-users
Loading...