LookupTable containing a vtkLookupTable. More...
#include <mitkLookupTable.h>
Public Types | |
typedef unsigned char | RawLookupTableType |
Some convenient typedefs. | |
typedef LookupTable | Self |
typedef itk::DataObject | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual vtkLookupTable * | GetVtkLookupTable () const |
virtual RawLookupTableType * | GetRawLookupTable () const |
virtual void | SetVtkLookupTable (vtkLookupTable *lut) |
virtual void | ChangeOpacityForAll (float opacity) |
virtual void | ChangeOpacity (int index, float opacity) |
virtual bool | operator== (const mitk::LookupTable &LookupTable) const |
equality operator implementation | |
virtual bool | operator!= (const LookupTable &LookupTable) const |
non equality operator implementation | |
virtual LookupTable & | operator= (const LookupTable &LookupTable) |
implementation necessary because operator made private in itk::Object | |
virtual void | UpdateOutputInformation () |
virtual void | SetRequestedRegionToLargestPossibleRegion () |
virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
virtual bool | VerifyRequestedRegion () |
virtual void | SetRequestedRegion (itk::DataObject *data) |
LookupTable () | |
virtual | ~LookupTable () |
void | CreateColorTransferFunction (vtkColorTransferFunction *&colorFunction) |
void | CreateOpacityTransferFunction (vtkPiecewiseFunction *&opacityFunction) |
void | CreateGradientTransferFunction (vtkPiecewiseFunction *&gradientFunction) |
Static Public Member Functions | |
static Pointer | New () |
Protected Attributes | |
vtkLookupTable * | m_LookupTable |
LookupTable containing a vtkLookupTable.
Definition at line 38 of file mitkLookupTable.h.
typedef itk::SmartPointer<const Self> mitk::LookupTable::ConstPointer |
Reimplemented in mitk::LabeledImageLookupTable.
Definition at line 46 of file mitkLookupTable.h.
typedef itk::SmartPointer<Self> mitk::LookupTable::Pointer |
Reimplemented in mitk::LabeledImageLookupTable.
Definition at line 46 of file mitkLookupTable.h.
typedef unsigned char mitk::LookupTable::RawLookupTableType |
Some convenient typedefs.
Definition at line 44 of file mitkLookupTable.h.
typedef LookupTable mitk::LookupTable::Self |
Reimplemented in mitk::LabeledImageLookupTable.
Definition at line 46 of file mitkLookupTable.h.
typedef itk::DataObject mitk::LookupTable::Superclass |
Reimplemented in mitk::LabeledImageLookupTable.
Definition at line 46 of file mitkLookupTable.h.
mitk::LookupTable::LookupTable | ( | ) |
Definition at line 26 of file mitkLookupTable.cpp.
References m_LookupTable, New(), and SetRequestedRegionToLargestPossibleRegion().
{ m_LookupTable = vtkLookupTable::New(); this->SetRequestedRegionToLargestPossibleRegion(); }
mitk::LookupTable::~LookupTable | ( | ) | [virtual] |
Definition at line 33 of file mitkLookupTable.cpp.
{ if ( m_LookupTable ) { m_LookupTable->Delete(); m_LookupTable = NULL; } }
void mitk::LookupTable::ChangeOpacity | ( | int | index, |
float | opacity | ||
) | [virtual] |
Definition at line 84 of file mitkLookupTable.cpp.
References MITK_INFO.
{ int noValues = m_LookupTable->GetNumberOfTableValues (); if (index>noValues) { MITK_INFO << "could not change opacity. index exceed size of lut ... " << std::endl; return; } vtkFloatingPointType rgba[ 4 ]; m_LookupTable->GetTableValue ( index, rgba ); rgba[ 3 ] = opacity; m_LookupTable->SetTableValue ( index, rgba ); this->Modified(); // need to call modiefied, since LookupTableProperty seems to be unchanged so no widget-updat is executed }
void mitk::LookupTable::ChangeOpacityForAll | ( | float | opacity ) | [virtual] |
Definition at line 68 of file mitkLookupTable.cpp.
{ int noValues = m_LookupTable->GetNumberOfTableValues (); vtkFloatingPointType rgba[ 4 ]; for ( int i = 0;i < noValues;i++ ) { m_LookupTable->GetTableValue ( i, rgba ); rgba[ 3 ] = opacity; m_LookupTable->SetTableValue ( i, rgba ); } this->Modified(); // need to call modiefied, since LookupTableProperty seems to be unchanged so no widget-updat is executed }
void mitk::LookupTable::CreateColorTransferFunction | ( | vtkColorTransferFunction *& | colorFunction ) |
Definition at line 220 of file mitkLookupTable.cpp.
{ if(colorFunction==NULL) colorFunction = vtkColorTransferFunction::New(); mitk::LookupTable::RawLookupTableType *rgba = GetRawLookupTable(); int i, num_of_values=m_LookupTable->GetNumberOfTableValues(); vtkFloatingPointType *cols; vtkFloatingPointType *colsHead; colsHead=cols=(vtkFloatingPointType *)malloc(sizeof(vtkFloatingPointType)*num_of_values*3); for(i=0;i<num_of_values;++i) { *cols=*rgba/255.0; ++cols; ++rgba; *cols=*rgba/255.0; ++cols; ++rgba; *cols=*rgba/255.0; ++cols; ++rgba; ++rgba; } colorFunction->BuildFunctionFromTable(m_LookupTable->GetTableRange()[0], m_LookupTable->GetTableRange()[1], num_of_values-1, colsHead); free(colsHead); }
void mitk::LookupTable::CreateGradientTransferFunction | ( | vtkPiecewiseFunction *& | gradientFunction ) |
Definition at line 268 of file mitkLookupTable.cpp.
{ if(gradientFunction==NULL) gradientFunction = vtkPiecewiseFunction::New(); mitk::LookupTable::RawLookupTableType *rgba = GetRawLookupTable(); int i, num_of_values=m_LookupTable->GetNumberOfTableValues(); vtkFloatingPointType *alphas; vtkFloatingPointType *alphasHead; alphasHead=alphas=(vtkFloatingPointType*)malloc(sizeof(vtkFloatingPointType)*num_of_values); rgba+=3; for(i=0;i<num_of_values;++i) { *alphas=*rgba * 1024.0; ++alphas; rgba+=4; } gradientFunction->BuildFunctionFromTable(m_LookupTable->GetTableRange()[0], m_LookupTable->GetTableRange()[1], num_of_values-1, alphasHead); free(alphasHead); }
void mitk::LookupTable::CreateOpacityTransferFunction | ( | vtkPiecewiseFunction *& | opacityFunction ) |
Definition at line 245 of file mitkLookupTable.cpp.
{ if(opacityFunction==NULL) opacityFunction = vtkPiecewiseFunction::New(); mitk::LookupTable::RawLookupTableType *rgba = GetRawLookupTable(); int i, num_of_values=m_LookupTable->GetNumberOfTableValues(); vtkFloatingPointType *alphas; vtkFloatingPointType *alphasHead; alphasHead=alphas=(vtkFloatingPointType*)malloc(sizeof(vtkFloatingPointType)*num_of_values); rgba+=3; for(i=0;i<num_of_values;++i) { *alphas=*rgba * 1024.0; ++alphas; rgba+=4; } opacityFunction->BuildFunctionFromTable(m_LookupTable->GetTableRange()[0], m_LookupTable->GetTableRange()[1], num_of_values-1, alphasHead); free(alphasHead); }
virtual const char* mitk::LookupTable::GetClassName | ( | ) | const [virtual] |
Reimplemented in mitk::LabeledImageLookupTable.
mitk::LookupTable::RawLookupTableType * mitk::LookupTable::GetRawLookupTable | ( | ) | const [virtual] |
Definition at line 109 of file mitkLookupTable.cpp.
References MITK_INFO.
{ if (m_LookupTable==NULL) MITK_INFO << "uuups..." << std::endl; return m_LookupTable->GetPointer( 0 ); };
vtkLookupTable * mitk::LookupTable::GetVtkLookupTable | ( | ) | const [virtual] |
Definition at line 104 of file mitkLookupTable.cpp.
Referenced by mitk::EnhancedPointSetVtkMapper3D::ApplyProperties(), operator=(), operator==(), and mitk::VectorImageMapper2D::Paint().
{ return m_LookupTable; };
static Pointer mitk::LookupTable::New | ( | ) | [static] |
Reimplemented in mitk::LabeledImageLookupTable.
Referenced by mitk::LookupTablePropertyDeserializer::Deserialize(), mitk::VectorImageVtkGlyphMapper3D::GenerateData(), LookupTable(), mitkLookupTableTest(), mitkPropertySerializationTest(), QmitkDiffusionTensorEstimation::SetDefaultNodeProperties(), and mitk::VolumeDataVtkMapper3D::SetDefaultProperties().
bool mitk::LookupTable::operator!= | ( | const LookupTable & | LookupTable ) | const [virtual] |
non equality operator implementation
un-equality operator implementation
Definition at line 164 of file mitkLookupTable.cpp.
{ return !(*this == other); }
mitk::LookupTable & mitk::LookupTable::operator= | ( | const LookupTable & | LookupTable ) | [virtual] |
implementation necessary because operator made private in itk::Object
assignment operator implementation
Definition at line 172 of file mitkLookupTable.cpp.
References GetVtkLookupTable().
{ if ( this == &LookupTable ) { return * this; } else { m_LookupTable = LookupTable.GetVtkLookupTable(); return *this; } }
bool mitk::LookupTable::operator== | ( | const mitk::LookupTable & | LookupTable ) | const [virtual] |
equality operator implementation
equality operator inplementation
Definition at line 119 of file mitkLookupTable.cpp.
References GetVtkLookupTable().
{ if ( m_LookupTable == other.GetVtkLookupTable()) return true; vtkLookupTable* olut = other.GetVtkLookupTable(); if (olut == NULL) return false; bool equal = (m_LookupTable->GetNumberOfColors() == olut->GetNumberOfColors()) && (m_LookupTable->GetTableRange()[0] == olut->GetTableRange()[0]) && (m_LookupTable->GetTableRange()[1] == olut->GetTableRange()[1]) && (m_LookupTable->GetHueRange()[0] == olut->GetHueRange()[0]) && (m_LookupTable->GetHueRange()[1] == olut->GetHueRange()[1]) && (m_LookupTable->GetSaturationRange()[0] == olut->GetSaturationRange()[0]) && (m_LookupTable->GetSaturationRange()[1] == olut->GetSaturationRange()[1]) && (m_LookupTable->GetValueRange()[0] == olut->GetValueRange()[0]) && (m_LookupTable->GetValueRange()[1] == olut->GetValueRange()[1]) && (m_LookupTable->GetAlphaRange()[0] == olut->GetAlphaRange()[0]) && (m_LookupTable->GetAlphaRange()[1] == olut->GetAlphaRange()[1]) && (m_LookupTable->GetRamp() == olut->GetRamp()) && (m_LookupTable->GetScale() == olut->GetScale()) && (m_LookupTable->GetAlpha() == olut->GetAlpha()) && (m_LookupTable->GetTable()->GetNumberOfTuples() == olut->GetTable()->GetNumberOfTuples()); if (equal == false) return false; //for (vtkIdType i=0; i < m_LookupTable->GetTable()->GetNumberOfTuples(); i++) //{ // if (m_LookupTable->GetTable()->GetTuple(i) != olut->GetTable()->GetTuple(i)) // return false; //} for (vtkIdType i=0; i < m_LookupTable->GetNumberOfTableValues(); i++) { bool tvequal = (m_LookupTable->GetTableValue(i)[0] == olut->GetTableValue(i)[0]) && (m_LookupTable->GetTableValue(i)[1] == olut->GetTableValue(i)[1]) && (m_LookupTable->GetTableValue(i)[2] == olut->GetTableValue(i)[2]) && (m_LookupTable->GetTableValue(i)[3] == olut->GetTableValue(i)[3]); if (tvequal == false) return false; } return true; }
bool mitk::LookupTable::RequestedRegionIsOutsideOfTheBufferedRegion | ( | ) | [virtual] |
Checks, if the requested region lies outside of the buffered region by calling verifyRequestedRegion().
Definition at line 198 of file mitkLookupTable.cpp.
{ return false; }
void mitk::LookupTable::SetRequestedRegion | ( | itk::DataObject * | data ) | [virtual] |
This method has no effect for lookup tables, since we do not support the region-mechanism
Definition at line 214 of file mitkLookupTable.cpp.
{ //not implemented, since we always want to have the RequestedRegion //to be set to LargestPossibleRegion }
void mitk::LookupTable::SetRequestedRegionToLargestPossibleRegion | ( | ) | [virtual] |
Sets the requested Region to the largest possible region. This method is not implemented, since this is the default behaviour of the itk pipeline and we do not support the requested-region mechanism for lookup-tables
Definition at line 194 of file mitkLookupTable.cpp.
Referenced by LookupTable().
{}
void mitk::LookupTable::SetVtkLookupTable | ( | vtkLookupTable * | lut ) | [virtual] |
Definition at line 42 of file mitkLookupTable.cpp.
{ if(m_LookupTable == lut) { return; } if(m_LookupTable) { m_LookupTable->UnRegister(NULL); m_LookupTable = NULL; } if(lut) { lut->Register(NULL); } m_LookupTable = lut; this->Modified(); }
void mitk::LookupTable::UpdateOutputInformation | ( | ) | [virtual] |
Updates the output information of the current object by calling updateOutputInformation of the data objects source object.
Definition at line 185 of file mitkLookupTable.cpp.
{
if ( this->GetSource( ) )
{
this->GetSource( ) ->UpdateOutputInformation( );
}
}
bool mitk::LookupTable::VerifyRequestedRegion | ( | ) | [virtual] |
Checks if the requested region is completely contained in the buffered region. Since we always want to process the lookup table as a whole, this method always returns true
Definition at line 204 of file mitkLookupTable.cpp.
{ //normally we should check if the requested region lies within the //largest possible region. Since for lookup-tables we assume, that the //requested region is always the largest possible region, we can always //return true! return true; }
vtkLookupTable* mitk::LookupTable::m_LookupTable [protected] |
Definition at line 122 of file mitkLookupTable.h.
Referenced by mitk::LabeledImageLookupTable::LabeledImageLookupTable(), and LookupTable().