ImageMaskSpatialObject IsInside less than half a pixel away?

Pull request #751 proposes two rather simple tests for ImageMaskSpatialObject::IsInside(point):

  1. Test IsInsideSingleZeroPixel has a black pixel (pixel value zero) on a white background (pixel value 1)

  2. Test IsInsideSingleNonZeroPixel has a white pixel on a black background.

The first test passed successfully but the second one fails: https://open.cdash.org/testDetails.php?test=756152233&build=5870461

Regarding the first test:

IsInside(point) returns false for a point that has exactly the same coordinates as the index of the black pixel, and also for a point that is less than half a pixel size away from the black pixel index. OK?

Regarding the second test:

IsInside(point) returns true for a point that has exactly the same coordinates as the index of the white pixel. But what if the point is just very close to the pixel index (less than half a pixel size away)? My expectations fail, for both:

spatialObject->IsInside(PointType{ indexValue - 0.4999 })
spatialObject->IsInside(PointType{ indexValue + 0.4999 })

(In this case, indexValue is the index value of the white pixel.)

Please tell me what you think!

2 Likes