ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 00019 #ifndef __itkFastMarchingNumberOfElementsStoppingCriterion_h 00020 #define __itkFastMarchingNumberOfElementsStoppingCriterion_h 00021 00022 #include "itkFastMarchingStoppingCriterionBase.h" 00023 #include "itkObjectFactory.h" 00024 00025 namespace itk 00026 { 00040 template< class TInput, class TOutput > 00041 class FastMarchingNumberOfElementsStoppingCriterion : 00042 public FastMarchingStoppingCriterionBase< TInput, TOutput > 00043 { 00044 public: 00045 typedef FastMarchingNumberOfElementsStoppingCriterion Self; 00046 typedef FastMarchingStoppingCriterionBase< TInput, TOutput > Superclass; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00051 itkNewMacro(Self); 00052 00054 itkTypeMacro(FastMarchingNumberOfElementsStoppingCriterion, 00055 FastMarchingStoppingCriterionBase ); 00056 00057 typedef typename Superclass::OutputPixelType OutputPixelType; 00058 typedef typename Superclass::NodeType NodeType; 00059 00061 itkSetMacro( TargetNumberOfElements, IdentifierType ); 00062 itkGetMacro( TargetNumberOfElements, IdentifierType ); 00064 00065 bool IsSatisfied() const 00066 { 00067 return ( this->m_CurrentNumberOfElements >= this->m_TargetNumberOfElements ); 00068 } 00069 00070 std::string GetDescription() const 00071 { 00072 return "Current Number of Elements >= Target Number of Elements"; 00073 } 00074 00075 protected: 00076 FastMarchingNumberOfElementsStoppingCriterion() : Superclass(), 00077 m_CurrentNumberOfElements( NumericTraits< IdentifierType >::Zero ), 00078 m_TargetNumberOfElements( NumericTraits< IdentifierType >::Zero ) 00079 {} 00080 00081 ~FastMarchingNumberOfElementsStoppingCriterion() {} 00082 00083 IdentifierType m_CurrentNumberOfElements; 00084 IdentifierType m_TargetNumberOfElements; 00085 00086 void SetCurrentNode( const NodeType& ) 00087 { 00088 ++this->m_CurrentNumberOfElements; 00089 } 00090 00091 void Reset() 00092 { 00093 this->m_CurrentNumberOfElements = NumericTraits< IdentifierType >::Zero; 00094 } 00095 00096 private: 00097 FastMarchingNumberOfElementsStoppingCriterion( const Self& ); 00098 void operator = ( const Self& ); 00099 }; 00100 00101 } 00102 #endif // __itkFastMarchingNumberOfElementsStoppingCriterion_h 00103