Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
00019 #define MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
00020
00021 #include "mitkHistogramGenerator.h"
00022 #include "mitkCommon.h"
00023 #include "mitkImage.h"
00024
00025 #include <itkObject.h>
00026 #include <itkRGBPixel.h>
00027 #include <itkHistogram.h>
00028
00029 #include <vtkColorTransferFunction.h>
00030 #include <vtkPiecewiseFunction.h>
00031 #include <vtkSmartPointer.h>
00032
00033 #include <vector>
00034 #include <algorithm>
00035 #include <set>
00036
00037
00038 namespace mitk {
00039
00053 class MITK_CORE_EXPORT TransferFunction : public itk::Object
00054 {
00055 public:
00056 typedef std::vector<std::pair<double, double> > ControlPoints;
00057 typedef std::vector<std::pair<double, itk::RGBPixel<double> > > RGBControlPoints;
00058
00059
00060 mitkClassMacro(TransferFunction, itk::DataObject);
00061
00062 itkNewMacro(Self);
00063
00064
00066 itkSetMacro(Min,int);
00067
00069 itkSetMacro(Max,int);
00070
00072 itkGetMacro(Min,int);
00073
00075 itkGetMacro(Max,int);
00076
00078 itkGetMacro(ScalarOpacityFunction,vtkPiecewiseFunction*);
00079
00081 itkGetMacro(GradientOpacityFunction,vtkPiecewiseFunction*);
00082
00084 itkGetMacro(ColorTransferFunction,vtkColorTransferFunction*);
00085
00087 itkGetConstObjectMacro(Histogram,HistogramGenerator::HistogramType);
00088
00089
00091 void InitializeByMitkImage(const mitk::Image* image);
00092
00094 void InitializeByItkHistogram(const itk::Statistics::Histogram<double>* histogram);
00095
00098 void InitializeHistogram( const mitk::Image* image );
00099
00102 void SetScalarOpacityPoints(TransferFunction::ControlPoints points);
00103
00106 void SetGradientOpacityPoints(TransferFunction::ControlPoints points);
00107
00110 void SetRGBPoints(TransferFunction::RGBControlPoints rgbpoints);
00111
00112
00114 void AddScalarOpacityPoint(double x, double value);
00115
00117 void AddGradientOpacityPoint(double x, double value);
00118
00120 void AddRGBPoint(double x, double r, double g, double b);
00121
00122
00124 TransferFunction::ControlPoints &GetScalarOpacityPoints();
00125
00127 TransferFunction::ControlPoints &GetGradientOpacityPoints();
00128
00130 TransferFunction::RGBControlPoints &GetRGBPoints();
00131
00132
00135 int RemoveScalarOpacityPoint(double x);
00136
00139 int RemoveGradientOpacityPoint(double x);
00140
00142 int RemoveRGBPoint(double x);
00143
00145 void ClearScalarOpacityPoints();
00146
00149 void ClearGradientOpacityPoints();
00150
00152 void ClearRGBPoints();
00153
00154 bool operator==(Self& other);
00155
00156
00157 protected:
00158 TransferFunction();
00159 virtual ~TransferFunction();
00160
00162 vtkSmartPointer<vtkPiecewiseFunction> m_ScalarOpacityFunction;
00163
00165 vtkSmartPointer<vtkPiecewiseFunction> m_GradientOpacityFunction;
00166
00168 vtkSmartPointer<vtkColorTransferFunction> m_ColorTransferFunction;
00169
00171 int m_Min;
00172
00174 int m_Max;
00175
00177 mitk::HistogramGenerator::HistogramType::ConstPointer m_Histogram;
00178
00179 private:
00181 TransferFunction::ControlPoints m_ScalarOpacityPoints;
00182
00184 TransferFunction::ControlPoints m_GradientOpacityPoints;
00185
00187 TransferFunction::RGBControlPoints m_RGBPoints;
00188
00189 };
00190
00191 }
00192
00193 #endif