ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkWhitakerSparseLevelSetImage.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 
19 #ifndef itkWhitakerSparseLevelSetImage_h
20 #define itkWhitakerSparseLevelSetImage_h
21 
22 #include "itkLevelSetSparseImage.h"
23 #include "itkLabelObject.h"
24 #include "itkLabelMap.h"
25 
26 namespace itk
27 {
40 template< typename TOutput, unsigned int VDimension >
42  public LevelSetSparseImage< TOutput, VDimension >
43 {
44 public:
49 
51  itkNewMacro(Self);
52 
55 
56  itkStaticConstMacro ( Dimension, unsigned int, VDimension );
57 
58  typedef typename Superclass::InputType InputType;
64 
70 
74 
75  typedef typename Superclass::LayerType LayerType;
78 
82 
85  virtual OutputType Evaluate( const InputType& inputIndex ) const ITK_OVERRIDE;
86 
87 #ifdef ITK_USE_CONCEPT_CHECKING
88  // Begin concept checking
89 
90  itkConceptMacro( DoubleConvertible,
92 
93  // End concept checking
94 #endif // ITK_USE_CONCEPT_CHECKING
95 
96  static inline LayerIdType MinusThreeLayer() { return -3; }
97  static inline LayerIdType MinusTwoLayer() { return -2; }
98  static inline LayerIdType MinusOneLayer() { return -1; }
99  static inline LayerIdType ZeroLayer() { return 0; }
100  static inline LayerIdType PlusOneLayer() { return 1; }
101  static inline LayerIdType PlusTwoLayer() { return 2; }
102  static inline LayerIdType PlusThreeLayer() { return 3; }
103 
105  template< typename TLabel >
108  {
109  typedef LabelObject< TLabel, Dimension > OutputLabelObjectType;
110  typename OutputLabelObjectType::Pointer object = OutputLabelObjectType::New();
112 
113  for( LayerIdType status = this->MinusThreeLayer(); status < this->PlusOneLayer(); ++status )
114  {
115  LabelObjectPointer labelObject = this->m_LabelMap->GetLabelObject( status );
116 
117  for( SizeValueType i = 0; i < labelObject->GetNumberOfLines(); ++i )
118  {
119  object->AddLine( labelObject->GetLine( i ) );
120  }
121  }
122  object->Optimize();
123 
124  return object;
125  }
126 
127 protected:
130 
132  virtual void InitializeLayers() ITK_OVERRIDE;
133 
134  virtual void InitializeInternalLabelList() ITK_OVERRIDE;
135 
136 private:
137  WhitakerSparseLevelSetImage( const Self& ) ITK_DELETE_FUNCTION;
138  void operator = ( const Self& ) ITK_DELETE_FUNCTION;
139 
140 };
141 }
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "itkWhitakerSparseLevelSetImage.hxx"
145 #endif
146 
147 #endif // itkWhitakerSparseLevelSetImage_h
LayerMapType::const_iterator LayerMapConstIterator
std::map< InputType, OutputType, Functor::IndexLexicographicCompare< VDimension > > LayerType
LevelSetSparseImage< TOutput, VDimension > Superclass
Superclass::LevelSetDataType LevelSetDataType
LabelMapType::RegionType RegionType
LabelObject< LayerIdType, VDimension > LabelObjectType
Superclass::LabelObjectLengthType LabelObjectLengthType
LayerType::iterator LayerIterator
LabelObject< TLabel, Dimension >::Pointer GetAsLabelObject()
LabelObjectType::Pointer LabelObjectPointer
Superclass::LayerConstIterator LayerConstIterator
LabelMapType::Pointer LabelMapPointer
LabelObjectType::LengthType LabelObjectLengthType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Superclass::LayerMapConstIterator LayerMapConstIterator
Superclass::OutputType OutputType
Base class for the sparse representation of a level-set function on one Image.
virtual OutputType Evaluate(const InputType &inputIndex) const override=0
std::map< LayerIdType, LayerType > LayerMapType
Derived class for the sparse-field representation of level-set function.
Superclass::LevelSetDataType LevelSetDataType
LabelMap< LabelObjectType > LabelMapType
Superclass::OutputRealType OutputRealType
Superclass::LabelObjectLineType LabelObjectLineType
LayerMapType::iterator LayerMapIterator
Superclass::LayerMapIterator LayerMapIterator
Superclass::OutputType OutputType
Superclass::InputType InputType
LabelObjectType::LineType LabelObjectLineType
Superclass::GradientType GradientType
The base class for the representation of an labeled binary object in an image.
LayerType::const_iterator LayerConstIterator
Superclass::LabelObjectPointer LabelObjectPointer
Superclass::HessianType HessianType
#define itkConceptMacro(name, concept)
virtual OutputType Evaluate(const InputType &inputIndex) const override
Base class for all data objects in ITK.
virtual void InitializeLayers() override
virtual void InitializeInternalLabelList() override