VTK
dox/Rendering/vtkVolumeProperty.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVolumeProperty.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00049 #ifndef __vtkVolumeProperty_h
00050 #define __vtkVolumeProperty_h
00051 
00052 #include "vtkObject.h"
00053 
00054 class vtkPiecewiseFunction;
00055 class vtkTimeStamp;
00056 class vtkColorTransferFunction;
00057 
00058 class VTK_RENDERING_EXPORT vtkVolumeProperty : public vtkObject
00059 {
00060 public:
00061   static vtkVolumeProperty *New();
00062   vtkTypeMacro(vtkVolumeProperty,vtkObject);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064   void DeepCopy(vtkVolumeProperty *p);
00065 
00068   unsigned long GetMTime();
00069  
00071 
00085   vtkSetClampMacro( IndependentComponents, int, 0, 1 );
00086   vtkGetMacro( IndependentComponents, int );
00087   vtkBooleanMacro( IndependentComponents, int );
00089 
00091 
00093   vtkSetClampMacro( InterpolationType, int,
00094         VTK_NEAREST_INTERPOLATION, VTK_LINEAR_INTERPOLATION);
00095   vtkGetMacro(InterpolationType,int);
00096   void SetInterpolationTypeToNearest() 
00097         {this->SetInterpolationType(VTK_NEAREST_INTERPOLATION);};
00098   void SetInterpolationTypeToLinear() 
00099         {this->SetInterpolationType(VTK_LINEAR_INTERPOLATION);};
00100   const char *GetInterpolationTypeAsString(void);
00102 
00104 
00105   virtual void SetComponentWeight(int index, double value);
00106   virtual double GetComponentWeight(int index);
00108 
00110 
00113   void SetColor( int index, vtkPiecewiseFunction *function );
00114   void SetColor( vtkPiecewiseFunction *f ){this->SetColor(0,f);};
00116       
00118 
00121   void SetColor( int index, vtkColorTransferFunction *function );
00122   void SetColor( vtkColorTransferFunction *f ){this->SetColor(0,f);};
00124   
00126 
00128   int GetColorChannels( int index );
00129   int GetColorChannels(){return this->GetColorChannels(0);};
00131   
00133 
00135   vtkPiecewiseFunction *GetGrayTransferFunction( int index );
00136   vtkPiecewiseFunction *GetGrayTransferFunction()
00137     {return this->GetGrayTransferFunction(0);};
00139   
00141 
00144   vtkColorTransferFunction *GetRGBTransferFunction( int index );
00145   vtkColorTransferFunction *GetRGBTransferFunction()
00146     {return this->GetRGBTransferFunction(0);};
00148   
00150 
00152   void SetScalarOpacity( int index, vtkPiecewiseFunction *function );
00153   void SetScalarOpacity( vtkPiecewiseFunction *f )
00154     {this->SetScalarOpacity(0,f);};
00156   
00158 
00161   vtkPiecewiseFunction *GetScalarOpacity( int index );
00162   vtkPiecewiseFunction *GetScalarOpacity()
00163     {return this->GetScalarOpacity(0);};
00165       
00167 
00172   void SetScalarOpacityUnitDistance( int index, double distance );
00173   void SetScalarOpacityUnitDistance( double distance )
00174     {this->SetScalarOpacityUnitDistance( 0, distance );}
00175   double GetScalarOpacityUnitDistance( int index );
00176   double GetScalarOpacityUnitDistance()
00177     {return this->GetScalarOpacityUnitDistance(0);}
00179   
00180   
00182 
00184   void SetGradientOpacity( int index, vtkPiecewiseFunction *function );
00185   void SetGradientOpacity( vtkPiecewiseFunction *function )
00186     {this->SetGradientOpacity(0,function);}
00188   
00190 
00194   vtkPiecewiseFunction *GetGradientOpacity( int index );
00195   vtkPiecewiseFunction *GetGradientOpacity()
00196     {return this->GetGradientOpacity( 0 );}
00198 
00200 
00205   virtual void SetDisableGradientOpacity( int index, int value );
00206   virtual void SetDisableGradientOpacity( int value )
00207     { this->SetDisableGradientOpacity(0, value); }
00208   virtual void DisableGradientOpacityOn( int index )
00209     { this->SetDisableGradientOpacity(index, 1); }
00210   virtual void DisableGradientOpacityOn()
00211     { this->DisableGradientOpacityOn(0); }
00212   virtual void DisableGradientOpacityOff( int index )
00213     { this->SetDisableGradientOpacity(index, 0); }
00214   virtual void DisableGradientOpacityOff()
00215     { this->DisableGradientOpacityOff(0); }
00216   virtual int GetDisableGradientOpacity( int index );
00217   virtual int GetDisableGradientOpacity()
00218     { return this->GetDisableGradientOpacity(0); }
00219   vtkPiecewiseFunction *GetStoredGradientOpacity( int index );
00220   vtkPiecewiseFunction *GetStoredGradientOpacity()
00221     {return this->GetStoredGradientOpacity( 0 );}
00223 
00225 
00233   void SetShade( int index, int value );
00234   void SetShade( int value ) {this->SetShade(0,value);}
00235   int GetShade( int index );
00236   int GetShade() {return this->GetShade(0);}
00237   void ShadeOn( int index );
00238   void ShadeOn() {this->ShadeOn(0);}
00239   void ShadeOff( int index );
00240   void ShadeOff() {this->ShadeOff(0);}
00242 
00244 
00245   void SetAmbient( int index, double value );
00246   void SetAmbient( double value ) {this->SetAmbient( 0, value );}
00247   double GetAmbient( int index );
00248   double GetAmbient() {return this->GetAmbient(0);}
00250 
00252 
00253   void SetDiffuse( int index, double value );
00254   void SetDiffuse( double value ) {this->SetDiffuse( 0, value );}
00255   double GetDiffuse( int index );
00256   double GetDiffuse() {return this->GetDiffuse(0);}
00258 
00260 
00261   void SetSpecular( int index, double value );
00262   void SetSpecular( double value ) {this->SetSpecular( 0, value );}
00263   double GetSpecular( int index );
00264   double GetSpecular() {return this->GetSpecular(0);}
00266 
00268 
00269   void SetSpecularPower( int index, double value );
00270   void SetSpecularPower( double value ) {this->SetSpecularPower( 0, value );}
00271   double GetSpecularPower( int index );
00272   double GetSpecularPower() {return this->GetSpecularPower(0);}
00274 
00275   //BTX
00280   void UpdateMTimes(); 
00281 
00283 
00285   vtkTimeStamp GetGradientOpacityMTime( int index );
00286   vtkTimeStamp GetGradientOpacityMTime()
00287     { return this->GetGradientOpacityMTime(0); }  
00289       
00291 
00293   vtkTimeStamp GetScalarOpacityMTime( int index );
00294   vtkTimeStamp GetScalarOpacityMTime()
00295     { return this->GetScalarOpacityMTime(0); }  
00297 
00299 
00301   vtkTimeStamp GetRGBTransferFunctionMTime( int index );
00302   vtkTimeStamp GetRGBTransferFunctionMTime()
00303     { return this->GetRGBTransferFunctionMTime(0); }  
00305 
00307 
00309   vtkTimeStamp GetGrayTransferFunctionMTime( int index );
00310   vtkTimeStamp GetGrayTransferFunctionMTime()
00311     { return this->GetGrayTransferFunctionMTime(0); }  
00312   //ETX
00314 
00315 protected:
00316   vtkVolumeProperty();
00317   ~vtkVolumeProperty();
00318 
00319   int                           IndependentComponents;
00320   double                        ComponentWeight[VTK_MAX_VRCOMP];
00321 
00322   int                           InterpolationType;
00323 
00324   int                           ColorChannels[VTK_MAX_VRCOMP];
00325 
00326   vtkPiecewiseFunction          *GrayTransferFunction[VTK_MAX_VRCOMP];
00327   vtkTimeStamp                  GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
00328 
00329   vtkColorTransferFunction      *RGBTransferFunction[VTK_MAX_VRCOMP];
00330   vtkTimeStamp                  RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
00331 
00332   vtkPiecewiseFunction          *ScalarOpacity[VTK_MAX_VRCOMP];
00333   vtkTimeStamp                  ScalarOpacityMTime[VTK_MAX_VRCOMP];
00334   double                        ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
00335   
00336   vtkPiecewiseFunction          *GradientOpacity[VTK_MAX_VRCOMP];
00337   vtkTimeStamp                  GradientOpacityMTime[VTK_MAX_VRCOMP];
00338   vtkPiecewiseFunction          *DefaultGradientOpacity[VTK_MAX_VRCOMP];
00339   int                           DisableGradientOpacity[VTK_MAX_VRCOMP];
00340 
00341   int                           Shade[VTK_MAX_VRCOMP];
00342   double                        Ambient[VTK_MAX_VRCOMP];
00343   double                        Diffuse[VTK_MAX_VRCOMP];
00344   double                        Specular[VTK_MAX_VRCOMP];
00345   double                        SpecularPower[VTK_MAX_VRCOMP];
00346 
00347   virtual void                  CreateDefaultGradientOpacity(int index);
00348 
00349 private:
00350   vtkVolumeProperty(const vtkVolumeProperty&);  // Not implemented.
00351   void operator=(const vtkVolumeProperty&);  // Not implemented.
00352 };
00353 
00355 
00356 inline const char *vtkVolumeProperty::GetInterpolationTypeAsString(void)
00357 {
00358   if( this->InterpolationType == VTK_NEAREST_INTERPOLATION )
00359     {
00360     return "Nearest Neighbor";
00361     }
00362   else if( this->InterpolationType == VTK_LINEAR_INTERPOLATION )
00363     {
00364     return "Linear";
00365     }
00366   else
00367     {
00368     return "Unknown";
00369     }
00370 }
00372 
00373 #endif