The example SpatialObjectToImage3.cxx does not create a binary image from a polygon using the new ITKv5, it only generates black images. The problem is probably in itkPolygonSpatialObject. Other spatial objects (i.e. itkEllipseSpatialObject, itkTubeSpatialObject, itkGaussianSpatialObject) work correctly. Do you know any way to fix it up?
Welcome to the community John!
@Stephen_Aylward should be able to offer some advice.
@johnaddams there have been a number of recent changes related to Spatial Objects – what version of ITK are you using?
I am using ITK version 5.0.0 (master branch). Although the example SpatialObjectToImage3.cxx follows the ITK5 migration rules, it does not work as expected.
There was a bug in the implementation of IsInsideObjectSpace(pnt) for the PolygonSpatialObject, this is now fixed in pull request #747.
Thanks for the report!
Thanks @Stephen_Aylward! But unfortunately, it seems that the bug is not completely fixed. The example SpatialObjectToImage3.cxx still doesn’t work using your latest ITKv5 commit. Could you please check this example out?
When you say that @Stephen_Aylward’s PR doesn’t completely solve your issue, do you mean that you downloaded his PR (as opposed to
@Stephen_Aylward, thank you again for solving the bug so fast.