1 /*========================================================================= 2 * 3 * Copyright Insight Software Consortium 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0.txt 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *=========================================================================*/ 18 #ifndef itkImageToMeshFilter_h 19 #define itkImageToMeshFilter_h 20 21 #include "itkMeshSource.h" 22 23 namespace itk 24 { 25 /** \class ImageToMeshFilter 26 * \brief 27 * 28 * ImageToMeshFilter is the base class for all process objects that output 29 * Mesh data and require image data as input. Specifically, this class 30 * defines the SetInput() method for defining the input to a filter. 31 * 32 * \ingroup ImageFilters 33 * \ingroup ITKMesh 34 */ 35 template< typename TInputImage, typename TOutputMesh > 36 class ITK_TEMPLATE_EXPORT ImageToMeshFilter:public MeshSource< TOutputMesh > 37 { 38 public: 39 ITK_DISALLOW_COPY_AND_ASSIGN(ImageToMeshFilter); 40 41 /** Standard class type aliases. */ 42 using Self = ImageToMeshFilter; 43 using Superclass = MeshSource< TOutputMesh >; 44 using Pointer = SmartPointer< Self >; 45 using ConstPointer = SmartPointer< const Self >; 46 47 /** Run-time type information (and related methods). */ 48 itkTypeMacro(ImageToMeshFilter, MeshSource); 49 50 /** Create a valid output. */ 51 using DataObjectPointerArraySizeType = ProcessObject::DataObjectPointerArraySizeType; 52 using Superclass::MakeOutput; 53 DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override; 54 55 /** Some Image related type alias. */ 56 using InputImageType = TInputImage; 57 using InputImagePointer = typename InputImageType::Pointer; 58 using InputImageConstPointer = typename InputImageType::ConstPointer; 59 using InputImageRegionType = typename InputImageType::RegionType; 60 using InputImagePixelType = typename InputImageType::PixelType; 61 62 /** Some Mesh related type alias. */ 63 using OutputMeshType = TOutputMesh; 64 using OutputMeshPointer = typename OutputMeshType::Pointer; 65 66 /** Set the input image of this process object. */ 67 using Superclass::SetInput; 68 void SetInput(unsigned int idx, const InputImageType *input); SetInput(const InputImageType * input)69 void SetInput(const InputImageType *input) 70 { 71 this->SetInput(0, input); 72 } 73 74 /** Get the input image of this process object. */ 75 const InputImageType * GetInput(unsigned int idx); GetInput()76 const InputImageType * GetInput() 77 { 78 return this->GetInput(0); 79 } 80 81 /** Get the output Mesh of this process object. */ 82 OutputMeshType * GetOutput(); 83 84 /** Prepare the output */ 85 void GenerateOutputInformation() override; 86 87 protected: 88 ImageToMeshFilter(); 89 ~ImageToMeshFilter() override = default; 90 }; 91 } // end namespace itk 92 93 #ifndef ITK_MANUAL_INSTANTIATION 94 #include "itkImageToMeshFilter.hxx" 95 #endif 96 97 #endif 98