Medical Imaging Interaction Toolkit  2021.02.99-89548602
Medical Imaging Interaction Toolkit
mitk::LabelSetIOHelper Class Reference

The LabelSetIOHelper is a static helper class that supports serialization of mitk::LabelSetImage. More...

#include <mitkLabelSetIOHelper.h>

Static Public Member Functions

static bool SaveLabelSetImagePreset (const std::string &presetFilename, itk::SmartPointer< mitk::LabelSetImage > &inputImage)
 Saves the mitk::LabelSet configuration of inputImage to presetFilename. The preset is stored as "*.lsetp". More...
 
static void LoadLabelSetImagePreset (const std::string &presetFilename, itk::SmartPointer< mitk::LabelSetImage > &inputImage)
 Loads an existing preset for a mitk::LabelSetImage from presetFilename and applies it to inputImage. More...
 
static itk::SmartPointer< mitk::LabelLoadLabelFromXMLDocument (const tinyxml2::XMLElement *labelElem)
 Creates a mitk::Label from an XML element. More...
 
static tinyxml2::XMLElement * GetLabelAsXMLElement (tinyxml2::XMLDocument &doc, Label *label)
 Creates an XML element from a mitk::Label. More...
 
static tinyxml2::XMLElement * PropertyToXMLElement (tinyxml2::XMLDocument &doc, const std::string &key, const BaseProperty *property)
 Since a mitk::Label is basically a mitk::PropertyList this function coverts the label's properties into XML. More...
 
static bool PropertyFromXMLElement (std::string &key, itk::SmartPointer< mitk::BaseProperty > &prop, const tinyxml2::XMLElement *elem)
 Since a mitk::Label is basically a mitk::PropertyList this function coverts a XML element into a property. More...
 

Detailed Description

The LabelSetIOHelper is a static helper class that supports serialization of mitk::LabelSetImage.

This class provides static functions for converting mitk::Label into XML and also allows the serialization of mitk::LabelSet as presets

Definition at line 37 of file mitkLabelSetIOHelper.h.

Member Function Documentation

◆ GetLabelAsXMLElement()

static tinyxml2::XMLElement* mitk::LabelSetIOHelper::GetLabelAsXMLElement ( tinyxml2::XMLDocument &  doc,
Label label 
)
static

Creates an XML element from a mitk::Label.

Parameters
doc
labelthe mitk::Label from which the xml element will be created
Returns
the created XML element

◆ LoadLabelFromXMLDocument()

static itk::SmartPointer<mitk::Label> mitk::LabelSetIOHelper::LoadLabelFromXMLDocument ( const tinyxml2::XMLElement *  labelElem)
static

Creates a mitk::Label from an XML element.

Parameters
labelElemthe xml element from which a mitk::Label will be created
Returns
the created mitk::Label

◆ LoadLabelSetImagePreset()

static void mitk::LabelSetIOHelper::LoadLabelSetImagePreset ( const std::string &  presetFilename,
itk::SmartPointer< mitk::LabelSetImage > &  inputImage 
)
static

Loads an existing preset for a mitk::LabelSetImage from presetFilename and applies it to inputImage.

Parameters
presetFilenamethe filename of the preset including the filesystem path
inputImagethe image to which the loaded preset will be applied

◆ PropertyFromXMLElement()

static bool mitk::LabelSetIOHelper::PropertyFromXMLElement ( std::string &  key,
itk::SmartPointer< mitk::BaseProperty > &  prop,
const tinyxml2::XMLElement *  elem 
)
static

Since a mitk::Label is basically a mitk::PropertyList this function coverts a XML element into a property.

Parameters
keythe property's key
propthe mitk::BaseProperty that will be created
elemthe XML elem from which the property will be created
Returns
true if the conversion was successful and false otherwise

◆ PropertyToXMLElement()

static tinyxml2::XMLElement* mitk::LabelSetIOHelper::PropertyToXMLElement ( tinyxml2::XMLDocument &  doc,
const std::string &  key,
const BaseProperty property 
)
static

Since a mitk::Label is basically a mitk::PropertyList this function coverts the label's properties into XML.

Parameters
doc
keythe property's key which will be used in the XML element
propertythe mitk::BaseProperty that should be converted
Returns
the created XML element

◆ SaveLabelSetImagePreset()

static bool mitk::LabelSetIOHelper::SaveLabelSetImagePreset ( const std::string &  presetFilename,
itk::SmartPointer< mitk::LabelSetImage > &  inputImage 
)
static

Saves the mitk::LabelSet configuration of inputImage to presetFilename. The preset is stored as "*.lsetp".

Parameters
presetFilenamethe filename including the filesystem path
inputImagethe input image from which the preset should be generated
Returns
true if the serialization was successful and false otherwise

The documentation for this class was generated from the following file: