ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAnchorOpenCloseLine.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 itkAnchorOpenCloseLine_h
19 #define itkAnchorOpenCloseLine_h
20 
21 #include "itkMorphologyHistogram.h"
22 #include "itkIndent.h"
23 
24 //#define RAWHIST
25 
26 namespace itk
27 {
35 template< typename TInputPix, typename TCompare >
36 class ITK_TEMPLATE_EXPORT AnchorOpenCloseLine
37 {
38 public:
39 
41  using InputImagePixelType = TInputPix;
43  ~AnchorOpenCloseLine() = default;
45 
46  void PrintSelf(std::ostream & os, Indent indent) const;
47 
50  void DoLine(std::vector<InputImagePixelType> & buffer, unsigned bufflength);
51 
52  void SetSize(unsigned int size)
53  {
54  m_Size = size;
55  }
56 
57 private:
58  unsigned int m_Size;
59 
61 
62  bool StartLine(std::vector<InputImagePixelType> & buffer,
63  InputImagePixelType & Extreme,
64  unsigned & outLeftP,
65  unsigned & outRightP);
66 
67  void FinishLine(std::vector<InputImagePixelType> & buffer,
68  InputImagePixelType & Extreme,
69  unsigned & outLeftP,
70  unsigned & outRightP);
71 
72  inline bool Compare1( const InputImagePixelType & a, const InputImagePixelType & b )
73  {
74  TCompare compare;
75  return ! compare( a, b );
76  }
77 
78  inline bool Compare2( const InputImagePixelType & a, const InputImagePixelType & b )
79  {
80  TCompare compare;
81  return compare( a, b ) || a == b;
82  }
83 
84 }; // end of class
85 } // end namespace itk
86 
87 #ifndef ITK_MANUAL_INSTANTIATION
88 #include "itkAnchorOpenCloseLine.hxx"
89 #endif
90 
91 #endif
void DoLine(LineBufferType &LineBuf, LineBufferType &tmpLineBuf, const RealType magnitude, const RealType m_Extreme)
bool Compare2(const InputImagePixelType &a, const InputImagePixelType &b)
void SetSize(unsigned int size)
class to implement openings and closings using anchor methods. This is the base class that must be in...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
bool Compare1(const InputImagePixelType &a, const InputImagePixelType &b)