Skip to content

Incorrect results GetAxisAlignedBoundingBoxRegion() for 2D #734

Closed

Description

@N-Dekker

Description

ImageMaskSpatialObject::GetAxisAlignedBoundingBoxRegion() appears to produce incorrect results for image dimensions other than 3D, in two cases:

  1. When the image is entirely black (all zero's). In this case, a bounding box region size of zero is expected, but instead, the returned region appears to have a very large size! For example, { 18446744073709551613, 18446744073709551611 }
  2. When the (N-dimensional) index of the requested region of the image has non-zero coordinates. In this case, the size of the returned bounding box region is also incorrect, apparently because the function just does not take the image region index into account.

Steps to Reproduce

In order to reproduce this issue, run the test from https://github.com/InsightSoftwareConsortium/ITK/blob/d19a05a841d4b89c7646d2ffef36f336017af54a/Modules/Core/SpatialObjects/test/itkImageMaskSpatialObjectGTest.cxx

Test failures are reported at https://open.cdash.org/viewTest.php?onlyfailed&buildid=5858683

Versions

This issue was introduced in 2008, so it applies to both ITK 4.13.2 and ITK 5.0 RC1.

It appears that both of these bugs were there already in the first version that included support for image dimensions other than 3D:

"ENH: implemented GetAxisAlignedBoundingBoxRegion() for image dimensions other than 3D"
cd0a80c (Marius Staring, May 22, 2008)

Additional Information

I already discussed with Marius, and he agrees that it should be fixed. I'm now preparing a fix.

Activity

  1. added
    type:Bug
    on Apr 15, 2019
  2. added a commit that references this issue on Apr 16, 2019
    2e23f71
  3. N-Dekker commented on Apr 16, 2019

    @N-Dekker
    ContributorAuthor

    Thanks @dzenanz for merging the pull request to fix this issue: #732

    Note that it should be possible, technically, to apply the commit that fixes this issue to ITK 4.13 as well: 6dc3846

  4. dzenanz commented on Apr 16, 2019

    @dzenanz
    Member

    Please make a PR to release-4.13 branch.

  5. added 4 commits that reference this issue on May 6, 2026
    5056d97
    dd973f6
    9173286
    b55628c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions