You will need a folder <dicomFolder> containing a DICOM sequence. AuSoMS was developed for slices in the transversal plane.
Clone the project and open the project directory in MATLAB.
Add the whole project folder ./segmentation in the MATLAB path. The main code resides in segmentation/functions.
To call the default segmentation, execute
[skull_segmentation, brain_segmentation, ~] = segmentVolume(<path-to-dicomFolder>, struct());
AuSoMS will return a skull segmentation as well as a brain segmentation. They are represented by a 3D matrix each.
In order to run AuSoMS with custom options, create an empty struct
options = struct();
and define attributes for it:
options.resizeFactorResizing factor of volume. Default: 1options.SEBgStructuring element used for background removal (Caution: Structuring element will be used as is, ignoring the resize factor)options.SEBgCloseStructuring element used for closing of foreground (Caution: Structuring element will be used as is, ignoring the resize factor)options.sizeSEBrainStructuring element size for 3D PCNN brain segmentation in pixels (Caution: Size will be used as is, ignoring the resize factor)options.cutoffNumber of slices ignored at the start as well as the end of the sequence. Default: 0options.nSegmentsForegroundNumber of segments for the foreground. Default: 4options.brainSegmentationLogical volume of existing brain segmentation (same size as input volume!). Alternative to using built in 3D-PCNN segmentation of the brain.options.maxSkullThicknessDefine thickness of skull (in mm). Default: 0.7options.evalFile.mat file which contains ground truth of skullskulltruth, scale factorfactorin relation to scale of input slices and, optionally, ground truth of the brainbraintruthoptions.fScoreBetaIndicates how 'many times' recall is more important than precision. Default: 2options.pcnnRepetitionsRepetitions for averaging of brain segmentation. Default: 1options.outFileSpecify file for saving the results. Default: No file specified
You don't have to define every attribute. Defining an attribute solely overwrites parameters in the main function later on. Then call
[skull_segmentation, brain_segmentation, ~] = segmentVolume(<path-to-dicomFolder>, options);
For example, if you want to work with the assumption that the maximum skull thickness is 0.6 mm instead of 0.7 mm (default), the code should look like this
options = struct();
options.maxSkullThickness = 0.6;
[skull_segmentation, brain_segmentation, ~] = segmentVolume(<path-to-dicomFolder>, options);
You can also save the results in a .mat file by defining
options.outFile = <path-to-saveFile>;
That's it! For a more detailed explanation on these parameters, read the thesis in the thesis project directory.
In case you want to evaluate the results, make sure you have a .mat file <evalFile> containing the variables skulltruth as well as the rescale factor factor (use value 1 if image was not rescaled for manual segmentation) and - optionally - braintruth. Now execute
options = struct(); options.evalFile = <path-to-evalFile>;
[skull, brain, eval] = segmentationVolume(<path-to-dicomFolder>, options);
The variable eval contains the Dice Score and the Matthews Correlation Coefficient for the skull segmentation (whole as well as upper half) and the brain segmentation if a ground truth was given. The scores will also be saved in <outFile> if you defined options.outFile before executing the main function.
