18 #ifndef itkInOrderTreeIterator_h
19 #define itkInOrderTreeIterator_h
25 template <
typename TTreeType>
66 template <
typename TTreeType>
72 template <
typename TTreeType>
78 template <
typename TTreeType>
86 template <
typename TTreeType>
90 if (const_cast<TreeNodeType *>(FindNextNode()) !=
nullptr)
99 template <
typename TTreeType>
103 this->m_Position = const_cast<TreeNodeType *>(FindNextNode());
104 if (this->m_Position ==
nullptr)
106 return this->m_Root->Get();
108 return this->m_Position->Get();
113 template <
typename TTreeType>
117 if (this->m_Position ==
nullptr)
122 if (this->m_Position->HasChildren())
124 return this->m_Position->GetChild(0);
127 if (!this->m_Position->HasParent())
135 int childPosition = parent->ChildPosition(child);
136 int lastChildPosition = parent->CountChildren() - 1;
138 while (childPosition < lastChildPosition)
140 TreeNodeType * help = parent->GetChild(childPosition + 1);
148 while (parent->HasParent())
151 parent = parent->GetParent();
154 if (parent->ChildPosition(this->m_Root) >= 0)
158 childPosition = parent->ChildPosition(child);
159 lastChildPosition = parent->CountChildren() - 1;
161 while (childPosition < lastChildPosition)
163 TreeNodeType * help = parent->GetChild(childPosition + 1);
174 template <
typename TTreeType>