Orfeo Toolbox  4.0
itkBinaryContourImageFilter.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 __itkBinaryContourImageFilter_h
19 #define __itkBinaryContourImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 #include "itkConceptChecking.h"
23 #include "itkBarrier.h"
24 #include <vector>
25 
26 namespace itk
27 {
53 template< typename TInputImage, typename TOutputImage >
55  public InPlaceImageFilter< TInputImage, TOutputImage >
56 {
57 public:
65 
70 
74  itkNewMacro(Self);
75 
79  typedef TInputImage InputImageType;
80  typedef typename InputImageType::Pointer InputImagePointer;
81  typedef typename InputImageType::ConstPointer InputImageConstPointer;
82  typedef typename InputImageType::IndexType IndexType;
83  typedef typename InputImageType::SizeType SizeType;
85  typedef typename InputImageType::PixelType InputImagePixelType;
86  typedef typename InputImageType::InternalPixelType InputInternalPixelType;
87 
88  typedef TOutputImage OutputImageType;
89  typedef typename OutputImageType::Pointer OutputImagePointer;
90  typedef typename OutputImageType::RegionType RegionType;
91  typedef typename OutputImageType::IndexType OutputIndexType;
92  typedef typename OutputImageType::SizeType OutputSizeType;
94  typedef typename OutputImageType::PixelType OutputImagePixelType;
95  typedef typename OutputImageType::InternalPixelType OutputInternalPixelType;
96 
97  itkStaticConstMacro(ImageDimension, unsigned int,
98  OutputImageType::ImageDimension);
99 
100 #ifdef ITK_USE_CONCEPT_CHECKING
101  itkStaticConstMacro(InputImageDimension, unsigned int,
102  InputImageType::ImageDimension);
103 
104  // Concept checking -- input and output dimensions must be the same
105  itkConceptMacro( SameDimension,
106  ( Concept::SameDimension< itkGetStaticConstMacro(ImageDimension),
107  itkGetStaticConstMacro(OutputImageDimension) > ) );
108 #endif
109 
116  itkSetMacro(FullyConnected, bool);
117  itkGetConstReferenceMacro(FullyConnected, bool);
118  itkBooleanMacro(FullyConnected);
119 
124  itkSetMacro(BackgroundValue, OutputImagePixelType);
125  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
126 
131  itkSetMacro(ForegroundValue, InputImagePixelType);
132  itkGetConstMacro(ForegroundValue, InputImagePixelType);
133 
134 protected:
135 
138 
139  void PrintSelf(std::ostream & os, Indent indent) const;
140 
145 
147 
148  void ThreadedGenerateData(const RegionType & outputRegionForThread,
149  ThreadIdType threadId);
150 
155 
160  void EnlargeOutputRequestedRegion( DataObject * itkNotUsed(output) );
161 
162 private:
163  BinaryContourImageFilter(const Self &); //Purposefully not implemented
164  void operator = ( const Self &); //Purposefully not implemented
165 
166  // types to support the run length encoding of lines
167  struct runLength
168  {
169  runLength( const OffsetValueType& iLength, const IndexType& iWhere ) :
170  m_Length( iLength ), m_Where( iWhere ) {}
171 
172  // run length information - may be a more type safe way of doing this
174 
175  // Index of the start of the run
177  };
178 
179  typedef std::vector< runLength > LineEncodingType;
180  typedef typename LineEncodingType::iterator LineEncodingIterator;
181  typedef typename LineEncodingType::const_iterator LineEncodingConstIterator;
182 
183  // the map storing lines
184  typedef std::vector< LineEncodingType > LineMapType;
185 
186  typedef std::vector< OffsetValueType > OffsetVec;
187 
188  bool CheckNeighbors(const OutputIndexType & A,
189  const OutputIndexType & B);
190 
191  void CompareLines(LineEncodingType & current,
192  const LineEncodingType & Neighbour);
193 
194  void SetupLineOffsets(OffsetVec & LineOffsets);
195 
196  void Wait();
197 
199 
203 
207 };
208 } // end namespace itk
209 
210 #ifndef ITK_MANUAL_INSTANTIATION
212 #endif
213 
214 #endif

Generated at Sat Mar 8 2014 14:17:54 for Orfeo Toolbox with doxygen 1.8.3.1