Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkVolumeProperty.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeProperty.h,v $
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 
00060 #ifndef __vtkVolumeProperty_h
00061 #define __vtkVolumeProperty_h
00062 
00063 #include "vtkObject.h"
00064 
00065 class vtkPiecewiseFunction;
00066 class vtkTimeStamp;
00067 class vtkColorTransferFunction;
00068 
00069 class VTK_RENDERING_EXPORT vtkVolumeProperty : public vtkObject
00070 {
00071 public:
00072   static vtkVolumeProperty *New();
00073   vtkTypeRevisionMacro(vtkVolumeProperty,vtkObject);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00078   unsigned long GetMTime();
00079  
00081 
00095   vtkSetClampMacro( IndependentComponents, int, 0, 1 );
00096   vtkGetMacro( IndependentComponents, int );
00097   vtkBooleanMacro( IndependentComponents, int );
00099 
00101 
00102   virtual void SetComponentWeight(int index, double value);
00103   virtual double GetComponentWeight(int index);
00105 
00107 
00108   vtkSetClampMacro( InterpolationType, int,
00109         VTK_NEAREST_INTERPOLATION, VTK_LINEAR_INTERPOLATION);
00110   vtkGetMacro(InterpolationType,int);
00111   void SetInterpolationTypeToNearest() 
00112         {this->SetInterpolationType(VTK_NEAREST_INTERPOLATION);};
00113   void SetInterpolationTypeToLinear() 
00114         {this->SetInterpolationType(VTK_LINEAR_INTERPOLATION);};
00115   const char *GetInterpolationTypeAsString(void);
00117 
00119 
00122   void SetColor( int index, vtkPiecewiseFunction *function );
00123   void SetColor( vtkPiecewiseFunction *f ){this->SetColor(0,f);};
00125       
00127 
00130   void SetColor( int index, vtkColorTransferFunction *function );
00131   void SetColor( vtkColorTransferFunction *f ){this->SetColor(0,f);};
00133   
00135 
00137   int GetColorChannels( int index );
00138   int GetColorChannels(){return this->GetColorChannels(0);};
00140   
00142 
00144   vtkPiecewiseFunction *GetGrayTransferFunction( int index );
00145   vtkPiecewiseFunction *GetGrayTransferFunction()
00146     {return this->GetGrayTransferFunction(0);};
00148   
00150 
00153   vtkColorTransferFunction *GetRGBTransferFunction( int index );
00154   vtkColorTransferFunction *GetRGBTransferFunction()
00155     {return this->GetRGBTransferFunction(0);};
00157   
00159 
00161   void SetScalarOpacity( int index, vtkPiecewiseFunction *function );
00162   void SetScalarOpacity( vtkPiecewiseFunction *f )
00163     {this->SetScalarOpacity(0,f);};
00165   
00167 
00170   vtkPiecewiseFunction *GetScalarOpacity( int index );
00171   vtkPiecewiseFunction *GetScalarOpacity()
00172     {return this->GetScalarOpacity(0);};
00174       
00176 
00181   void SetScalarOpacityUnitDistance( int index, double distance );
00182   void SetScalarOpacityUnitDistance( double distance )
00183     {this->SetScalarOpacityUnitDistance( 0, distance );}
00184   double GetScalarOpacityUnitDistance( int index );
00185   double GetScalarOpacityUnitDistance()
00186     {return this->GetScalarOpacityUnitDistance(0);}
00188   
00189   
00191 
00193   void SetGradientOpacity( int index, vtkPiecewiseFunction *function );
00194   void SetGradientOpacity( vtkPiecewiseFunction *function )
00195     {this->SetGradientOpacity(0,function);}
00197   
00199 
00203   vtkPiecewiseFunction *GetGradientOpacity( int index );
00204   vtkPiecewiseFunction *GetGradientOpacity()
00205     {return this->GetGradientOpacity( 0 );}
00207 
00209 
00214   virtual void SetDisableGradientOpacity( int index, int value );
00215   virtual void SetDisableGradientOpacity( int value )
00216     { this->SetDisableGradientOpacity(0, value); }
00217   virtual void DisableGradientOpacityOn( int index )
00218     { this->SetDisableGradientOpacity(index, 1); }
00219   virtual void DisableGradientOpacityOn()
00220     { this->DisableGradientOpacityOn(0); }
00221   virtual void DisableGradientOpacityOff( int index )
00222     { this->SetDisableGradientOpacity(index, 0); }
00223   virtual void DisableGradientOpacityOff()
00224     { this->DisableGradientOpacityOff(0); }
00225   virtual int GetDisableGradientOpacity( int index );
00226   virtual int GetDisableGradientOpacity()
00227     { return this->GetDisableGradientOpacity(0); }
00228   vtkPiecewiseFunction *GetStoredGradientOpacity( int index );
00229   vtkPiecewiseFunction *GetStoredGradientOpacity()
00230     {return this->GetStoredGradientOpacity( 0 );}
00232 
00234 
00242   void SetShade( int index, int value );
00243   void SetShade( int value ) {this->SetShade(0,value);}
00244   int GetShade( int index );
00245   int GetShade() {return this->GetShade(0);}
00246   void ShadeOn( int index );
00247   void ShadeOn() {this->ShadeOn(0);}
00248   void ShadeOff( int index );
00249   void ShadeOff() {this->ShadeOff(0);}
00251 
00253 
00254   void SetAmbient( int index, double value );
00255   void SetAmbient( double value ) {this->SetAmbient( 0, value );}
00256   double GetAmbient( int index );
00257   double GetAmbient() {return this->GetAmbient(0);}
00259 
00261 
00262   void SetDiffuse( int index, double value );
00263   void SetDiffuse( double value ) {this->SetDiffuse( 0, value );}
00264   double GetDiffuse( int index );
00265   double GetDiffuse() {return this->GetDiffuse(0);}
00267 
00269 
00270   void SetSpecular( int index, double value );
00271   void SetSpecular( double value ) {this->SetSpecular( 0, value );}
00272   double GetSpecular( int index );
00273   double GetSpecular() {return this->GetSpecular(0);}
00275 
00277 
00278   void SetSpecularPower( int index, double value );
00279   void SetSpecularPower( double value ) {this->SetSpecularPower( 0, value );}
00280   double GetSpecularPower( int index );
00281   double GetSpecularPower() {return this->GetSpecularPower(0);}
00283 
00284   //BTX
00289   void UpdateMTimes(); 
00290 
00292 
00294   vtkTimeStamp GetGradientOpacityMTime( int index );
00295   vtkTimeStamp GetGradientOpacityMTime()
00296     { return this->GetGradientOpacityMTime(0); }  
00298       
00300 
00302   vtkTimeStamp GetScalarOpacityMTime( int index );
00303   vtkTimeStamp GetScalarOpacityMTime()
00304     { return this->GetScalarOpacityMTime(0); }  
00306 
00308 
00310   vtkTimeStamp GetRGBTransferFunctionMTime( int index );
00311   vtkTimeStamp GetRGBTransferFunctionMTime()
00312     { return this->GetRGBTransferFunctionMTime(0); }  
00314 
00316 
00318   vtkTimeStamp GetGrayTransferFunctionMTime( int index );
00319   vtkTimeStamp GetGrayTransferFunctionMTime()
00320     { return this->GetGrayTransferFunctionMTime(0); }  
00321   //ETX
00323 
00324 protected:
00325   vtkVolumeProperty();
00326   ~vtkVolumeProperty();
00327 
00328   int                           IndependentComponents;
00329   double                        ComponentWeight[VTK_MAX_VRCOMP];
00330 
00331   int                           InterpolationType;
00332 
00333   int                           ColorChannels[VTK_MAX_VRCOMP];
00334 
00335   vtkPiecewiseFunction          *GrayTransferFunction[VTK_MAX_VRCOMP];
00336   vtkTimeStamp                  GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
00337 
00338   vtkColorTransferFunction      *RGBTransferFunction[VTK_MAX_VRCOMP];
00339   vtkTimeStamp                  RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
00340 
00341   vtkPiecewiseFunction          *ScalarOpacity[VTK_MAX_VRCOMP];
00342   vtkTimeStamp                  ScalarOpacityMTime[VTK_MAX_VRCOMP];
00343   double                        ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
00344   
00345   vtkPiecewiseFunction          *GradientOpacity[VTK_MAX_VRCOMP];
00346   vtkTimeStamp                  GradientOpacityMTime[VTK_MAX_VRCOMP];
00347   vtkPiecewiseFunction          *DefaultGradientOpacity[VTK_MAX_VRCOMP];
00348   int                           DisableGradientOpacity[VTK_MAX_VRCOMP];
00349 
00350   int                           Shade[VTK_MAX_VRCOMP];
00351   double                        Ambient[VTK_MAX_VRCOMP];
00352   double                        Diffuse[VTK_MAX_VRCOMP];
00353   double                        Specular[VTK_MAX_VRCOMP];
00354   double                        SpecularPower[VTK_MAX_VRCOMP];
00355 
00356   virtual void                  CreateDefaultGradientOpacity(int index);
00357 
00358 private:
00359   vtkVolumeProperty(const vtkVolumeProperty&);  // Not implemented.
00360   void operator=(const vtkVolumeProperty&);  // Not implemented.
00361 };
00362 
00364 inline const char *vtkVolumeProperty::GetInterpolationTypeAsString(void)
00365 {
00366   if( this->InterpolationType == VTK_NEAREST_INTERPOLATION )
00367     {
00368     return "Nearest Neighbor";
00369     }
00370   else if( this->InterpolationType == VTK_LINEAR_INTERPOLATION )
00371     {
00372     return "Linear";
00373     }
00374   else
00375     {
00376     return "Unknown";
00377     }
00378 }
00379 
00380 #endif