1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkImageStencilSource.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 =========================================================================*/ 15 /** 16 * @class vtkImageStencilSource 17 * @brief generate an image stencil 18 * 19 * vtkImageStencilSource is a superclass for filters that generate image 20 * stencils. Given a clipping object such as a vtkImplicitFunction, it 21 * will set up a list of clipping extents for each x-row through the 22 * image data. The extents for each x-row can be retrieved via the 23 * GetNextExtent() method after the extent lists have been built 24 * with the BuildExtents() method. For large images, using clipping 25 * extents is much more memory efficient (and slightly more time-efficient) 26 * than building a mask. This class can be subclassed to allow clipping 27 * with objects other than vtkImplicitFunction. 28 * @sa 29 * vtkImplicitFunction vtkImageStencil vtkPolyDataToImageStencil 30 */ 31 32 #ifndef vtkImageStencilSource_h 33 #define vtkImageStencilSource_h 34 35 #include "vtkImageStencilAlgorithm.h" 36 #include "vtkImagingCoreModule.h" // For export macro 37 38 class vtkImageStencilData; 39 class vtkImageData; 40 41 class VTKIMAGINGCORE_EXPORT vtkImageStencilSource : public vtkImageStencilAlgorithm 42 { 43 public: 44 static vtkImageStencilSource* New(); 45 vtkTypeMacro(vtkImageStencilSource, vtkImageStencilAlgorithm); 46 47 void PrintSelf(ostream& os, vtkIndent indent) override; 48 49 ///@{ 50 /** 51 * Set a vtkImageData that has the Spacing, Origin, and 52 * WholeExtent that will be used for the stencil. This 53 * input should be set to the image that you wish to 54 * apply the stencil to. If you use this method, then 55 * any values set with the SetOutputSpacing, SetOutputOrigin, 56 * and SetOutputWholeExtent methods will be ignored. 57 */ 58 virtual void SetInformationInput(vtkImageData*); 59 vtkGetObjectMacro(InformationInput, vtkImageData); 60 ///@} 61 62 ///@{ 63 /** 64 * Set the Origin to be used for the stencil. It should be 65 * set to the Origin of the image you intend to apply the 66 * stencil to. The default value is (0,0,0). 67 */ 68 vtkSetVector3Macro(OutputOrigin, double); 69 vtkGetVector3Macro(OutputOrigin, double); 70 ///@} 71 72 ///@{ 73 /** 74 * Set the Spacing to be used for the stencil. It should be 75 * set to the Spacing of the image you intend to apply the 76 * stencil to. The default value is (1,1,1) 77 */ 78 vtkSetVector3Macro(OutputSpacing, double); 79 vtkGetVector3Macro(OutputSpacing, double); 80 ///@} 81 82 ///@{ 83 /** 84 * Set the whole extent for the stencil (anything outside 85 * this extent will be considered to be "outside" the stencil). 86 */ 87 vtkSetVector6Macro(OutputWholeExtent, int); 88 vtkGetVector6Macro(OutputWholeExtent, int); 89 ///@} 90 91 /** 92 * Report object referenced by instances of this class. 93 */ 94 void ReportReferences(vtkGarbageCollector*) override; 95 96 protected: 97 vtkImageStencilSource(); 98 ~vtkImageStencilSource() override; 99 100 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; 101 102 vtkImageData* InformationInput; 103 104 int OutputWholeExtent[6]; 105 double OutputOrigin[3]; 106 double OutputSpacing[3]; 107 108 private: 109 vtkImageStencilSource(const vtkImageStencilSource&) = delete; 110 void operator=(const vtkImageStencilSource&) = delete; 111 }; 112 113 #endif 114