VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkFixedPointVolumeRayCastMapper.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 =========================================================================*/ 00031 #ifndef __vtkVolumeRayCastSpaceLeapingImageFilter_h 00032 #define __vtkVolumeRayCastSpaceLeapingImageFilter_h 00033 00034 #include "vtkThreadedImageAlgorithm.h" 00035 00036 class vtkDataArray; 00037 00038 class VTK_VOLUMERENDERING_EXPORT vtkVolumeRayCastSpaceLeapingImageFilter : public vtkThreadedImageAlgorithm 00039 { 00040 public: 00041 vtkTypeMacro(vtkVolumeRayCastSpaceLeapingImageFilter,vtkThreadedImageAlgorithm); 00042 void PrintSelf(ostream& os, vtkIndent indent); 00043 00044 static vtkVolumeRayCastSpaceLeapingImageFilter *New(); 00045 00047 00048 virtual void SetCurrentScalars( vtkDataArray * ); 00049 vtkGetObjectMacro( CurrentScalars, vtkDataArray ); 00051 00053 00054 vtkSetMacro( IndependentComponents, int ); 00055 vtkGetMacro( IndependentComponents, int ); 00057 00059 00060 vtkSetMacro( ComputeGradientOpacity, int ); 00061 vtkGetMacro( ComputeGradientOpacity, int ); 00062 vtkBooleanMacro( ComputeGradientOpacity, int ); 00064 00066 00067 vtkSetMacro( ComputeMinMax, int ); 00068 vtkGetMacro( ComputeMinMax, int ); 00069 vtkBooleanMacro( ComputeMinMax, int ); 00071 00073 00075 vtkSetMacro( UpdateGradientOpacityFlags, int ); 00076 vtkGetMacro( UpdateGradientOpacityFlags, int ); 00077 vtkBooleanMacro( UpdateGradientOpacityFlags, int ); 00079 00081 00083 unsigned long GetLastMinMaxBuildTime() 00084 { return LastMinMaxBuildTime.GetMTime(); } 00086 00088 00090 unsigned long GetLastMinMaxFlagTime() 00091 { return LastMinMaxFlagTime.GetMTime(); } 00093 00095 00101 vtkSetVector4Macro( TableShift, float ); 00102 vtkGetVector4Macro( TableShift, float ); 00103 vtkSetVector4Macro( TableScale, float ); 00104 vtkGetVector4Macro( TableScale, float ); 00105 vtkSetVector4Macro( TableSize, int ); 00106 vtkGetVector4Macro( TableSize, int ); 00108 00111 int GetNumberOfIndependentComponents(); 00112 00119 unsigned short * GetMinMaxVolume( int dims[4] ); 00120 00123 virtual void SetCache(vtkImageData * imageCache); 00124 00126 00129 static void ComputeInputExtentsForOutput( int inExt[6], 00130 unsigned int inDim[3], int outExt[6], vtkImageData *inData ); 00132 00134 00136 unsigned short * GetMinNonZeroScalarIndex(); 00137 unsigned char * GetMinNonZeroGradientMagnitudeIndex(); 00139 00140 //BTX 00142 00145 void SetGradientMagnitude( unsigned char ** gradientMagnitude ); 00146 unsigned char **GetGradientMagnitude(); 00148 00150 00152 void SetScalarOpacityTable( int c, unsigned short * t); 00153 void SetGradientOpacityTable( int c, unsigned short * t ); 00154 //ETX 00156 00159 unsigned long ComputeOffset(int ext[6], int wholeExt[6], int nComponents); 00160 00161 //BTX 00162 // This method helps debug. It writes out a specific component of the 00163 // computed min-max-volume structure 00164 //static void WriteMinMaxVolume( int component, unsigned short *minMaxVolume, 00165 // int minMaxVolumeSize[4], const char *filename ); 00166 //ETX 00167 00168 protected: 00169 vtkVolumeRayCastSpaceLeapingImageFilter(); 00170 ~vtkVolumeRayCastSpaceLeapingImageFilter(); 00171 00172 int IndependentComponents; 00173 vtkTimeStamp LastMinMaxBuildTime; 00174 vtkTimeStamp LastMinMaxFlagTime; 00175 vtkDataArray * CurrentScalars; 00176 float TableShift[4]; 00177 float TableScale[4]; 00178 int TableSize[4]; 00179 int ComputeGradientOpacity; 00180 int ComputeMinMax; 00181 int UpdateGradientOpacityFlags; 00182 unsigned short * MinNonZeroScalarIndex; 00183 unsigned char * MinNonZeroGradientMagnitudeIndex; 00184 unsigned char ** GradientMagnitude; 00185 unsigned short * ScalarOpacityTable[4]; 00186 unsigned short * GradientOpacityTable[4]; 00187 vtkImageData * Cache; 00188 00189 00190 void InternalRequestUpdateExtent(int *, int*); 00191 00193 00194 virtual int RequestUpdateExtent(vtkInformation *, 00195 vtkInformationVector **, 00196 vtkInformationVector *); 00197 void ThreadedRequestData( vtkInformation *request, 00198 vtkInformationVector **inputVector, 00199 vtkInformationVector *outputVector, 00200 vtkImageData ***inData, 00201 vtkImageData **outData, 00202 int outExt[6], int id); 00203 virtual int RequestData( vtkInformation* request, 00204 vtkInformationVector** inputVector, 00205 vtkInformationVector* outputVector); 00206 virtual int RequestInformation( vtkInformation *, 00207 vtkInformationVector**, 00208 vtkInformationVector *); 00210 00214 void ComputeFirstNonZeroOpacityIndices(); 00215 00217 00220 void FillScalarOpacityFlags( 00221 vtkImageData *minMaxVolume, int outExt[6] ); 00223 00225 00228 void FillScalarAndGradientOpacityFlags( 00229 vtkImageData *minMaxVolume, int outExt[6] ); 00231 00233 00236 virtual void AllocateOutputData( vtkImageData *out, int *uExtent ); 00237 virtual vtkImageData *AllocateOutputData(vtkDataObject *out); 00239 00240 private: 00241 vtkVolumeRayCastSpaceLeapingImageFilter(const vtkVolumeRayCastSpaceLeapingImageFilter&); // Not implemented. 00242 void operator=(const vtkVolumeRayCastSpaceLeapingImageFilter&); // Not implemented. 00243 }; 00244 00245 #endif