Medical Imaging Interaction Toolkit  2016.11.0
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 (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 (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::LabelLoadLabelFromTiXmlDocument (TiXmlElement *labelElem)
 Creates a mitk::Label from a TiXmlElement. More...
 
static TiXmlElement * GetLabelAsTiXmlElement (Label *label)
 Creates a TiXmlElement from a mitk::Label. More...
 
static TiXmlElement * PropertyToXmlElem (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 PropertyFromXmlElem (std::string &key, itk::SmartPointer< mitk::BaseProperty > &prop, TiXmlElement *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

TiXmlElement * mitk::LabelSetIOHelper::GetLabelAsTiXmlElement ( Label label)
static

Creates a TiXmlElement from a mitk::Label.

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

Definition at line 114 of file mitkLabelSetIOHelper.cpp.

References mitk::PropertyList::GetMap().

Referenced by SaveLabelSetImagePreset(), and mitk::LabelSetImageIO::Write().

mitk::Label::Pointer mitk::LabelSetIOHelper::LoadLabelFromTiXmlDocument ( TiXmlElement *  labelElem)
static

Creates a mitk::Label from a TiXmlElement.

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

Definition at line 131 of file mitkLabelSetIOHelper.cpp.

References mitk::Label::New(), and PropertyFromXmlElem().

Referenced by LoadLabelSetImagePreset(), and mitk::LabelSetImageIO::Read().

void mitk::LabelSetIOHelper::LoadLabelSetImagePreset ( 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

Definition at line 62 of file mitkLabelSetIOHelper.cpp.

References LoadLabelFromTiXmlDocument(), and MITK_INFO.

bool mitk::LabelSetIOHelper::PropertyFromXmlElem ( std::string &  key,
itk::SmartPointer< mitk::BaseProperty > &  prop,
TiXmlElement *  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

Definition at line 190 of file mitkLabelSetIOHelper.cpp.

References MITK_ERROR, and MITK_WARN.

Referenced by LoadLabelFromTiXmlDocument().

TiXmlElement * mitk::LabelSetIOHelper::PropertyToXmlElem ( 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
keythe property's key which will be used in the XML element
propertythe mitk::BaseProperty that should be converted
Returns
the created TiXmlElement

Definition at line 150 of file mitkLabelSetIOHelper.cpp.

References MITK_ERROR, and MITK_WARN.

bool mitk::LabelSetIOHelper::SaveLabelSetImagePreset ( 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

Definition at line 23 of file mitkLabelSetIOHelper.cpp.

References GetLabelAsTiXmlElement().


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