seung-lab / connected-components-3d

Connected components on discrete and continuous multilabel 3D & 2D images. Handles 26, 18, and 6 connected variants; periodic boundaries (4, 8, & 6)
GNU Lesser General Public License v3.0
356 stars 42 forks source link

cc3d.statistics['bounding_boxes'] is contains floats instead of int as slice positions #90

Closed drusmanbashir closed 2 years ago

drusmanbashir commented 2 years ago

Hi, the slices returned by the stats method of cc3 contain float entries but should be int. Here is a reproducible minimal example:

tt = np.zeros((3,3,3))
tt[0,1]= 2 
tt[1,1]=2

cc_dusted , N= cc3d.connected_components(tt,return_N=True)
stats_dusted = cc3d.statistics(cc_dusted)
bboxes = stats_dusted['bounding_boxes']

print(bboxes)

Above snippet returns:

[(slice(0, 541.0, None), slice(0, 530.0, None), slice(0, 530.0, None)), (slice(116, 272.0, None), slice(125, 215.0, None), slice(247, 336.0, None)), (slice(130, 270.0, None), slice(32
7, 421.0, None), slice(230, 344.0, None))]

As you can see there are float entries

william-silversmith commented 2 years ago

Thanks for the bug report! I see the issue and I'll fix it in a day or two.

On Sun, Feb 20, 2022, 2:29 PM Maelstorm @.***> wrote:

Hi, the slices returned by the stats method of cc3 contain float entries but should be int. Here is a reproducible minimal example:

tt = np.zeros((3,3,3)) tt[0,1]= 2 tt[1,1]=2

cc_dusted , N= cc3d.connected_components(tt,return_N=True) stats_dusted = cc3d.statistics(cc_dusted) bboxes = stats_dusted['bounding_boxes']

print(bboxes)

[(slice(0, 541.0, None), slice(0, 530.0, None), slice(0, 530.0, None)), (slice(116, 272.0, None), slice(125, 215.0, None), slice(247, 336.0, None)), (slice(130, 270.0, None), slice(32 7, 421.0, None), slice(230, 344.0, None))]

— Reply to this email directly, view it on GitHub https://github.com/seung-lab/connected-components-3d/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATGQSN64EQERFEEHDFHV4LU4E6K3ANCNFSM5O42AKYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

william-silversmith commented 2 years ago

The latest release has this fixed. Hope that helps!

On Sun, Feb 20, 2022, 3:05 PM William Silversmith < @.***> wrote:

Thanks for the bug report! I see the issue and I'll fix it in a day or two.

On Sun, Feb 20, 2022, 2:29 PM Maelstorm @.***> wrote:

Hi, the slices returned by the stats method of cc3 contain float entries but should be int. Here is a reproducible minimal example:

tt = np.zeros((3,3,3)) tt[0,1]= 2 tt[1,1]=2

cc_dusted , N= cc3d.connected_components(tt,return_N=True) stats_dusted = cc3d.statistics(cc_dusted) bboxes = stats_dusted['bounding_boxes']

print(bboxes)

[(slice(0, 541.0, None), slice(0, 530.0, None), slice(0, 530.0, None)), (slice(116, 272.0, None), slice(125, 215.0, None), slice(247, 336.0, None)), (slice(130, 270.0, None), slice(32 7, 421.0, None), slice(230, 344.0, None))]

— Reply to this email directly, view it on GitHub https://github.com/seung-lab/connected-components-3d/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATGQSN64EQERFEEHDFHV4LU4E6K3ANCNFSM5O42AKYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>