VTK  9.0.20201025
vtkVolumeRayCastSpaceLeapingImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFixedPointVolumeRayCastMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
32 #ifndef vtkVolumeRayCastSpaceLeapingImageFilter_h
33 #define vtkVolumeRayCastSpaceLeapingImageFilter_h
34 
35 #include "vtkRenderingVolumeModule.h" // For export macro
37 
38 class vtkDataArray;
39 
40 class VTKRENDERINGVOLUME_EXPORT vtkVolumeRayCastSpaceLeapingImageFilter
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
50 
53  virtual void SetCurrentScalars(vtkDataArray*);
54  vtkGetObjectMacro(CurrentScalars, vtkDataArray);
56 
58 
61  vtkSetMacro(IndependentComponents, int);
62  vtkGetMacro(IndependentComponents, int);
64 
66 
69  vtkSetMacro(ComputeGradientOpacity, vtkTypeBool);
70  vtkGetMacro(ComputeGradientOpacity, vtkTypeBool);
71  vtkBooleanMacro(ComputeGradientOpacity, vtkTypeBool);
73 
75 
78  vtkSetMacro(ComputeMinMax, vtkTypeBool);
79  vtkGetMacro(ComputeMinMax, vtkTypeBool);
80  vtkBooleanMacro(ComputeMinMax, vtkTypeBool);
82 
84 
88  vtkSetMacro(UpdateGradientOpacityFlags, vtkTypeBool);
89  vtkGetMacro(UpdateGradientOpacityFlags, vtkTypeBool);
90  vtkBooleanMacro(UpdateGradientOpacityFlags, vtkTypeBool);
92 
97  vtkMTimeType GetLastMinMaxBuildTime() { return LastMinMaxBuildTime.GetMTime(); }
98 
103  vtkMTimeType GetLastMinMaxFlagTime() { return LastMinMaxFlagTime.GetMTime(); }
104 
106 
114  vtkSetVector4Macro(TableShift, float);
115  vtkGetVector4Macro(TableShift, float);
116  vtkSetVector4Macro(TableScale, float);
117  vtkGetVector4Macro(TableScale, float);
118  vtkSetVector4Macro(TableSize, int);
119  vtkGetVector4Macro(TableSize, int);
121 
126  int GetNumberOfIndependentComponents();
127 
136  unsigned short* GetMinMaxVolume(int dims[4]);
137 
143  virtual void SetCache(vtkImageData* imageCache);
144 
150  static void ComputeInputExtentsForOutput(
151  int inExt[6], int inDim[3], int outExt[6], vtkImageData* inData);
152 
154 
159  unsigned short* GetMinNonZeroScalarIndex();
160  unsigned char* GetMinNonZeroGradientMagnitudeIndex();
162 
164 
169  void SetGradientMagnitude(unsigned char** gradientMagnitude);
170  unsigned char** GetGradientMagnitude();
172 
174 
178  void SetScalarOpacityTable(int c, unsigned short* t);
179  void SetGradientOpacityTable(int c, unsigned short* t);
181 
187  vtkIdType ComputeOffset(const int ext[6], const int wholeExt[6], int nComponents);
188 
189  // This method helps debug. It writes out a specific component of the
190  // computed min-max-volume structure
191  // static void WriteMinMaxVolume( int component, unsigned short *minMaxVolume,
192  // int minMaxVolumeSize[4], const char *filename );
193 
194 protected:
197 
202  float TableShift[4];
203  float TableScale[4];
204  int TableSize[4];
208  unsigned short* MinNonZeroScalarIndex;
210  unsigned char** GradientMagnitude;
211  unsigned short* ScalarOpacityTable[4];
212  unsigned short* GradientOpacityTable[4];
214 
215  void InternalRequestUpdateExtent(int*, int*);
216 
218 
222  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
223  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
224  int outExt[6], int id) override;
225  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
226  vtkInformationVector* outputVector) override;
229 
235  void ComputeFirstNonZeroOpacityIndices();
236 
241  void FillScalarOpacityFlags(vtkImageData* minMaxVolume, int outExt[6]);
242 
248  void FillScalarAndGradientOpacityFlags(vtkImageData* minMaxVolume, int outExt[6]);
249 
251 
256  void AllocateOutputData(vtkImageData* out, vtkInformation* outInfo, int* uExtent) override;
259 
260 private:
262  void operator=(const vtkVolumeRayCastSpaceLeapingImageFilter&) = delete;
263 };
264 
265 #endif
vtkThreadedImageAlgorithm::ThreadedRequestData
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up,...
vtkVolumeRayCastSpaceLeapingImageFilter::LastMinMaxBuildTime
vtkTimeStamp LastMinMaxBuildTime
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:199
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:38
vtkVolumeRayCastSpaceLeapingImageFilter::GradientMagnitude
unsigned char ** GradientMagnitude
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:210
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkVolumeRayCastSpaceLeapingImageFilter::MinNonZeroScalarIndex
unsigned short * MinNonZeroScalarIndex
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:208
vtkThreadedImageAlgorithm.h
vtkVolumeRayCastSpaceLeapingImageFilter::LastMinMaxFlagTime
vtkTimeStamp LastMinMaxFlagTime
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:200
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkThreadedImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageAlgorithm::AllocateOutputData
virtual void AllocateOutputData(vtkImageData *out, vtkInformation *outInfo, int *uExtent)
Allocate the output data.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkVolumeRayCastSpaceLeapingImageFilter
Builds the space leaping data structure.
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:40
vtkVolumeRayCastSpaceLeapingImageFilter::GetLastMinMaxFlagTime
vtkMTimeType GetLastMinMaxFlagTime()
Get the last execution time.
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:103
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkVolumeRayCastSpaceLeapingImageFilter::GetLastMinMaxBuildTime
vtkMTimeType GetLastMinMaxBuildTime()
Get the last execution time.
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:97
vtkVolumeRayCastSpaceLeapingImageFilter::ComputeGradientOpacity
vtkTypeBool ComputeGradientOpacity
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:205
vtkVolumeRayCastSpaceLeapingImageFilter::Cache
vtkImageData * Cache
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:213
vtkVolumeRayCastSpaceLeapingImageFilter::IndependentComponents
int IndependentComponents
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:198
vtkVolumeRayCastSpaceLeapingImageFilter::CurrentScalars
vtkDataArray * CurrentScalars
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:201
vtkVolumeRayCastSpaceLeapingImageFilter::MinNonZeroGradientMagnitudeIndex
unsigned char * MinNonZeroGradientMagnitudeIndex
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:209
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkVolumeRayCastSpaceLeapingImageFilter::UpdateGradientOpacityFlags
vtkTypeBool UpdateGradientOpacityFlags
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:207
vtkThreadedImageAlgorithm::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkVolumeRayCastSpaceLeapingImageFilter::ComputeMinMax
vtkTypeBool ComputeMinMax
Definition: vtkVolumeRayCastSpaceLeapingImageFilter.h:206
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:285