/**
\page org_mitk_views_segmentationutilities The Segmentation Utilities View

\imageMacro{segmentation_utilities-dox.svg,"Icon of the Segmentation Utilities View",5.00}

\imageMacro{QmitkSegmentationUtilities_Overview.png,"The Segmentation Utilities View",16.00}

\tableofcontents

\section org_mitk_views_segmentationUtilitiesManualOverview Overview

The <b>Segmentation Utilities View</b> allows to postprocess existing segmentations. Currently five different operations exist:

<ul>
	<li> \ref org_mitk_views_segmentationUtilitiesBooleanOperations
	<li> \ref org_mitk_views_segmentationUtilitiesImageMasking
	<li> \ref org_mitk_views_segmentationUtilitiesMorphologicalOperations
	<li> \ref org_mitk_views_segmentationUtilitiesConvertToSegmentation
	<li> \ref org_mitk_views_segmentationUtilitiesExtractFromSegmentation
</ul>

\section org_mitk_views_segmentationUtilitiesDataSelection Data Selection

All postprocessing operations provide one or more selection widgets, which allow to select the data for the operation.

\section org_mitk_views_segmentationUtilitiesBooleanOperations Boolean operations

Boolean operations allows to perform the following fundamental operations on two or more segmentations:

<ul>
	<li> <b>Difference:</b> Subtracts the second segmentation from the first segmentation.
	<li> <b>Intersection:</b> Extracts the overlapping areas of all selected segmentations.
	<li> <b>Union:</b> Combines the two existing segmentations.
</ul>

The selected segmentations must have the same geometry (size, spacing, ...) in order for the operations to work correctly.
The result will be stored in a new data node as a child node of the first selected segmentation.

\imageMacro{QmitkSegmentationUtilities_BooleanOperations.png,"Boolean operations",6.00}

\section org_mitk_views_segmentationUtilitiesImageMasking Image masking

Image masking allows to mask an image with either an existing segmentation or a surface.
The operation requires an image and a segmentation or a surface.
The result will be an image containing only the pixels that are covered by the respective mask.

The default background pixel value is zero.
It can be changed to the minimum existing pixel value of the image or to a custom pixel value.
If the custom pixel value is out of the valid bounds of the pixel type, it is optionally clamped accordingly.

\imageMacro{QmitkSegmentationUtilities_ImageMasking.png,"Image masking",6.00}

\section org_mitk_views_segmentationUtilitiesMorphologicalOperations Morphological operations

Morphological operations are applied to a single segmentation image. Based on a given structuring element the underlying segmentation will be modified.
The plugin provides a <b>ball</b> and a <b>cross</b> as structuring elements. The following operations are available:

<ul>
	<li> <b>Dilation:</b> Each labeled pixel within the segmentation will be dilated based on the selected structuring element.
	<li> <b>Erosion:</b> Each labeled pixel within the segmentation will be eroded based on the selected structuring element.
	<li> <b>Opening:</b> A dilation followed by an erosion, used for smoothing edges or eliminating small objects.
	<li> <b>Closing:</b> An erosion followed by an dilation, used for filling small holes.
	<li> <b>Fill Holes:</b> Fills bigger holes within a segmentation.
</ul>

\imageMacro{QmitkSegmentationUtilities_MorphologicalOperations.png,"Morphological operations",6.00}

\section org_mitk_views_segmentationUtilitiesConvertToSegmentation Convert to Segmentation

Convert to segmentation allows to convert one or multiple input data into a multi-label segmentation. The supported input data types are surfaces, contour models and images. Surfaces and contour models will be converted into a new label (with the same color as the respective input data). Input images will be analyzed for their pixel content. Each pixel value (different to 0; which marks unlabeled pixels) will be associated with the new label.
The conversion can have the following outputs:
<ul>
	<li> <b>Convert to new segmentation:</b> The inputs will be converted and integrated in a new segmentation. The geometry of the output segmentation is determined by the largest geometry of the input images. If no images are selected as input, one has to specify an image or segmentation as reference. If sub mode "Convert inputs separately" is selected, each input will be converted into its own multi-label segmentation output.
	<li> <b>Add to existing segmentation:</b> The inputs will be converted and integrated as new group(s) in a selected segmentation.
</ul>

For the output the following grouping modes can be selected (if the output is not new separate segmentation):
<ul>
	<li> <b>Merge all inputs ...:</b> All inputs will be merged into a new group. Remark: If inputs overlap the inputs might overwrite each other.
	<li> <b>New group per input:</b> Each input will be added as a new group to the multi-label segmentation.
</ul>

<b>Remark on label values:</b> when converting inputs into a multi-label segmentation, the conversion process tries to keep the label value the same like the original value. In cases of surfaces or contour models it would be 1. In case of images it would be the respective pixel value. In cases of the label value collision (the label value is already used in the segmentation) a new value will be assigned to resolve the conflict. Therefore it is only guaranteed that values are kept, if you convert only one input into a new or empty segmentation.

<b>Remark unsupported geometries:</b> if you select images as input, these images have to have either the same geometry or must be a sub geometry. If a reference is defined or you want to add them to an existing segmentation, the input images also have to have the same geometry like the target or be a sub geometry of it.


\section org_mitk_views_segmentationUtilitiesExtractFromSegmentation Extract from Segmentation

Extract from segmentation allows to extract the content of a multi-label segmentation (either all labels or a selection of labels) in various ways and stores it as simple images in the data storage.

The following output options are available (at least one must be selected):
<ul>
	<li> <b>Label class map(s):</b> This generates an image where each pixel value (different from 0, which indicates unlabeled pixels) indicates a label class. Label classes comprise of all label instances that have the same label name. One can also see this as the semantic segmentation result. This mode will generate an output for each group indicated by the selected labels (or all groups).
	<li> <b>Label instance map(s):</b> This generates an image where each pixel value (different from 0, which indicates unlabeled pixels) indicates a label instance. The used pixel values are equivalent to the label value of each instance. This mode will generate an output for each group indicated by the selected labels (or all groups). If the segmentation contains only labels with one / no instance(s), the result will be the same as from "Label class map(s)".
	<li> <b>Label instance mask(s):</b> This generates an image for each selected / all label instance(s), where each pixel value (different from 0, which indicates unlabeled pixels) indicates the label instance. The used pixel value is equivalent to the label value of the label instance.
</ul>

**/
