Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::LookupTablePropertySerializer Class Reference

Inheritance diagram for mitk::LookupTablePropertySerializer:
Inheritance graph
[legend]
Collaboration diagram for mitk::LookupTablePropertySerializer:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
LookupTablePropertySerializer 
Self
typedef BasePropertySerializer Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual TiXmlElementSerialize ()
 Serializes given BaseProperty object.

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 LookupTablePropertySerializer ()
virtual ~LookupTablePropertySerializer ()

Detailed Description

Definition at line 30 of file mitkLookupTablePropertySerializer.cpp.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::LookupTablePropertySerializer::ConstPointer

Reimplemented from mitk::BasePropertySerializer.

Definition at line 34 of file mitkLookupTablePropertySerializer.cpp.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 34 of file mitkLookupTablePropertySerializer.cpp.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 34 of file mitkLookupTablePropertySerializer.cpp.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 34 of file mitkLookupTablePropertySerializer.cpp.


Constructor & Destructor Documentation

mitk::LookupTablePropertySerializer::LookupTablePropertySerializer (  ) [inline, protected]

Definition at line 110 of file mitkLookupTablePropertySerializer.cpp.

{}
virtual mitk::LookupTablePropertySerializer::~LookupTablePropertySerializer (  ) [inline, protected, virtual]

Definition at line 111 of file mitkLookupTablePropertySerializer.cpp.

{}

Member Function Documentation

virtual const char* mitk::LookupTablePropertySerializer::GetClassName (  ) const [virtual]

Reimplemented from mitk::BasePropertySerializer.

static Pointer mitk::LookupTablePropertySerializer::New (  ) [static]
virtual TiXmlElement* mitk::LookupTablePropertySerializer::Serialize (  ) [inline, virtual]

Serializes given BaseProperty object.

Returns:
the filename of the newly created file.

This should be overwritten by specific sub-classes.

Reimplemented from mitk::BasePropertySerializer.

Definition at line 37 of file mitkLookupTablePropertySerializer.cpp.

References TiXmlNode::LinkEndChild(), TiXmlElement::SetAttribute(), and TiXmlElement::SetDoubleAttribute().

    {
      if (const LookupTableProperty* prop = dynamic_cast<const LookupTableProperty*>(m_Property.GetPointer()))
      {
        LookupTable::Pointer mitkLut = const_cast<LookupTableProperty*>(prop)->GetLookupTable();
        if (mitkLut.IsNull()) return NULL; // really?

        vtkLookupTable* lut = mitkLut->GetVtkLookupTable();
        if (!lut) return NULL;

        TiXmlElement* element = new TiXmlElement("LookupTable");

#if ( (VTK_MAJOR_VERSION < 5) && (VTK_MINOR_VERSION < 4) )
        float*  range;
        float*  rgba;
#else
        double*  range;
        double*  rgba;
#endif

        element->SetAttribute("NumberOfColors", lut->GetNumberOfTableValues());
        element->SetAttribute("Scale", lut->GetScale());
        element->SetAttribute("Ramp", lut->GetRamp());

        range = lut->GetHueRange();
        TiXmlElement* child = new TiXmlElement("HueRange");
        element->LinkEndChild( child );
          child->SetDoubleAttribute("min", range[0]);
          child->SetDoubleAttribute("max", range[1]);
        
        range = lut->GetValueRange();
                      child = new TiXmlElement("ValueRange");
        element->LinkEndChild( child );
          child->SetDoubleAttribute("min", range[0]);
          child->SetDoubleAttribute("max", range[1]);

        range = lut->GetSaturationRange();
                      child = new TiXmlElement("SaturationRange");
        element->LinkEndChild( child );
          child->SetDoubleAttribute("min", range[0]);
          child->SetDoubleAttribute("max", range[1]);

        range = lut->GetAlphaRange();
                      child = new TiXmlElement("AlphaRange");
        element->LinkEndChild( child );
          child->SetDoubleAttribute("min", range[0]);
          child->SetDoubleAttribute("max", range[1]);

        range = lut->GetTableRange();
                      child = new TiXmlElement("TableRange");
        element->LinkEndChild( child );
          child->SetDoubleAttribute("min", range[0]);
          child->SetDoubleAttribute("max", range[1]);

        child = new TiXmlElement("Table");
        element->LinkEndChild( child );
        for ( int index = 0; index < lut->GetNumberOfTableValues(); ++index)
        {
          TiXmlElement* grandChildNinife = new TiXmlElement("RgbaColor");
          rgba = lut->GetTableValue(index);
          grandChildNinife->SetDoubleAttribute("R", rgba[0]);
          grandChildNinife->SetDoubleAttribute("G", rgba[1]);
          grandChildNinife->SetDoubleAttribute("B", rgba[2]);
          grandChildNinife->SetDoubleAttribute("A", rgba[3]);
          child->LinkEndChild( grandChildNinife );
        }
        return element;
      }
      else return NULL;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines