Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkVolumeProperty.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkVolumeProperty_h
00012 #define __mitkVolumeProperty_h
00013 
00014 #include "mitkObject.h"
00015 #include "mitkRCPtr.h"
00016 #include "mitkTransferFunction1D.h"
00017 #include "mitkTransferFunction2DRGBA.h" // by xiang dehui
00018 #include "mitkColorTransferFunction.h"
00019 
00020 
00025 class MITK_VISUALIZATION_API mitkVolumeProperty : public mitkObject
00026 {
00027 public:
00028     MITK_TYPE(mitkVolumeProperty,mitkObject)
00029 
00030     virtual void PrintSelf(ostream& os);
00031 
00032     mitkVolumeProperty();
00033 
00042     void SetInterpolationType(int intpType) { m_InterpolationType = intpType; m_Modified = true; }
00043 
00052     int  GetInterpolationType() { return m_InterpolationType; }
00053 
00057     void SetInterpolationTypeToNearest() { this->SetInterpolationType(MITK_NEAREST_INTERPOLATION); }
00058 
00062     void SetInterpolationTypeToLinear() { this->SetInterpolationType(MITK_LINEAR_INTERPOLATION); }
00063 
00072     const char *GetInterpolationTypeAsString();
00073 
00078     void SetScalarColor(mitkColorTransferFunction *scFunction);
00079 
00084     void SetScalarOpacity(mitkTransferFunction1D *soFunction);
00085 
00090     void SetGradientOpacity(mitkTransferFunction1D *goFunction); 
00091     
00092     // by xiang dehui
00098     void SetTF2DRGBA( mitkTransferFunction2DRGBA *tf2drgba );
00099     
00104     mitkColorTransferFunction* GetScalarColor();
00105 
00110     mitkTransferFunction1D* GetScalarOpacity();
00111 
00116     mitkTransferFunction1D* GetGradientOpacity();
00117     
00118     //by xiang dehui
00124     mitkTransferFunction2DRGBA* GetTF2DRGBA();
00125     
00130     void CorrectScalarOpacity(float sampleDistance);
00131 
00136     void SetOpacityTransferFunction(mitkTransferFunction *moFunction);
00137 
00142     mitkTransferFunction* GetOpacityTransferFunction(); 
00143 
00157     enum TransferFunctionStyle
00158     {
00159         Classical,      
00160         TwoDimensionalRGBA, // by xiang dehui
00161         ThreeDimensional        
00162     };
00163 
00169     void SetTransferFunctionStyle(TransferFunctionStyle tfStyle)
00170     {
00171         m_TransferFunctionStyle = tfStyle;
00172         m_Modified = true;
00173     }
00174     
00180     TransferFunctionStyle GetTransferFunctionStyle()
00181     {
00182         return m_TransferFunctionStyle;
00183     }
00184 
00191     void SetShade(bool shade) { m_Shade = shade; m_Modified = true; }
00192 
00199     int  GetShade() { return m_Shade; }
00200 
00204     void ShadeOn() { this->SetShade(true); }
00205 
00209     void ShadeOff() { this->SetShade(false); }
00210 
00217     void SetGradientOpacityCalculation(bool goEnable) { m_GOEnable = goEnable; m_Modified = true; }
00218 
00225     int  GetGradientOpacityCalculation() { return m_GOEnable; }
00226 
00230     void GradientOpacityCalculationOn() { this->SetGradientOpacityCalculation(true); }
00231 
00235     void GradientOpacityCalculationOff() { this->SetGradientOpacityCalculation(false); }
00236 
00237     //by xiang dehui
00246     void SetTF2DRGBACalculation(bool TF2DRGBAEnable) 
00247     { 
00248         if (TF2DRGBAEnable==m_TF2DRGBAEnable) return;
00249         m_TF2DRGBAEnable = TF2DRGBAEnable;
00250         m_Modified = true; 
00251     }
00252 
00253     //by xiang dehui
00262     int  GetTF2DRGBACalculation() { return m_TF2DRGBAEnable; }
00263 
00264     //by xiang dehui
00268     void TF2DRGBACalculationOn() { this->SetTF2DRGBACalculation(true); }
00269 
00270     //by xiang dehui
00274     void TF2DRGBACalculationOff() { this->SetTF2DRGBACalculation(false); }
00275 
00280     void SetAmbient(float value) { m_Ambient = value; m_Modified = true; }
00281 
00286     float GetAmbient() { return m_Ambient; }
00287 
00292     void SetDiffuse(float value) { m_Diffuse = value; m_Modified = true; }
00293 
00298     float GetDiffuse() { return m_Diffuse; }
00299 
00304     void SetSpecular(float value) { m_Specular = value; m_Modified = true; }
00305 
00310     float GetSpecular() { return m_Specular; }
00311 
00316     void SetSpecularPower(float value) { m_SpecularPower = value; m_Modified = true; }
00317 
00322     float GetSpecularPower() { return m_SpecularPower; }  
00323 
00329     bool IsModified() const;
00330 
00335     void SetUnmodified();
00336 
00337 protected:
00338     virtual ~mitkVolumeProperty();
00339 
00340     mitkRCPtr<mitkColorTransferFunction>  m_ScalarColor;
00341     mitkRCPtr<mitkTransferFunction1D>     m_ScalarOpacity;
00342     mitkRCPtr<mitkTransferFunction1D>     m_GradientOpacity;
00343     mitkRCPtr<mitkTransferFunction2DRGBA> m_TF2DRGBA;
00344     mitkRCPtr<mitkTransferFunction>       m_Opacity;
00345     
00346     float *m_CorrectedScalarOpacity;
00347     int m_OldArraySize;
00348     float m_OldSampleDistance;
00349     
00350     int   m_InterpolationType;  
00351     float m_Ambient;
00352     float m_Diffuse;
00353     float m_Specular;
00354     float m_SpecularPower;
00355     TransferFunctionStyle m_TransferFunctionStyle;
00356 
00357     bool  m_Shade;
00358     bool  m_GOEnable;
00359     bool  m_Modified;
00360     bool  m_TF2DRGBAEnable;
00361 
00362 private:
00363     mitkVolumeProperty(const mitkVolumeProperty&);
00364     void operator=(const mitkVolumeProperty&);
00365 };
00366 
00367 inline const char *mitkVolumeProperty::GetInterpolationTypeAsString()
00368 {
00369     if(m_InterpolationType == MITK_NEAREST_INTERPOLATION)
00370     {
00371         return "Nearest Neighbor";
00372     }
00373     else if(m_InterpolationType == MITK_LINEAR_INTERPOLATION)
00374     {
00375         return "Linear";
00376     }
00377     else
00378     {
00379         return "Unknown";
00380     }
00381 }
00382 
00383  
00384 //#define DEFINED_mitkVolumeProperty
00385  
00386 
00387 
00388 #endif
00389 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3