Calculate Bounding Box




I’m writing a macro to extract 3d geometric data from segmented image stacks using 3D Roi manager.

I have an image stack segmented into a number of 3d objects, and I can read geometrical data from each ROIs (the data displayed in the 3D Results window, such as vol and feret), using the Ext.Manager3D_Measure3D() function.

However I am having trouble obtaing the vol bounding box value displayed in the 3d results window. I cannot read this value directly, and I cannot figure out how it is calculated, and cannot find any information on how it is calculated. Does anyone have this info?




Based on the information I found here, it looks like CX, CY, CZ are the coordinates of the center of the bounding volume (which can also be obtained via Ext.Manager3D_Centroid3D). There also appears to be Ext.Manager3D_Bounding3D which should do exactly what you are looking for. However, I am not sure why they have the first argument as 0.



Thanks for the reply.

I have tried the Ext.Manager3D_Bounding3D, but this function returns the coordinates of the bounding box, not the volume of it. Furthermore, I have tried to calculate the volume using these coordinates, but to no avail. I thought it would be as simple as [(Xmax-Xmin) * (Ymax-Ymin) * (Zmax - Zmin)] but this approach gives a bounding box that is smaller in volume than that reported in the results. The first is 0 as it is referring to the 0th object in the ROI manager, as far as I know.




I see. Is it possible that you have a scale set in your image that is being applied to one result but not the other?