KWStyle - itkLevelSet.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkLevelSet.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:40 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 DEF #ifndef _itkLevelSet_h
18 DEF #define _itkLevelSet_h
19
20 #include "itkIndex.h"
21 #include "itkImage.h"
22 #include "itkVectorContainer.h"
23 #include "itkVector.h"
24
25 namespace itk
26 {
27
28 /** 
29  * \class LevelSetNode
30  * \brief Represent a node in a level set.
31  *
32  * LevelSetNode is a simple templated class that represents a node 
33  * or grid position of a level set. A group or collection of
34  * LevelSetNode can then be used to represents a narrowband or
35  * region of interest.  
36  *
37  * LevelSetNode is templated over the data type and dimension of the
38  * level set.
39  *
40  * \ingroup LevelSetSegmentation 
41  * 
42  */
43 template<class TPixel, unsigned int VSetDimension = 2>
44 class ITK_EXPORT LevelSetNode
45 {
46 public:
47   /** Standard class typedefs. */
48   typedef LevelSetNode Self;
49
50   /** Pixel typedef. */
51   typedef TPixel PixelType;
52
53   /** Level set dimension. */
54   itkStaticConstMacro(SetDimension, unsigned int, VSetDimension);
55
56   /** Index typedef. */
57   typedef Index<VSetDimension> IndexType;
58
59   /** Operator >. A LevelSetNode is sorted by its value field. */
60   bool operator> ( const Self& node ) const
61     { return m_Value > node.m_Value; }
62
63   /** Operator <. A LevelSetNode is sorted by its value field. */
64   bool operator< ( const Self& node ) const
65     { return m_Value < node.m_Value; }
66
67   /** Operator <=. A LevelSetNode is sorted by its value field. */
68   bool operator<= ( const Self& node ) const
69     { return m_Value <= node.m_Value; }
70
71   /** Operator >=. A LevelSetNode is sorted by its value field. */
72   bool operator>= ( const Self& node ) const
73     { return m_Value >= node.m_Value; }
74
75   /** Operator =. Two nodes are equal if both their value and index fields
76    * are the same. */
77   Self& operator= ( const Self& rhs )
78     {
79 IND ******if( this == &rhs ) {return *this;}
80   
81 IND ******m_Value = rhs.m_Value;
82 IND ******m_Index = rhs.m_Index;
83 IND ******return *this;
84     }
85
86   /** Get/Set level set value. */
87   PixelType& GetValue()
88     { return m_Value; };
89   const PixelType& GetValue() const
90     { return m_Value; };
91   void SetValue( const PixelType& input )
92     { m_Value = input; };
93
94   /** Get/Set index. */
95   IndexType& GetIndex()
96     { return m_Index; }
97   const IndexType& GetIndex() const
98     { return m_Index; }
99   void SetIndex( const IndexType& input )
100     { m_Index = input; };
101
102   /** Default constructor */
103   LevelSetNode() : m_Value( NumericTraits<PixelType>::Zero ) {
104     m_Index.Fill( 0 );
105     };
106
107   /** Copy constructor */
108 LEN   LevelSetNode(const Self &node) : m_Value( node.m_Value ), m_Index( node.m_Index ) {};
109   
110 private:
111   PixelType       m_Value;
112   IndexType       m_Index;
113   
114 };
115
116 /**  \class LevelSetTypeDefault
117  * \brief Level set type information.
118  *
119  * LevelSetTypeDefault is a simple class that holds type information
120  * useful for level set algorithms. This class is templated over the
121  * level set image type.
122  *
123  * A NodeContainer contains a group or collection of level set 
124  * node or grid points useful for representing a narrowband or
125  * region of interest.
126  *
127  * \ingroup LevelSetSegmentation 
128  */
129 template<class TLevelSet>
130 class ITK_EXPORT LevelSetTypeDefault
131 {
132 IND *public:
133   /** LevelSetType typedef support. */
134   typedef LevelSetTypeDefault Self;
135 TDA   typedef TLevelSet LevelSetImageType;
136   
137   
138   /** SetDimension enumeration. */
139   itkStaticConstMacro(SetDimension, unsigned int, TLevelSet::ImageDimension);
140
141   /** LevelSetPointer typedef support. */
142   typedef typename TLevelSet::Pointer LevelSetPointer;
143 TDA   typedef typename TLevelSet::ConstPointer LevelSetConstPointer;
144
145   /** PixelType typedef support. */
146   typedef typename TLevelSet::PixelType PixelType;
147   
148   /** Node typdef support. */
149   typedef
150 IND ******LevelSetNode<PixelType, itkGetStaticConstMacro(SetDimension)> NodeType;
151
152   /** NodeContainer typedef support. */
153   typedef VectorContainer<unsigned int,NodeType> NodeContainer;
154
155   /** NodeContainerPointer typedef support. */
156   typedef typename NodeContainer::Pointer NodeContainerPointer;
157 };
158
159
160 /** \class AuxVarTypeDefault
161  * \brief Level set auxiliary variables type information.
162  *
163  * \brief AuxVarTypeDefault is a simple class that holds type information
164  * for auxiliary variables in some level set algorithms. This class is templated
165  * over the auxiliary variable data type, the number of auxiliary variables
166  * and the level set dimension.
167  *
168  * A AuxValueContainer contains a collection of auxiliary
169  * values vectors. It is used in conjunction with 
170  * LevelSetTypeDefault::NodeContainer to represent auxiliary variable values 
171  * in a group or collection of level set nodes or grid positions.
172  *
173  * \ingroup LevelSetSegmentation 
174  */
175 template < 
176 class TPixel,
177 unsigned int VAuxDimension = 1,
178 unsigned int VSetDimension = 2
179 >
180 class ITK_EXPORT AuxVarTypeDefault
181 {
182 IND *public:
183   /** Standard typedefs */
184   typedef AuxVarTypeDefault Self;
185   
186   /** PixelType typedef support. */ 
187   typedef TPixel AuxValueType;
188
189   /** Auxiliary variable dimension. */
190   itkStaticConstMacro(AuxDimension, unsigned int, VAuxDimension);
191
192   /** Level set dimension. */
193   itkStaticConstMacro(SetDimension, unsigned int, VSetDimension);
194
195   /** AuxVector typedef support. */
196   typedef Vector<TPixel,VAuxDimension> AuxValueVectorType;
197
198   /** AuxContainer typdef support. */
199   typedef VectorContainer<unsigned int,AuxValueVectorType> AuxValueContainer;
200
201   /** AuxImage typdef support. */
202   typedef Image<AuxValueType, VSetDimension> AuxImageType;
203
204   /** AuxImagePointer typedef support. */
205   typedef typename AuxImageType::Pointer AuxImagePointer;
206 TDA   typedef typename AuxImageType::ConstPointer AuxImageConstPointer;
207 };
208
209
210 // namespace itk
211
212 #endif
213

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:18PM
© Kitware Inc.