1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkVoxelContoursToSurfaceFilter.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 // .NAME vtkVoxelContoursToSurfaceFilter - create surface from contours 16 // .SECTION Description 17 // vtkVoxelContoursToSurfaceFilter is a filter that takes contours and 18 // produces surfaces. There are some restrictions for the contours: 19 // 20 // - The contours are input as vtkPolyData, with the contours being 21 // polys in the vtkPolyData. 22 // - The contours lie on XY planes - each contour has a constant Z 23 // - The contours are ordered in the polys of the vtkPolyData such 24 // that all contours on the first (lowest) XY plane are first, then 25 // continuing in order of increasing Z value. 26 // - The X, Y and Z coordinates are all integer values. 27 // - The desired sampling of the contour data is 1x1x1 - Aspect can 28 // be used to control the aspect ratio in the output polygonal 29 // dataset. 30 // 31 // This filter takes the contours and produces a structured points 32 // dataset of signed floating point number indicating distance from 33 // a contour. A contouring filter is then applied to generate 3D 34 // surfaces from a stack of 2D contour distance slices. This is 35 // done in a streaming fashion so as not to use to much memory. 36 37 // .SECTION See Also 38 // vtkPolyDataAlgorithm 39 40 #ifndef vtkVoxelContoursToSurfaceFilter_h 41 #define vtkVoxelContoursToSurfaceFilter_h 42 43 #include "vtkFiltersGeneralModule.h" // For export macro 44 #include "vtkPolyDataAlgorithm.h" 45 46 class VTKFILTERSGENERAL_EXPORT vtkVoxelContoursToSurfaceFilter : public vtkPolyDataAlgorithm 47 { 48 public: 49 static vtkVoxelContoursToSurfaceFilter *New(); 50 vtkTypeMacro(vtkVoxelContoursToSurfaceFilter,vtkPolyDataAlgorithm); 51 void PrintSelf(ostream& os, vtkIndent indent); 52 53 // Description: 54 // Set / Get the memory limit in bytes for this filter. This is the limit 55 // of the size of the structured points data set that is created for 56 // intermediate processing. The data will be streamed through this volume 57 // in as many pieces as necessary. 58 vtkSetMacro( MemoryLimitInBytes, int ); 59 vtkGetMacro( MemoryLimitInBytes, int ); 60 61 vtkSetVector3Macro( Spacing, double ); 62 vtkGetVectorMacro( Spacing, double, 3 ); 63 64 protected: 65 vtkVoxelContoursToSurfaceFilter(); 66 ~vtkVoxelContoursToSurfaceFilter(); 67 68 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 69 70 int MemoryLimitInBytes; 71 72 double Spacing[3]; 73 74 double *LineList; 75 int LineListLength; 76 int LineListSize; 77 78 double *SortedXList; 79 double *SortedYList; 80 int SortedListSize; 81 82 int *WorkingList; 83 int WorkingListLength; 84 85 double *IntersectionList; 86 int IntersectionListLength; 87 88 void AddLineToLineList( double x1, double y1, double x2, double y2 ); 89 void SortLineList(); 90 91 void CastLines( float *slice, double gridOrigin[3], 92 int gridSize[3], int type ); 93 94 void PushDistances( float *ptr, int gridSize[3], int chunkSize ); 95 private: 96 vtkVoxelContoursToSurfaceFilter(const vtkVoxelContoursToSurfaceFilter&); // Not implemented. 97 void operator=(const vtkVoxelContoursToSurfaceFilter&); // Not implemented. 98 }; 99 100 #endif 101