Shapeworks Studio  2.1
Shape analysis software suite
itkPSMCleanAndCenterLabelMapImageFilter.h
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 __itkPSMCleanAndCenterLabelMapImageFilter_h
19 #define __itkPSMCleanAndCenterLabelMapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
62 template< class TImage>
64  public ImageToImageFilter<TImage, TImage>
65 {
66 public:
69  typedef ImageToImageFilter< TImage, TImage > Superclass;
70  typedef SmartPointer< Self > Pointer;
71  typedef SmartPointer< const Self > ConstPointer;
72 
74  typedef TImage ImageType;
75  typedef typename ImageType::PixelType PixelType;
76  typedef typename ImageType::PointType PointType;
77  typedef typename ImageType::RegionType RegionType;
78  typedef typename RegionType::SizeType SizeType;
79  typedef typename RegionType::IndexType IndexType;
80 
82  itkNewMacro(Self);
83 
85  itkTypeMacro(PSMCleanAndCenterLabelMapImageFilter, ImageToImageFilter);
86 
88  itkStaticConstMacro(Dimension, unsigned int, TImage::ImageDimension);
89 
91  void GenerateData();
92 
97  itkSetMacro(ForegroundValue,PixelType);
98  itkGetMacro(ForegroundValue,PixelType);
99 
103  itkSetMacro(BackgroundValue,PixelType);
104  itkGetMacro(BackgroundValue,PixelType);
105 
106 protected:
109  void PrintSelf(std::ostream & os, Indent indent) const;
110 
114  void IsolateLargestComponent(ImageType *) const;
115 
117  void FillHoles(ImageType *) const;
118 
120  void ResampleToIsotropic(ImageType *) const
121  {
122  return;
123  }
124 
125 
128  void Center(ImageType *);
129 
130 
135  virtual void GenerateOutputInformation();
136 
141  virtual void GenerateInputRequestedRegion();
142 
143 
144 private:
145  PSMCleanAndCenterLabelMapImageFilter(const Self &); //purposely not implemented
146  void operator=(const Self &); //purposely not implemented
147 
148  PixelType m_ForegroundValue;
149  PixelType m_BackgroundValue;
150 };
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkPSMCleanAndCenterLabelMapImageFilter.hxx"
155 #endif
156 
157 #endif
Process an input segmentation to produce an isotropically spaced version with holes filled and center...