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 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 00158 00160 vtkIdType ComputeOffset(const int ext[6], const int wholeExt[6], 00161 int nComponents); 00163 00164 //BTX 00165 // This method helps debug. It writes out a specific component of the 00166 // computed min-max-volume structure 00167 //static void WriteMinMaxVolume( int component, unsigned short *minMaxVolume, 00168 // int minMaxVolumeSize[4], const char *filename ); 00169 //ETX 00170 00171 protected: 00172 vtkVolumeRayCastSpaceLeapingImageFilter(); 00173 ~vtkVolumeRayCastSpaceLeapingImageFilter(); 00174 00175 int IndependentComponents; 00176 vtkTimeStamp LastMinMaxBuildTime; 00177 vtkTimeStamp LastMinMaxFlagTime; 00178 vtkDataArray * CurrentScalars; 00179 float TableShift[4]; 00180 float TableScale[4]; 00181 int TableSize[4]; 00182 int ComputeGradientOpacity; 00183 int ComputeMinMax; 00184 int UpdateGradientOpacityFlags; 00185 unsigned short * MinNonZeroScalarIndex; 00186 unsigned char * MinNonZeroGradientMagnitudeIndex; 00187 unsigned char ** GradientMagnitude; 00188 unsigned short * ScalarOpacityTable[4]; 00189 unsigned short * GradientOpacityTable[4]; 00190 vtkImageData * Cache; 00191 00192 00193 void InternalRequestUpdateExtent(int *, int*); 00194 00196 00197 virtual int RequestUpdateExtent(vtkInformation *, 00198 vtkInformationVector **, 00199 vtkInformationVector *); 00200 void ThreadedRequestData( vtkInformation *request, 00201 vtkInformationVector **inputVector, 00202 vtkInformationVector *outputVector, 00203 vtkImageData ***inData, 00204 vtkImageData **outData, 00205 int outExt[6], int id); 00206 virtual int RequestData( vtkInformation* request, 00207 vtkInformationVector** inputVector, 00208 vtkInformationVector* outputVector); 00209 virtual int RequestInformation( vtkInformation *, 00210 vtkInformationVector**, 00211 vtkInformationVector *); 00213 00217 void ComputeFirstNonZeroOpacityIndices(); 00218 00220 00223 void FillScalarOpacityFlags( 00224 vtkImageData *minMaxVolume, int outExt[6] ); 00226 00228 00231 void FillScalarAndGradientOpacityFlags( 00232 vtkImageData *minMaxVolume, int outExt[6] ); 00234 00236 00239 virtual void AllocateOutputData( vtkImageData *out, int *uExtent ); 00240 virtual vtkImageData *AllocateOutputData(vtkDataObject *out); 00242 00243 private: 00244 vtkVolumeRayCastSpaceLeapingImageFilter(const vtkVolumeRayCastSpaceLeapingImageFilter&); // Not implemented. 00245 void operator=(const vtkVolumeRayCastSpaceLeapingImageFilter&); // Not implemented. 00246 }; 00247 00248 #endif