Is this a potential bug in the new "obliqueslice" function?

Hi all,
the new "obliqueslice" function fails for me in line 184 "sliceSize = round(B1.BoundingBox);" with:
Error using round
Second argument must be a real integer scalar.
for some specific inputs because the B1.BoundingBox that is created from the regionsprops call in line 177 contains two regions. Looking at the created "sliceMaskLimit" (line 176), the problem is that one mask pixel is disjoint from the rest of the region. Looks like this edge case is not properly taken care of?
Edit: Quick & dirty fix: copy function and change line 177 from
B1 = regionprops(sliceMaskLimit,'BoundingBox');
to
B1 = regionprops(bwconvhull(sliceMaskLimit),'BoundingBox');
Problem can be recreated via:
arr = ones(201,336,336);
p = [165,232,6];
n = [0.2,1,-0.8];
obliqueslice(arr,p,n);
Error using round
Second argument must be a real integer scalar.

Error in obliqueslice (line 184)
sliceSize = round(B1.BoundingBox);

Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Products

Release

R2022b

Asked:

on 19 Sep 2022

Commented:

on 19 Sep 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!