access scan and label mask from planC - cerr/CERR GitHub Wiki

Following example demonstrate accessing scan matrix and binary segmentation mask for a structure stored within CERR's planC:

The planC object can be loaded from a .mat file or by using the global variable global planC if the file is loaded in CERR viewer. Now let's define the indices of the desired scan and structure.

% Define the structure index
structNum = 1;

% Define the scan index
scanNum = 1;

Now, let's use the utility functions in CERR to access scan and label matrices.

% Get the binary label mask
[rasterSegments, planC, isError] = getRasterSegments(structNum,planC);
[mask3M, uniqueSlices] = rasterToMask(rasterSegments, scanNum, planC);
% Get the scan matrix
scan3M = getScanArray(planC{indexS.scan}(scanNum));
scan3M = double(scan3M) - ...
    planC{indexS.scan}(scanNum).scanInfo(1).CTOffset;

The scan3M and mask3M` hold the scan and label maps respectively.