VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAMRVolumeMapper.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 =========================================================================*/ 00025 #ifndef __vtkAMRVolumeMapper_h 00026 #define __vtkAMRVolumeMapper_h 00027 00028 #include "vtkRenderingVolumeAMRModule.h" // For export macro 00029 #include "vtkVolumeMapper.h" 00030 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC 00031 00032 class vtkAMRResampleFilter; 00033 class vtkCamera; 00034 class vtkImageData; 00035 class vtkOverlappingAMR; 00036 class vtkSmartVolumeMapper; 00037 class vtkUniformGrid; 00038 00039 class VTKRENDERINGVOLUMEAMR_EXPORT vtkAMRVolumeMapper : public vtkVolumeMapper 00040 { 00041 public: 00042 static vtkAMRVolumeMapper *New(); 00043 vtkTypeMacro(vtkAMRVolumeMapper,vtkVolumeMapper); 00044 void PrintSelf( ostream& os, vtkIndent indent ); 00045 00047 00048 virtual void SetInputData( vtkImageData* ); 00049 virtual void SetInputData( vtkDataSet* ); 00050 virtual void SetInputData( vtkOverlappingAMR* ); 00051 virtual void SetInputConnection (int port, vtkAlgorithmOutput *input); 00052 virtual void SetInputConnection (vtkAlgorithmOutput *input) 00053 {this->SetInputConnection(0, input);} 00055 00057 00059 virtual double *GetBounds(); 00060 virtual void GetBounds(double bounds[6]) 00061 {this->vtkVolumeMapper::GetBounds(bounds); }; 00063 00073 virtual void SetScalarMode(int mode); 00074 00076 00082 virtual void SetBlendMode(int mode); 00083 virtual int GetBlendMode(); 00085 00087 00091 virtual void SelectScalarArray(int arrayNum); 00092 virtual void SelectScalarArray(const char* arrayName); 00094 00096 00097 virtual char* GetArrayName(); 00098 virtual int GetArrayId(); 00099 virtual int GetArrayAccessMode(); 00101 00103 const char *GetScalarModeAsString(); 00105 00107 virtual void SetCropping(int mode); 00108 virtual int GetCropping(); 00110 00112 00115 virtual void SetCroppingRegionPlanes(double arg1, double arg2, double arg3, 00116 double arg4, double arg5, double arg6); 00117 virtual void SetCroppingRegionPlanes(double *planes) 00118 {this->SetCroppingRegionPlanes( 00119 planes[0],planes[1],planes[2], 00120 planes[3],planes[4],planes[5]);} 00121 virtual void GetCroppingRegionPlanes(double *planes); 00122 virtual double *GetCroppingRegionPlanes(); 00124 00125 00134 virtual void SetCroppingRegionFlags(int mode); 00135 virtual int GetCroppingRegionFlags(); 00137 00138 //BTX 00139 // The possible values for the default and current render mode ivars 00140 enum 00141 { 00142 DefaultRenderMode=0, 00143 RayCastAndTextureRenderMode, 00144 RayCastRenderMode, 00145 TextureRenderMode, 00146 GPURenderMode, 00147 UndefinedRenderMode, 00148 InvalidRenderMode 00149 }; 00150 //ETX 00151 00153 00155 void SetRequestedRenderMode(int mode); 00156 int GetRequestedRenderMode(); 00158 00160 00164 void SetRequestedRenderModeToDefault() 00165 {this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);} 00167 00169 00174 void SetRequestedRenderModeToRayCastAndTexture() 00175 {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);} 00177 00179 00183 void SetRequestedRenderModeToRayCast() 00184 {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);} 00186 00188 00192 void SetRequestedRenderModeToTexture() 00193 {this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);} 00195 00197 00199 void SetRequestedRenderModeToGPU() 00200 {this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);} 00202 00204 00206 void SetInterpolationMode(int mode); 00207 int GetInterpolationMode(); 00209 00210 void SetInterpolationModeToNearestNeighbor() 00211 {this->SetInterpolationMode(VTK_RESLICE_NEAREST);} 00212 00213 void SetInterpolationModeToLinear() 00214 {this->SetInterpolationMode(VTK_RESLICE_LINEAR);} 00215 00216 void SetInterpolationModeToCubic() 00217 {this->SetInterpolationMode(VTK_RESLICE_CUBIC);} 00218 00220 00222 vtkSetVector3Macro(NumberOfSamples,int); 00223 vtkGetVector3Macro(NumberOfSamples,int); 00225 00231 virtual void SetInteractiveUpdateRate(double rate); 00232 00235 virtual double GetInteractiveUpdateRate(); 00236 00237 //BTX 00240 virtual void Render(vtkRenderer *ren, vtkVolume *vol); 00241 00246 virtual void ReleaseGraphicsResources(vtkWindow *); 00247 00248 void ProcessUpdateExtentRequest(vtkRenderer *renderer, vtkInformation*info, 00249 vtkInformationVector **inputVector, 00250 vtkInformationVector *outputVector); 00251 void ProcessInformationRequest(vtkRenderer *renderer, vtkInformation*info, 00252 vtkInformationVector **inputVector, 00253 vtkInformationVector *outputVector); 00254 void UpdateResampler(vtkRenderer *ren, vtkOverlappingAMR *amr); 00255 void UpdateResamplerFrustrumMethod(vtkRenderer *ren, vtkOverlappingAMR *amr); 00256 //ETX 00257 00259 00260 vtkSetMacro(RequestedResamplingMode, int); 00261 vtkGetMacro(RequestedResamplingMode, int); 00262 vtkSetMacro(FreezeFocalPoint, bool); 00263 vtkGetMacro(FreezeFocalPoint, bool); 00265 00267 00269 vtkSetMacro(ResamplerUpdateTolerance, double); 00270 vtkGetMacro(ResamplerUpdateTolerance, double); 00272 00274 00278 vtkSetMacro(UseDefaultThreading, bool); 00279 vtkGetMacro(UseDefaultThreading, bool); 00281 00283 00285 static bool ComputeResamplerBoundsFrustumMethod( 00286 vtkCamera* camera, vtkRenderer* renderer, 00287 const double data_bounds[6], double out_bounds[6]); 00288 protected: 00289 vtkAMRVolumeMapper(); 00290 ~vtkAMRVolumeMapper(); 00292 00293 // see algorithm for more info 00294 virtual int FillInputPortInformation(int port, vtkInformation* info); 00295 void UpdateGrid(); 00296 00297 vtkSmartVolumeMapper *InternalMapper; 00298 vtkAMRResampleFilter *Resampler; 00299 vtkUniformGrid *Grid; 00300 int NumberOfSamples[3]; 00301 double Bounds[6]; 00302 // This indicates that the input has meta data for 00303 // doing demand driven operations. 00304 bool HasMetaData; 00305 int RequestedResamplingMode; 00306 bool FreezeFocalPoint; 00307 // Cached values for camera focal point and 00308 // the distance between the camera position and 00309 // focal point 00310 double LastFocalPointPosition[3]; 00311 double LastPostionFPDistance; 00312 // This is used when determing if 00313 // either the camera or focal point has 00314 // move enough to cause the resampler to update 00315 double ResamplerUpdateTolerance; 00316 bool GridNeedsToBeUpdated; 00317 bool UseDefaultThreading; 00318 00319 private: 00320 vtkAMRVolumeMapper(const vtkAMRVolumeMapper&); // Not implemented. 00321 void operator=(const vtkAMRVolumeMapper&); // Not implemented. 00322 }; 00323 00324 00325 #endif