ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkConnectedThresholdImageFilter.h
Go to the documentation of this file.
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 __itkConnectedThresholdImageFilter_h
19 #define __itkConnectedThresholdImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
36 template< class TInputImage, class TOutputImage >
38  public ImageToImageFilter< TInputImage, TOutputImage >
39 {
40 public:
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(ConnectedThresholdImageFilter,
53 
54  typedef TInputImage InputImageType;
55  typedef typename InputImageType::Pointer InputImagePointer;
56  typedef typename InputImageType::ConstPointer InputImageConstPointer;
57  typedef typename InputImageType::RegionType InputImageRegionType;
58  typedef typename InputImageType::PixelType InputImagePixelType;
59  typedef typename InputImageType::IndexType IndexType;
60  typedef typename std::vector<IndexType> SeedContainerType;
61  typedef typename InputImageType::SizeType SizeType;
62 
63  typedef TOutputImage OutputImageType;
64  typedef typename OutputImageType::Pointer OutputImagePointer;
65  typedef typename OutputImageType::RegionType OutputImageRegionType;
66  typedef typename OutputImageType::PixelType OutputImagePixelType;
67 
68  void PrintSelf(std::ostream & os, Indent indent) const;
69 
71  void SetSeed(const IndexType & seed);
72 
73  void AddSeed(const IndexType & seed);
74 
76  void ClearSeeds();
77 
79  virtual const SeedContainerType &GetSeeds() const;
80 
84  itkSetMacro(ReplaceValue, OutputImagePixelType);
85  itkGetConstMacro(ReplaceValue, OutputImagePixelType);
87 
90 
92  virtual void SetUpper(InputImagePixelType);
93  virtual void SetLower(InputImagePixelType);
95 
97  virtual void SetUpperInput(const InputPixelObjectType *);
98 
99  virtual void SetLowerInput(const InputPixelObjectType *);
100 
102  virtual InputImagePixelType GetUpper() const;
103 
104  virtual InputImagePixelType GetLower() const;
105 
107  virtual InputPixelObjectType * GetUpperInput();
108 
109  virtual InputPixelObjectType * GetLowerInput();
110 
112  itkStaticConstMacro(InputImageDimension, unsigned int,
113  TInputImage::ImageDimension);
114  itkStaticConstMacro(OutputImageDimension, unsigned int,
115  TOutputImage::ImageDimension);
117 
118 #ifdef ITK_USE_CONCEPT_CHECKING
119 
120  itkConceptMacro( OutputEqualityComparableCheck,
122  itkConceptMacro( InputEqualityComparableCheck,
124  itkConceptMacro( InputConvertibleToOutputCheck,
126  itkConceptMacro( SameDimensionCheck,
128  itkConceptMacro( IntConvertibleToInputCheck,
130  itkConceptMacro( OutputOStreamWritableCheck,
132 
134 #endif
135 
139  typedef enum { FaceConnectivity, FullConnectivity } ConnectivityEnumType;
140 
143  itkSetEnumMacro(Connectivity, ConnectivityEnumType);
144  itkGetEnumMacro(Connectivity, ConnectivityEnumType);
146 
147 protected:
151 
154 
156 
157  // Override since the filter needs all the data for the algorithm
158  void GenerateInputRequestedRegion();
159 
160  // Override since the filter produces the entire dataset
161  void EnlargeOutputRequestedRegion(DataObject *output);
162 
163  void GenerateData();
164 
165  // Type of connectivity to use.
167 
168 private:
169  ConnectedThresholdImageFilter(const Self &); //purposely not implemented
170  void operator=(const Self &); //purposely not implemented
171 };
172 } // end namespace itk
173 
174 #ifndef ITK_MANUAL_INSTANTIATION
175 #include "itkConnectedThresholdImageFilter.hxx"
176 #endif
177 
178 #endif
179