[ITK] [ITK-users] ShapeLabelMap Roundness/Perimeter Calculation Issue

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Fri May 13 15:39:57 EDT 2016


Hi,

I was initially wondering the magnitude of the difference, but this should not be a problem for this algorithm.
Looking at the algorithm a little closer, I see it is computed mostly by counting voxel and intercepts ( not with floating point operations ), so the results should be extremely numerically stable and not subject to accumulation error.

It would be good to find a reproducible and shareable case. That is can you share a small image where the problem occours? Hopefully it can be reproduced by just reading it and running BinaryImageToShapLabelMapFilter.

Do you know if the release or debug state is correct?

To roll out a threading issue, can you set ITK to use only one thread, with the env variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1, or itk::MultiThreader::SetGlobalDefaultNumberOfThread(1) and see if the problem persists?

If the problem persists with one thread then, add a debug message to this method [1], to print the label ID and number of intercepts for each axis. This should be the same.

HTH,
Brad

[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx#L633

On May 13, 2016, at 3:12 PM, ebasafa <ehsan.basafa at gmail.com<mailto:ehsan.basafa at gmail.com>> wrote:

Thank you! The IJ article is really helpful.

However, the issue still remains that debug and release give different
answers. I do not know what specifics I need to provide. Basically, I have a
pipeline that loads a volume from file, thresholds the image into a binary
image, and then passes it to BinaryImageToShapeLabelMapFilter to process all
the objects found after thresholding. The exact same pipeline, run over the
same image volume, prints out different values for perimeter and roundness
of the same objects. I should have mentioned that I am working in 3D, and
also the values I get for other shape parameters, e.g. flatness, elongation,
equivalent ellipsoid radii, volume, etc. are the same for debug and release.

My very naive guess is that, possibly, there is some uninitialized parameter
being used somewhere in the filter, which results in debug and release
initializing it to two different values.


Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote
Hello,

You can find additional information about how this parameter is defined in
the following insight journal:
http://www.insight-journal.org/browse/publication/852

This method is generalizable to N-D, so it may not be the most accurate in
2D. The method can produce roundness numbers that are >1. However is
should be consistent in debug and release modes. Getting consistent
numeric computation with C++ and vectorizable operations can be
challenging with different architectures.

You did not provide any specifics for the difference in computation
between release and debug modes.

HTH,
Brad

On May 13, 2016, at 11:26 AM, ebasafa <

ehsan.basafa@

> wrote:

Hi everyone,

Recently I noticed that BinaryImageToShapeLabelMapFilter does not
calculate
roundness of objects correctly, and I traced it back to perimeter
calculation. More curiously, the results I get from the GetRoundness()
and
GetPerimeter() methods differ between debug and release builds! And to
make
it even more confusing, it's a machine-dependent problem, i.e. on some
machines debug and release give the same (correct?) numbers and on some
machines they don't. I suspect that release results are erroneous, since
some roundness numbers turn out to be >1.0 in release but are always <1.0
in
debug mode. I am working in a Windows 8.1 64-bit environment and am using
the latest release of ITK (4.9.1) on all different machines.

I have tried several searches to see if this is a resolved issue, but the
latest post I found was from 2011 (link below) and has been unanswered.

http://itk-users.7.n7.nabble.com/Perimeter-Calculation-via-LabelImageToShapeLabelMapFilter-td14917.html

Seems like there was a bug report filed that time
(https://itk.org/Bug/view.php?id=11934) whose status still says
"assigned".
I appreciate any help.

Thanks,
Ehsan




--
View this message in context:
http://itk-insight-users.2283740.n2.nabble.com/ShapeLabelMap-Roundness-Perimeter-Calculation-Issue-tp7588837.html
Sent from the ITK Insight Users mailing list archive at Nabble.com<http://nabble.com/>.
_____________________________________
Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/insight-users
_______________________________________________
Community mailing list


Community@

http://public.kitware.com/mailman/listinfo/community

_____________________________________
Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/insight-users


Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote
Hello,

You can find additional information about how this parameter is defined in
the following insight journal:
http://www.insight-journal.org/browse/publication/852

This method is generalizable to N-D, so it may not be the most accurate in
2D. The method can produce roundness numbers that are >1. However is
should be consistent in debug and release modes. Getting consistent
numeric computation with C++ and vectorizable operations can be
challenging with different architectures.

You did not provide any specifics for the difference in computation
between release and debug modes.

HTH,
Brad

On May 13, 2016, at 11:26 AM, ebasafa <

ehsan.basafa@

> wrote:

Hi everyone,

Recently I noticed that BinaryImageToShapeLabelMapFilter does not
calculate
roundness of objects correctly, and I traced it back to perimeter
calculation. More curiously, the results I get from the GetRoundness()
and
GetPerimeter() methods differ between debug and release builds! And to
make
it even more confusing, it's a machine-dependent problem, i.e. on some
machines debug and release give the same (correct?) numbers and on some
machines they don't. I suspect that release results are erroneous, since
some roundness numbers turn out to be >1.0 in release but are always <1.0
in
debug mode. I am working in a Windows 8.1 64-bit environment and am using
the latest release of ITK (4.9.1) on all different machines.

I have tried several searches to see if this is a resolved issue, but the
latest post I found was from 2011 (link below) and has been unanswered.

http://itk-users.7.n7.nabble.com/Perimeter-Calculation-via-LabelImageToShapeLabelMapFilter-td14917.html

Seems like there was a bug report filed that time
(https://itk.org/Bug/view.php?id=11934) whose status still says
"assigned".
I appreciate any help.

Thanks,
Ehsan




--
View this message in context:
http://itk-insight-users.2283740.n2.nabble.com/ShapeLabelMap-Roundness-Perimeter-Calculation-Issue-tp7588837.html
Sent from the ITK Insight Users mailing list archive at Nabble.com<http://nabble.com/>.
_____________________________________
Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/insight-users
_______________________________________________
Community mailing list


Community@

http://public.kitware.com/mailman/listinfo/community

_____________________________________
Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/insight-users





--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/ShapeLabelMap-Roundness-Perimeter-Calculation-Issue-tp7588837p7588839.html
Sent from the ITK Insight Users mailing list archive at Nabble.com<http://nabble.com/>.
_____________________________________
Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160513/a4cf85d9/attachment-0001.html>
-------------- next part --------------
_____________________________________
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:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list