/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: VTKMeshPipeline.h,v $ Language: C++ Date: $Date: 2005/10/29 14:00:14 $ Version: $Revision: 1.6 $ Copyright (c) 2003 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __VTKMeshPipeline_h_ #define __VTKMeshPipeline_h_ #include "SNAPCommon.h" #include "MeshOptions.h" #include "AllPurposeProgressAccumulator.h" // ITK includes (this file is not widely included in SNAP, so it's OK // to include a bunch of headers here). #include #include // VTK includes #include #include #include #include #include #include #include #include #include #include #include // Optional selection of patented or non-patented algorithms #ifdef USE_VTK_PATENTED #include #include #else #include #include #include #endif #ifndef vtkFloatingPointType # define vtkFloatingPointType vtkFloatingPointType typedef float vtkFloatingPointType; #endif class VTKProgressAccumulator; /** * \class VTKMeshPipeline * \brief A small pipeline used to convert an ITK image with a level set into * a VTK contour, with optional blurring */ class VTKMeshPipeline { public: /** Input image type */ typedef itk::Image ImageType; typedef itk::SmartPointer ImagePointer; /** Set the input segmentation image */ void SetImage(ImageType *input); /** Set the mesh options for this filter */ void SetMeshOptions(const MeshOptions &options); /** Compute a mesh for a particular color label. Returns true if * the color label is not present in the image */ void ComputeMesh(vtkPolyData *outData); /** Get the progress accumulator */ AllPurposeProgressAccumulator *GetProgressAccumulator() { return m_Progress; } /** Constructor, which builds the pipeline */ VTKMeshPipeline(); /** Deallocate the pipeline filters */ ~VTKMeshPipeline(); private: // VTK-ITK Connection typedefs typedef itk::VTKImageExport VTKExportType; typedef itk::SmartPointer VTKExportPointer; // Current set of mesh options MeshOptions m_MeshOptions; // The input image ImagePointer m_InputImage; // The VTK exporter for the data VTKExportPointer m_VTKExporter; // The VTK importer for the data vtkImageImport *m_VTKImporter; // VTK Gaussian (because we care about the speed and not so much about // precision) vtkImageGaussianSmooth *m_VTKGaussianFilter; // The polygon smoothing filter vtkSmoothPolyDataFilter *m_PolygonSmoothingFilter; // Triangle stripper vtkStripper *m_StripperFilter; #ifdef USE_VTK_PATENTED // Marching cubes filter vtkImageMarchingCubes * m_MarchingCubesFilter; // The triangle decimation driver vtkDecimate * m_DecimateFilter; #else // USE_VTK_PATENTED // The contour filter vtkContourFilter * m_ContourFilter; // A filter that computes normals vtkPolyDataNormals * m_NormalsFilter; // The triangle decimation driver vtkDecimatePro * m_DecimateProFilter; #endif // USE_VTK_PATENTED // Progress event monitor AllPurposeProgressAccumulator::Pointer m_Progress; }; #endif // __VTKMeshPipeline_h_