Shape features - cerr/CERR GitHub Wiki

Shape (Morphological) features

These features are computed according to the definitions in IBSI section 4.1. Shape features describe geometric aspects of a region of interest (ROI), such as area and volume. Marching Cubes algorithm is used to build the outer surface mesh.

The following shape features are supported

  1. max3dDiameter: The largest pairwise Euclidean distance between surface voxels in the ROI

  2. max2dDiameterAxialPlane: The largest pairwise Euclidean distance between axial-plane surface voxels in the ROI.

  3. max2dDiameterSagittalPlane: The largest pairwise Euclidean distance between sagittal-plane surface voxels in the ROI.

  4. max2dDiameterCoronalPlane: The largest pairwise Euclidean distance between coronal-plane surface voxels in the ROI.

Example function call

global planC

% Define the structure index
structNum = 1;

% Call the shape calculator
shapeS = getShapeParams(structNum,planC)

Mesh calculation might run out of memory in case of very fine resolution. Downsampling helps in such situations. Just provide the additional input which specifies the number of rows/columns/slices to downsample the region of interest. For example,

rcsV = [30,30,20];
shapeS = getShapeParams(structNum,planC,rcsV);

Shape calculation also accepts binary matrix containing the structure segmentation. The following example demonstrates such a calculation.

% mask3M is the binary mask containing the structure segmentation. It can be passed from an external application or obtained from CERR as follows:
mask3M = getUniformStr(structNum,planC);

% Get the associated scan index
scanNum = getStructureAssociatedScan(structNum, planC)

% Get the x,y,z grid spacing
[xValsV, yValsV, zValsV] = getUniformScanXYZVals(planC{indexS.scan}(scanNum));
yValsV = fliplr(yValsV);
xValsV = xValsV(minc:maxc);
yValsV = yValsV(minr:maxr);
zValsV = zValsV(mins:maxs);

% Crop the mask
[minr, maxr, minc, maxc, mins, maxs] = compute_boundingbox(mask3M);
maskBoundingBox3M = mask3M(minr:maxr,minc:maxc,mins:maxs);

% call the shape calculator
shapeS = getShapeParams(mask3M, {xValsV, yValsV, zValsV});