VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Core/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 "vtkRenderingCoreModule.h" // For export macro
00053 #include "vtkObject.h"
00054 
00055 class vtkPiecewiseFunction;
00056 class vtkTimeStamp;
00057 class vtkColorTransferFunction;
00058 
00059 class VTKRENDERINGCORE_EXPORT vtkVolumeProperty : public vtkObject
00060 {
00061 public:
00062   static vtkVolumeProperty *New();
00063   vtkTypeMacro(vtkVolumeProperty, vtkObject);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065   void DeepCopy(vtkVolumeProperty *p);
00066 
00069   unsigned long GetMTime();
00070 
00072 
00086   vtkSetClampMacro(IndependentComponents, int, 0, 1);
00087   vtkGetMacro(IndependentComponents, int);
00088   vtkBooleanMacro(IndependentComponents, int);
00090 
00092 
00094   vtkSetClampMacro(InterpolationType, int,
00095     VTK_NEAREST_INTERPOLATION, VTK_LINEAR_INTERPOLATION);
00096   vtkGetMacro(InterpolationType, int);
00097   void SetInterpolationTypeToNearest()
00098     { this->SetInterpolationType(VTK_NEAREST_INTERPOLATION); }
00099   void SetInterpolationTypeToLinear()
00100     { this->SetInterpolationType(VTK_LINEAR_INTERPOLATION); }
00101   const char *GetInterpolationTypeAsString(void);
00103 
00105 
00106   virtual void SetComponentWeight(int index, double value);
00107   virtual double GetComponentWeight(int index);
00109 
00111 
00114   void SetColor(int index, vtkPiecewiseFunction *function);
00115   void SetColor(vtkPiecewiseFunction *function)
00116     { this->SetColor(0, function); }
00118 
00120 
00123   void SetColor(int index, vtkColorTransferFunction *function);
00124   void SetColor(vtkColorTransferFunction *function)
00125     { this->SetColor(0, function); }
00127 
00129 
00131   int GetColorChannels(int index);
00132   int GetColorChannels()
00133     { return this->GetColorChannels(0); }
00135 
00137 
00139   vtkPiecewiseFunction *GetGrayTransferFunction(int index);
00140   vtkPiecewiseFunction *GetGrayTransferFunction()
00141     { return this->GetGrayTransferFunction(0); }
00143 
00145 
00148   vtkColorTransferFunction *GetRGBTransferFunction(int index);
00149   vtkColorTransferFunction *GetRGBTransferFunction()
00150     { return this->GetRGBTransferFunction(0); }
00152 
00154 
00156   void SetScalarOpacity(int index, vtkPiecewiseFunction *function);
00157   void SetScalarOpacity(vtkPiecewiseFunction *function)
00158     { this->SetScalarOpacity(0, function); }
00160 
00162 
00165   vtkPiecewiseFunction *GetScalarOpacity(int index);
00166   vtkPiecewiseFunction *GetScalarOpacity()
00167     { return this->GetScalarOpacity(0); }
00169 
00171 
00176   void SetScalarOpacityUnitDistance(int index, double distance);
00177   void SetScalarOpacityUnitDistance(double distance)
00178     { this->SetScalarOpacityUnitDistance(0, distance); }
00179   double GetScalarOpacityUnitDistance(int index);
00180   double GetScalarOpacityUnitDistance()
00181     { return this->GetScalarOpacityUnitDistance(0); }
00183 
00184 
00186 
00188   void SetGradientOpacity(int index, vtkPiecewiseFunction *function);
00189   void SetGradientOpacity(vtkPiecewiseFunction *function)
00190     { this->SetGradientOpacity(0, function); }
00192 
00194 
00198   vtkPiecewiseFunction *GetGradientOpacity(int index);
00199   vtkPiecewiseFunction *GetGradientOpacity()
00200     { return this->GetGradientOpacity(0); }
00202 
00204 
00209   virtual void SetDisableGradientOpacity(int index, int value);
00210   virtual void SetDisableGradientOpacity(int value)
00211     { this->SetDisableGradientOpacity(0, value); }
00212   virtual void DisableGradientOpacityOn(int index )
00213     { this->SetDisableGradientOpacity(index, 1); }
00214   virtual void DisableGradientOpacityOn()
00215     { this->DisableGradientOpacityOn(0); }
00216   virtual void DisableGradientOpacityOff(int index)
00217     { this->SetDisableGradientOpacity(index, 0); }
00218   virtual void DisableGradientOpacityOff()
00219     { this->DisableGradientOpacityOff(0); }
00220   virtual int GetDisableGradientOpacity(int index);
00221   virtual int GetDisableGradientOpacity()
00222     { return this->GetDisableGradientOpacity(0); }
00223   vtkPiecewiseFunction *GetStoredGradientOpacity(int index);
00224   vtkPiecewiseFunction *GetStoredGradientOpacity()
00225     { return this->GetStoredGradientOpacity(0); }
00227 
00229 
00234   bool HasGradientOpacity(int index=0) {
00235     return (this->GradientOpacity[index] != NULL);
00236   }
00238 
00240 
00248   void SetShade(int index, int value);
00249   void SetShade(int value)
00250     { this->SetShade(0,value); }
00251   int GetShade(int index);
00252   int GetShade()
00253     { return this->GetShade(0); }
00254   void ShadeOn(int index);
00255   void ShadeOn()
00256     { this->ShadeOn(0); }
00257   void ShadeOff(int index);
00258   void ShadeOff()
00259     { this->ShadeOff(0); }
00261 
00263 
00264   void SetAmbient(int index, double value);
00265   void SetAmbient(double value)
00266     { this->SetAmbient(0, value); }
00267   double GetAmbient(int index);
00268   double GetAmbient()
00269     { return this->GetAmbient(0); }
00271 
00273 
00274   void SetDiffuse(int index, double value);
00275   void SetDiffuse(double value)
00276     { this->SetDiffuse(0, value); }
00277   double GetDiffuse(int index);
00278   double GetDiffuse()
00279     { return this->GetDiffuse(0); }
00281 
00283 
00284   void SetSpecular(int index, double value);
00285   void SetSpecular(double value)
00286     { this->SetSpecular(0, value); }
00287   double GetSpecular(int index);
00288   double GetSpecular()
00289     { return this->GetSpecular(0); }
00291 
00293 
00294   void SetSpecularPower(int index, double value);
00295   void SetSpecularPower(double value)
00296     { this->SetSpecularPower(0, value); }
00297   double GetSpecularPower(int index);
00298   double GetSpecularPower()
00299     { return this->GetSpecularPower(0); }
00301 
00302   //BTX
00307   void UpdateMTimes();
00308 
00310 
00312   vtkTimeStamp GetGradientOpacityMTime(int index);
00313   vtkTimeStamp GetGradientOpacityMTime()
00314     { return this->GetGradientOpacityMTime(0); }
00316 
00318 
00320   vtkTimeStamp GetScalarOpacityMTime(int index);
00321   vtkTimeStamp GetScalarOpacityMTime()
00322     { return this->GetScalarOpacityMTime(0); }
00324 
00326 
00328   vtkTimeStamp GetRGBTransferFunctionMTime(int index);
00329   vtkTimeStamp GetRGBTransferFunctionMTime()
00330     { return this->GetRGBTransferFunctionMTime(0); }
00332 
00334 
00336   vtkTimeStamp GetGrayTransferFunctionMTime(int index);
00337   vtkTimeStamp GetGrayTransferFunctionMTime()
00338     { return this->GetGrayTransferFunctionMTime(0); }
00339   //ETX
00341 
00342 protected:
00343   vtkVolumeProperty();
00344   ~vtkVolumeProperty();
00345 
00346   int IndependentComponents;
00347   double ComponentWeight[VTK_MAX_VRCOMP];
00348 
00349   int InterpolationType;
00350 
00351   int ColorChannels[VTK_MAX_VRCOMP];
00352 
00353   vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP];
00354   vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
00355 
00356   vtkColorTransferFunction *RGBTransferFunction[VTK_MAX_VRCOMP];
00357   vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
00358 
00359   vtkPiecewiseFunction *ScalarOpacity[VTK_MAX_VRCOMP];
00360   vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP];
00361   double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
00362 
00363   vtkPiecewiseFunction *GradientOpacity[VTK_MAX_VRCOMP];
00364   vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP];
00365   vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP];
00366   int DisableGradientOpacity[VTK_MAX_VRCOMP];
00367 
00368   int Shade[VTK_MAX_VRCOMP];
00369   double Ambient[VTK_MAX_VRCOMP];
00370   double Diffuse[VTK_MAX_VRCOMP];
00371   double Specular[VTK_MAX_VRCOMP];
00372   double SpecularPower[VTK_MAX_VRCOMP];
00373 
00374   virtual void CreateDefaultGradientOpacity(int index);
00375 
00376 private:
00377   vtkVolumeProperty(const vtkVolumeProperty&);  // Not implemented.
00378   void operator=(const vtkVolumeProperty&);  // Not implemented.
00379 };
00380 
00382 
00383 inline const char *vtkVolumeProperty::GetInterpolationTypeAsString(void)
00384 {
00385   if (this->InterpolationType == VTK_NEAREST_INTERPOLATION)
00386     {
00387     return "Nearest Neighbor";
00388     }
00389   if (this->InterpolationType == VTK_LINEAR_INTERPOLATION)
00390     {
00391     return "Linear";
00392     }
00393   return "Unknown";
00394 }
00396 
00397 #endif