Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkVolume.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolume.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00051 #ifndef __vtkVolume_h
00052 #define __vtkVolume_h
00053 
00054 #include "vtkProp3D.h"
00055 
00056 class vtkRenderer;
00057 class vtkPropCollection;
00058 class vtkVolumeCollection;
00059 class vtkWindow;
00060 class vtkVolumeProperty;
00061 class vtkVolumeMapper;
00062 
00063 class VTK_RENDERING_EXPORT vtkVolume : public vtkProp3D
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkVolume,vtkProp3D);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00072   static vtkVolume *New();
00073 
00075 
00076   void SetMapper(vtkVolumeMapper *mapper);
00077   vtkGetObjectMacro(Mapper, vtkVolumeMapper);
00079 
00081 
00082   void SetProperty(vtkVolumeProperty *property);
00083   vtkVolumeProperty *GetProperty();
00085 
00089   void GetVolumes(vtkPropCollection *vc);
00090 
00092   void Update();
00093 
00095 
00097   float *GetBounds();
00098   void GetBounds(float bounds[6]) { this->vtkProp3D::GetBounds( bounds ); };
00099   float GetMinXBound();
00100   float GetMaxXBound();
00101   float GetMinYBound();
00102   float GetMaxYBound();
00103   float GetMinZBound();
00104   float GetMaxZBound();
00106 
00108   unsigned long int GetMTime();
00109 
00114   unsigned long GetRedrawMTime();
00115 
00117   void ShallowCopy(vtkProp *prop);
00118 
00119 //BTX
00125   int RenderTranslucentGeometry(vtkViewport *viewport);
00126 
00131   void ReleaseGraphicsResources(vtkWindow *);
00132 
00134 
00136   float *GetCorrectedScalarOpacityArray(int);
00137   float *GetCorrectedScalarOpacityArray()
00138     {return this->GetCorrectedScalarOpacityArray(0);};
00140 
00142 
00144   float *GetScalarOpacityArray(int);
00145   float *GetScalarOpacityArray(){return this->GetScalarOpacityArray(0);};
00147 
00149 
00151   float *GetGradientOpacityArray(int);
00152   float *GetGradientOpacityArray(){return this->GetGradientOpacityArray(0);};
00154 
00156 
00158   float *GetGrayArray(int);
00159   float *GetGrayArray(){return this->GetGrayArray(0);};
00161 
00163 
00165   float *GetRGBArray(int);
00166   float *GetRGBArray(){return this->GetRGBArray(0);};
00168 
00170 
00172   float  GetGradientOpacityConstant(int);
00173   float  GetGradientOpacityConstant()
00174     {return this->GetGradientOpacityConstant(0);};
00176 
00179   float  GetArraySize () { return static_cast<float>(this->ArraySize); };
00180 
00183   void UpdateTransferFunctions( vtkRenderer *ren );
00184 
00186 
00188   void UpdateScalarOpacityforSampleSize( vtkRenderer *ren, 
00189                                          float sample_distance );
00191 
00192 //ETX
00193 
00194 protected:
00195   vtkVolume();
00196   ~vtkVolume();
00197 
00198   vtkVolumeMapper              *Mapper;
00199   vtkVolumeProperty            *Property;
00200 
00201   // The rgb transfer function array - for unsigned char data this
00202   // is 256 elements, for short or unsigned short it is 65536 elements
00203   // This is a sample at each scalar value of the rgb transfer
00204   // function.  A time stamp is kept to know when it needs rebuilding
00205   float                *RGBArray[VTK_MAX_VRCOMP];
00206   vtkTimeStamp          RGBArrayMTime[VTK_MAX_VRCOMP];
00207 
00208   // The gray transfer function array - for unsigned char data this
00209   // is 256 elements, for short or unsigned short it is 65536 elements
00210   // This is a sample at each scalar value of the gray transfer
00211   // function.  A time stamp is kept to know when it needs rebuilding
00212   float                *GrayArray[VTK_MAX_VRCOMP];
00213   vtkTimeStamp          GrayArrayMTime[VTK_MAX_VRCOMP];
00214 
00215   // The scalar opacity transfer function array - for unsigned char data this
00216   // is 256 elements, for short or unsigned short it is 65536 elements
00217   // This is a sample at each scalar value of the opacity transfer
00218   // function.  A time stamp is kept to know when it needs rebuilding
00219   float                *ScalarOpacityArray[VTK_MAX_VRCOMP];
00220   vtkTimeStamp          ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
00221 
00222   // The corrected scalar opacity transfer function array - this is identical
00223   // to the opacity transfer function array when the step size is 1.
00224   // In other cases, it is corrected to reflect the new material thickness
00225   // modeled by a step size different than 1.
00226   float                *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
00227   vtkTimeStamp          CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
00228 
00229   // CorrectedStepSize is the step size currently modeled by
00230   // CorrectedArray.  It is used to determine when the 
00231   // CorrectedArray needs to be updated to match SampleDistance
00232   // in the volume mapper.
00233   float                CorrectedStepSize;
00234 
00235   // Number of elements in the rgb, gray, and opacity transfer function arrays
00236   int                  ArraySize;
00237 
00238   // The magnitude of gradient opacity transfer function array
00239   float                GradientOpacityArray[VTK_MAX_VRCOMP][256];
00240   float                GradientOpacityConstant[VTK_MAX_VRCOMP];
00241   vtkTimeStamp         GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
00242 
00243   // Function to compute screen coverage of this volume
00244   float ComputeScreenCoverage( vtkViewport *vp );
00245   
00246 private:
00247   vtkVolume(const vtkVolume&);  // Not implemented.
00248   void operator=(const vtkVolume&);  // Not implemented.
00249 };
00250 
00251 #endif
00252