VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVolume.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 =========================================================================*/ 00036 #ifndef __vtkVolume_h 00037 #define __vtkVolume_h 00038 00039 #include "vtkRenderingCoreModule.h" // For export macro 00040 #include "vtkProp3D.h" 00041 00042 class vtkRenderer; 00043 class vtkPropCollection; 00044 class vtkVolumeCollection; 00045 class vtkWindow; 00046 class vtkVolumeProperty; 00047 class vtkAbstractVolumeMapper; 00048 00049 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D 00050 { 00051 public: 00052 vtkTypeMacro(vtkVolume, vtkProp3D); 00053 void PrintSelf(ostream& os, vtkIndent indent); 00054 00058 static vtkVolume *New(); 00059 00061 00062 void SetMapper(vtkAbstractVolumeMapper *mapper); 00063 vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper); 00065 00067 00068 void SetProperty(vtkVolumeProperty *property); 00069 vtkVolumeProperty *GetProperty(); 00071 00075 void GetVolumes(vtkPropCollection *vc); 00076 00078 void Update(); 00079 00081 00083 double *GetBounds(); 00084 void GetBounds(double bounds[6]) 00085 { this->vtkProp3D::GetBounds(bounds); } 00086 double GetMinXBound(); 00087 double GetMaxXBound(); 00088 double GetMinYBound(); 00089 double GetMaxYBound(); 00090 double GetMinZBound(); 00091 double GetMaxZBound(); 00093 00095 unsigned long int GetMTime(); 00096 00101 unsigned long GetRedrawMTime(); 00102 00104 void ShallowCopy(vtkProp *prop); 00105 00106 //BTX 00112 int RenderVolumetricGeometry(vtkViewport *viewport); 00113 00118 void ReleaseGraphicsResources(vtkWindow *); 00119 00121 00123 float *GetCorrectedScalarOpacityArray(int); 00124 float *GetCorrectedScalarOpacityArray() 00125 { return this->GetCorrectedScalarOpacityArray(0); } 00127 00129 00131 float *GetScalarOpacityArray(int); 00132 float *GetScalarOpacityArray() 00133 { return this->GetScalarOpacityArray(0); } 00135 00137 00139 float *GetGradientOpacityArray(int); 00140 float *GetGradientOpacityArray() 00141 { return this->GetGradientOpacityArray(0); } 00143 00145 00147 float *GetGrayArray(int); 00148 float *GetGrayArray() 00149 { return this->GetGrayArray(0); } 00151 00153 00155 float *GetRGBArray(int); 00156 float *GetRGBArray() 00157 { return this->GetRGBArray(0); } 00159 00161 00163 float GetGradientOpacityConstant(int); 00164 float GetGradientOpacityConstant() 00165 { return this->GetGradientOpacityConstant(0); } 00167 00169 00171 float GetArraySize() 00172 { return static_cast<float>(this->ArraySize); } 00174 00177 void UpdateTransferFunctions(vtkRenderer *ren); 00178 00180 00182 void UpdateScalarOpacityforSampleSize(vtkRenderer *ren, 00183 float sample_distance); 00185 00186 //ETX 00187 00188 protected: 00189 vtkVolume(); 00190 ~vtkVolume(); 00191 00192 vtkAbstractVolumeMapper *Mapper; 00193 vtkVolumeProperty *Property; 00194 00195 // The rgb transfer function array - for unsigned char data this 00196 // is 256 elements, for short or unsigned short it is 65536 elements 00197 // This is a sample at each scalar value of the rgb transfer 00198 // function. A time stamp is kept to know when it needs rebuilding 00199 float *RGBArray[VTK_MAX_VRCOMP]; 00200 vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP]; 00201 00202 // The gray transfer function array - for unsigned char data this 00203 // is 256 elements, for short or unsigned short it is 65536 elements 00204 // This is a sample at each scalar value of the gray transfer 00205 // function. A time stamp is kept to know when it needs rebuilding 00206 float *GrayArray[VTK_MAX_VRCOMP]; 00207 vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP]; 00208 00209 // The scalar opacity transfer function array - for unsigned char data this 00210 // is 256 elements, for short or unsigned short it is 65536 elements 00211 // This is a sample at each scalar value of the opacity transfer 00212 // function. A time stamp is kept to know when it needs rebuilding 00213 float *ScalarOpacityArray[VTK_MAX_VRCOMP]; 00214 vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP]; 00215 00216 // The corrected scalar opacity transfer function array - this is identical 00217 // to the opacity transfer function array when the step size is 1. 00218 // In other cases, it is corrected to reflect the new material thickness 00219 // modelled by a step size different than 1. 00220 float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP]; 00221 vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP]; 00222 00223 // CorrectedStepSize is the step size currently modelled by 00224 // CorrectedArray. It is used to determine when the 00225 // CorrectedArray needs to be updated to match SampleDistance 00226 // in the volume mapper. 00227 float CorrectedStepSize; 00228 00229 // Number of elements in the rgb, gray, and opacity transfer function arrays 00230 int ArraySize; 00231 00232 // The magnitude of gradient opacity transfer function array 00233 float GradientOpacityArray[VTK_MAX_VRCOMP][256]; 00234 float GradientOpacityConstant[VTK_MAX_VRCOMP]; 00235 vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP]; 00236 00237 // Function to compute screen coverage of this volume 00238 double ComputeScreenCoverage(vtkViewport *vp); 00239 00240 private: 00241 vtkVolume(const vtkVolume&); // Not implemented. 00242 void operator=(const vtkVolume&); // Not implemented. 00243 }; 00244 00245 #endif