ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkAnchorErodeDilateLine.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 __itkAnchorErodeDilateLine_h
19 #define __itkAnchorErodeDilateLine_h
20 
22 
23 namespace itk
24 {
36 template< typename TInputPix, typename TCompare >
38 {
39 public:
40 
42  typedef TInputPix InputImagePixelType;
43 
44  void DoLine(std::vector<TInputPix> & buffer, std::vector<TInputPix> & inbuffer,
45  unsigned bufflength);
46 
47  void SetSize(unsigned int size)
48  {
49  m_Size = size;
50  }
51 
52  void PrintSelf(std::ostream & os, Indent indent) const;
53 
56  {
57  }
58 
59 private:
60  unsigned int m_Size;
61 
63 
64  bool StartLine(std::vector<TInputPix> & buffer,
65  std::vector<TInputPix> & inbuffer,
66  InputImagePixelType & Extreme,
67  int & outLeftP,
68  int & outRightP,
69  int & inLeftP,
70  int & inRightP,
71  int middle);
72 
73  void FinishLine(std::vector<TInputPix> & buffer,
74  std::vector<TInputPix> & inbuffer,
75  InputImagePixelType & Extreme,
76  int & outLeftP,
77  int & outRightP,
78  int & inLeftP,
79  int & inRightP,
80  int middle);
81 
83  {
84  // bool, short and char are acceptable for vector based algorithm: they do
85  // not require
86  // too much memory. Other types are not usable with that algorithm
87  return typeid( InputImagePixelType ) == typeid( unsigned char )
88  || typeid( InputImagePixelType ) == typeid( signed char )
89  || typeid( InputImagePixelType ) == typeid( unsigned short )
90  || typeid( InputImagePixelType ) == typeid( signed short )
91  || typeid( InputImagePixelType ) == typeid( bool );
92  }
93 
94  inline bool StrictCompare( const InputImagePixelType & a, const InputImagePixelType & b )
95  {
96  TCompare compare;
97  return compare( a, b );
98  }
99 
100  inline bool Compare( const InputImagePixelType & a, const InputImagePixelType & b )
101  {
102  TCompare compare;
103  return compare( a, b ) || a == b;
104  }
105 
106 }; // end of class
107 } // end namespace itk
108 
109 #ifndef ITK_MANUAL_INSTANTIATION
110 #include "itkAnchorErodeDilateLine.hxx"
111 #endif
112 
113 #endif
bool StartLine(std::vector< TInputPix > &buffer, std::vector< TInputPix > &inbuffer, InputImagePixelType &Extreme, int &outLeftP, int &outRightP, int &inLeftP, int &inRightP, int middle)
void FinishLine(std::vector< TInputPix > &buffer, std::vector< TInputPix > &inbuffer, InputImagePixelType &Extreme, int &outLeftP, int &outRightP, int &inLeftP, int &inRightP, int middle)
void DoLine(std::vector< TInputPix > &buffer, std::vector< TInputPix > &inbuffer, unsigned bufflength)
void PrintSelf(std::ostream &os, Indent indent) const
bool Compare(const InputImagePixelType &a, const InputImagePixelType &b)
bool StrictCompare(const InputImagePixelType &a, const InputImagePixelType &b)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Function::MorphologyHistogram< InputImagePixelType, TCompare > HistogramType
void SetSize(unsigned int size)
class to implement erosions and dilations using anchor methods. This is the base class that must be i...