ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetNode.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkLevelSetNode_h
00019 #define __itkLevelSetNode_h
00020 
00021 #include "itkIndex.h"
00022 #include "itkImage.h"
00023 #include "itkVectorContainer.h"
00024 #include "itkVector.h"
00025 
00026 namespace itk
00027 {
00044 template< class TPixel, unsigned int VSetDimension = 2 >
00045 class ITK_EXPORT LevelSetNode
00046 {
00047 public:
00048 
00050   typedef LevelSetNode Self;
00051 
00053   typedef TPixel PixelType;
00054 
00056   itkStaticConstMacro(SetDimension, unsigned int, VSetDimension);
00057 
00059   typedef Index< VSetDimension > IndexType;
00060 
00062   bool operator>(const Self & node) const
00063   { return m_Value > node.m_Value; }
00064 
00066   bool operator<(const Self & node) const
00067   { return m_Value < node.m_Value; }
00068 
00070   bool operator<=(const Self & node) const
00071   { return m_Value <= node.m_Value; }
00072 
00074   bool operator>=(const Self & node) const
00075   { return m_Value >= node.m_Value; }
00076 
00079   Self & operator=(const Self & rhs)
00080   {
00081     if ( this == &rhs ) { return *this; }
00082 
00083     m_Value = rhs.m_Value;
00084     m_Index = rhs.m_Index;
00085     return *this;
00086   }
00087 
00089   PixelType & GetValue()
00090   { return m_Value; }
00091   const PixelType & GetValue() const
00092   { return m_Value; }
00093   void SetValue(const PixelType & input)
00094   { m_Value = input; }
00096 
00098   IndexType & GetIndex()
00099   { return m_Index; }
00100   const IndexType & GetIndex() const
00101   { return m_Index; }
00102   void SetIndex(const IndexType & input)
00103   { m_Index = input; }
00105 
00107   LevelSetNode():m_Value(NumericTraits< PixelType >::Zero)
00108   {
00109     m_Index.Fill(0);
00110   }
00111 
00113   LevelSetNode(const Self & node):m_Value(node.m_Value), m_Index(node.m_Index) {}
00114 private:
00115   PixelType m_Value;
00116   IndexType m_Index;
00117 };
00118 } // end namespace itk
00119 
00120 #endif
00121