18 #include <vtkObjectFactory.h>
28 const std::string LevelWindowPreset::PRESET =
"preset";
41 vtkXMLParser::SetStream(&presetStream);
42 if (!vtkXMLParser::Parse())
45 MITK_INFO <<
"LevelWindowPreset::LoadPreset xml file cannot parse!" << std::endl;
57 vtkXMLParser::SetFileName(fileName.c_str());
59 if (!vtkXMLParser::Parse())
62 MITK_INFO <<
"LevelWindowPreset::LoadPreset xml file cannot parse!" << std::endl;
69 void LevelWindowPreset::StartElement(
const char *elementName,
const char **atts)
71 std::string elementNameString = elementName;
72 if (elementNameString == PRESET)
74 std::string name = ReadXMLStringAttribut(
"NAME", atts);
75 std::string level = ReadXMLStringAttribut(
"LEVEL", atts);
76 double lev = atof(level.c_str());
77 std::string window = ReadXMLStringAttribut(
"WINDOW", atts);
78 double win = atof(window.c_str());
84 std::string LevelWindowPreset::ReadXMLStringAttribut(std::string name,
const char **atts)
88 const char **attsIter = atts;
92 if (name == *attsIter)
102 return std::string();
109 void LevelWindowPreset::save()
118 m_Window = newWindow;
DataCollection - Class to facilitate loading/accessing structured data.
std::map< std::string, double > & getLevelPresets()
Module * GetModule() const
void newPresets(std::map< std::string, double > newLevel, std::map< std::string, double > newWindow)
vtkStandardNewMacro(AnatomicalStructureColorPresets)
double getWindow(std::string window)
std::map< std::string, double > & getWindowPresets()
double getLevel(std::string name)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.