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
22#include "itkIndent.h"
23
24//#define RAWHIST
25
26namespace itk
27{
35template <typename TInputPix, typename TCompare>
36class ITK_TEMPLATE_EXPORT AnchorOpenCloseLine
37{
38public:
39
41 using InputImagePixelType = TInputPix;
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
60private:
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
class to implement openings and closings using anchor methods. This is the base class that must be in...
bool Compare2(const InputImagePixelType &a, const InputImagePixelType &b)
void DoLine(std::vector< InputImagePixelType > &buffer, unsigned int bufflength)
bool Compare1(const InputImagePixelType &a, const InputImagePixelType &b)
void SetSize(unsigned int size)
void PrintSelf(std::ostream &os, Indent indent) const
void FinishLine(std::vector< InputImagePixelType > &buffer, InputImagePixelType &Extreme, unsigned int &outLeftP, unsigned int &outRightP)
bool StartLine(std::vector< InputImagePixelType > &buffer, InputImagePixelType &Extreme, unsigned int &outLeftP, unsigned int &outRightP)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....