14 #include <vtkObjectFactory.h> 24 const std::string LevelWindowPreset::PRESET =
"preset";
37 vtkXMLParser::SetStream(&presetStream);
38 if (!vtkXMLParser::Parse())
41 MITK_INFO <<
"LevelWindowPreset::LoadPreset xml file cannot parse!" << std::endl;
53 vtkXMLParser::SetFileName(fileName.c_str());
55 if (!vtkXMLParser::Parse())
58 MITK_INFO <<
"LevelWindowPreset::LoadPreset xml file cannot parse!" << std::endl;
65 void LevelWindowPreset::StartElement(
const char *elementName,
const char **atts)
67 std::string elementNameString = elementName;
68 if (elementNameString == PRESET)
70 std::string name = ReadXMLStringAttribut(
"NAME", atts);
71 std::string level = ReadXMLStringAttribut(
"LEVEL", atts);
72 double lev = atof(level.c_str());
73 std::string window = ReadXMLStringAttribut(
"WINDOW", atts);
74 double win = atof(window.c_str());
80 std::string LevelWindowPreset::ReadXMLStringAttribut(std::string name,
const char **atts)
84 const char **attsIter = atts;
88 if (name == *attsIter)
105 void LevelWindowPreset::save()
114 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()
~LevelWindowPreset() override
double getLevel(std::string name)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.