File Exchange

## regionprops3

version 1.3.0.0 (2.57 KB) by
Measure geometric properties (e.g. long axis, eccentricity, etc.) of image objects in 3D.

Updated 04 Oct 2016

From GitHub

regionprops3 measures the geometric properties of image objects in 3D space, including 'MajorAxis', 'MajorAxisLength', 'Centroid', 'AllAxes', and 'Eccentricity'.

### Cite As

CY Y (2021). regionprops3 (https://github.com/joe-of-all-trades/regionprops3), GitHub. Retrieved .

Matthew Pias

Came up with a simple fix for you problem @Ganesh, at least if you're trying to find the centroid as in my case. I inserted "if isempty(pixs) == 0" and put all of the code following that inside of this if statement

Faiza Bukenya

it doesnot compute area,diameter

Aya Eid

Myriam_06

Nice work! Like it a lot. But still figuring evertything out.

Maybe a very basic question but: what happens here exactly? What formula is this based on?

distMat = sum(pixs.*repmat(eVectors(:,idx(1))',size(pixs,1),1),2);
output(ii).FirstAxisLength = range(distMat1);

Luke Xie

nice work

CY Y

CY Y

@Ganesh, have you checked if your image data contains any NaN or Inf ? Use this to check : any(isnan(img(:))|isinf(img(:))). If the result comes back as one, you'll have to fix that in the image.

Ganesh P G

Can someone help me with this error, please?

"Error using eig
Input to EIG must not contain NaN or Inf.

Error in regionprops3 (line 55)
[eVectors, eValues] = eig(covmat);"

My input for regionprops3 is a 3-D binary image. I removed objects with single pixel, because that was mentioned as a problem. It still gave me the error.

Thanks.

CY Y

Serdar Yeralan, can you describe the difficulties in more details ? Did you get any error?

Serdar Yeralan

I am having difficulties with the function "struct2array" it calls. Any help would be greatly appreciated

Ilya Belevich

btw, could you please fix the function for the situations when the object consists of a single pixel.
For example,

L = zeros([5,5,5],'uint8');
L(3,3,3) = 1;
result = regionprops3(L, 'Eccentricity');
result = regionprops3(L, 'AllAxes');

thank you!

Ilya Belevich

Great function, thank you for sharing!

##### MATLAB Release Compatibility
Created with R2016b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux