ITK  6.0.0
Insight Toolkit
itkAnchorOpenCloseLine.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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;
46  void
47  PrintSelf(std::ostream & os, Indent indent) const;
48 
51  void
52  DoLine(std::vector<InputImagePixelType> & buffer, unsigned int bufflength);
53 
54  void
55  SetSize(unsigned int size)
56  {
57  m_Size = size;
58  }
59 
60 private:
61  unsigned int m_Size;
62 
64 
65  bool
66  StartLine(std::vector<InputImagePixelType> & buffer,
67  InputImagePixelType & Extreme,
68  unsigned int & outLeftP,
69  unsigned int & outRightP);
70 
71  void
72  FinishLine(std::vector<InputImagePixelType> & buffer,
73  InputImagePixelType & Extreme,
74  unsigned int & outLeftP,
75  unsigned int & outRightP);
76 
77  inline bool
79  {
80  TCompare compare;
81  return !compare(a, b);
82  }
83 
84  inline bool
86  {
87  TCompare compare;
88  return compare(a, b) || a == b;
89  }
90 
91 }; // end of class
92 } // end namespace itk
93 
94 #ifndef ITK_MANUAL_INSTANTIATION
95 # include "itkAnchorOpenCloseLine.hxx"
96 #endif
97 
98 #endif
itk::Function::MorphologyHistogram
Definition: itkMorphologyHistogram.h:31
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AnchorOpenCloseLine::Compare2
bool Compare2(const InputImagePixelType &a, const InputImagePixelType &b)
Definition: itkAnchorOpenCloseLine.h:85
itkIndent.h
itk::AnchorOpenCloseLine::InputImagePixelType
TInputPix InputImagePixelType
Definition: itkAnchorOpenCloseLine.h:41
itk::AnchorOpenCloseLine::m_Size
unsigned int m_Size
Definition: itkAnchorOpenCloseLine.h:61
itk::AnchorOpenCloseLine
class to implement openings and closings using anchor methods. This is the base class that must be in...
Definition: itkAnchorOpenCloseLine.h:36
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::AnchorOpenCloseLine::SetSize
void SetSize(unsigned int size)
Definition: itkAnchorOpenCloseLine.h:55
itk::AnchorOpenCloseLine::Compare1
bool Compare1(const InputImagePixelType &a, const InputImagePixelType &b)
Definition: itkAnchorOpenCloseLine.h:78
itkMorphologyHistogram.h