clEsperanto / pyclesperanto

GPU-accelerated Image Processing library using OpenCL
https://clesperanto.github.io/pyclesperanto
BSD 3-Clause "New" or "Revised" License
31 stars 6 forks source link

[Bug] bounding_box() returns wrong z start and depth values for 2D images #163

Closed thawn closed 8 months ago

thawn commented 8 months ago

Pre-requist tasks

Describe the bug the results of bounding_box() are wrong for 2-d images

To Reproduce


import pyclesperanto as cle
import pyclesperanto_prototype as clep
import numpy as np

#create sample image
image = np.zeros((100, 100))
image[10:30, 20:80] = 1

#measure the bounding box with pyclesperanto
cle.bounding_box(image) # returns [20.0, 10.0, 10.0, 79.0, 29.0, 1.0]

#measure the bounding box with pyclesperanto_prototype
clep.bounding_box(image) # returns [20.0, 10.0, 0, 79.0, 29.0, 0]

**Expected behavior**
for a 2-D image, the bounding box z start and depth values should both be 0

**Configuration details:**
 - OS: [e.g. MacOS 12.7.2]
 - Device: [Apple M1 Max]
 - Device type: [Integrated GPU]
thawn commented 8 months ago

Cool thanks, Stephane 🎉