17 #ifndef __itkFastMarchingExtensionImageFilter_txx
18 #define __itkFastMarchingExtensionImageFilter_txx
25 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
31 m_AuxAliveValues =
NULL;
32 m_AuxTrialValues =
NULL;
37 for (
unsigned int k = 0; k < VAuxDimension; k++ )
39 ptr = AuxImageType::New();
45 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
51 Superclass::PrintSelf(os,indent);
52 os << indent <<
"Aux alive values: ";
53 os << m_AuxAliveValues.GetPointer() << std::endl;
54 os << indent <<
"Aux trail values: ";
55 os << m_AuxTrialValues.GetPointer() << std::endl;
62 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
70 if ( idx >= AuxDimension || this->GetNumberOfOutputs() < idx + 2 )
83 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
91 this->Superclass::GenerateOutputInformation();
96 for (
unsigned int k = 0; k < VAuxDimension; k++ )
108 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
117 for (
unsigned int j = 0; j < this->GetNumberOfOutputs(); j++ )
130 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
137 this->Superclass::Initialize( output );
139 if ( this->GetAlivePoints() && !m_AuxAliveValues )
141 itkExceptionMacro(<<
"in Initialize(): Null pointer for AuxAliveValues" );
144 if ( m_AuxAliveValues &&
145 m_AuxAliveValues->Size() != (this->GetAlivePoints())->
Size() )
147 itkExceptionMacro(<<
"in Initialize(): AuxAliveValues is the wrong size" );
150 if ( this->GetTrialPoints() && !m_AuxTrialValues )
152 itkExceptionMacro(<<
"in Initialize(): Null pointer for AuxTrialValues" );
155 if ( m_AuxTrialValues &&
156 m_AuxTrialValues->Size() != (this->GetTrialPoints())->
Size() )
158 itkExceptionMacro(<<
"in Initialize(): AuxTrialValues is the wrong size" );
164 for (
unsigned int k = 0; k < VAuxDimension; k++ )
177 if ( m_AuxAliveValues )
180 typename Superclass::NodeContainer::ConstIterator pointsIter = (this->GetAlivePoints())->Begin();
181 typename Superclass::NodeContainer::ConstIterator pointsEnd = (this->GetAlivePoints())->End();
183 for (; pointsIter != pointsEnd; ++pointsIter, ++auxIter )
185 node = pointsIter.Value();
186 auxVec = auxIter.
Value();
189 if ( !this->GetOutput()->GetBufferedRegion().IsInside( node.
GetIndex() ) )
194 for (
unsigned int k = 0; k < VAuxDimension; k++ )
196 auxImages[k]->SetPixel( node.
GetIndex(), auxVec[k] );
202 if ( m_AuxTrialValues )
205 typename Superclass::NodeContainer::ConstIterator pointsIter = (this->GetTrialPoints())->Begin();
206 typename Superclass::NodeContainer::ConstIterator pointsEnd = (this->GetTrialPoints())->End();
208 for (; pointsIter != pointsEnd; ++pointsIter, ++auxIter )
210 node = pointsIter.Value();
211 auxVec = auxIter.
Value();
214 if ( !this->GetOutput()->GetBufferedRegion().IsInside( node.
GetIndex() ) )
219 for (
unsigned int k = 0; k < VAuxDimension; k++ )
221 auxImages[k]->SetPixel( node.
GetIndex(), auxVec[k] );
231 template <
class TLevelSet,
class TAuxValue,
unsigned int VAuxDimension,
254 double solution = this->Superclass::UpdateValue( index, speed, output );
258 if ( solution < this->GetLargeValue() )
261 for (
unsigned int k = 0; k < VAuxDimension; k++ )
267 for(
unsigned int j = 0; j < SetDimension; j++ )
269 node = this->GetNodeUsedInCalculation(j);
276 auxVal = this->GetAuxiliaryImage(k)->GetPixel( node.
GetIndex() );
277 numer += auxVal * ( solution - node.
GetValue() );
278 denom += solution - node.
GetValue();
288 auxVal = NumericTraits<AuxValueType>::Zero;
291 this->GetAuxiliaryImage(k)->SetPixel( index, auxVal );