ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkFastMarchingImageToNodePairContainerAdaptor.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 
00019 #ifndef __itkFastMarchingImageToNodePairContainerAdaptor_h
00020 #define __itkFastMarchingImageToNodePairContainerAdaptor_h
00021 
00022 #include "itkObject.h"
00023 #include "itkFastMarchingTraits.h"
00024 
00025 namespace itk
00026 {
00049 template< class TInput, class TOutput, class TImage >
00050 class FastMarchingImageToNodePairContainerAdaptor :
00051     public Object
00052   {
00053 public:
00054   typedef FastMarchingImageToNodePairContainerAdaptor   Self;
00055   typedef LightObject                                   Superclass;
00056   typedef SmartPointer< Self >                          Pointer;
00057   typedef SmartPointer< const Self >                    ConstPointer;
00058 
00059 
00061   itkNewMacro(Self);
00062 
00064   itkTypeMacro(FastMarchingImageToNodePairContainerAdaptor, LightObject);
00065 
00066   typedef FastMarchingTraits< TInput, TOutput >     Traits;
00067   typedef typename Traits::NodePairType             NodePairType;
00068   typedef typename Traits::NodePairContainerType    NodePairContainerType;
00069   typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
00070   typedef typename Traits::LabelType                LabelType;
00071   typedef typename Traits::OutputPixelType          OutputPixelType;
00072 
00073   typedef TImage                            ImageType;
00074   typedef typename ImageType::Pointer       ImagePointer;
00075   typedef typename ImageType::ConstPointer  ImageConstPointer;
00076   typedef typename ImageType::PixelType     ImagePixelType;
00077 
00078   itkStaticConstMacro( ImageDimension, unsigned int,
00079                        Traits::ImageDimension );
00080 
00084   void SetAliveImage( const ImageType* iImage );
00085 
00089   void SetTrialImage( const ImageType* iImage );
00090 
00101   void SetForbiddenImage( const ImageType* iImage );
00102 
00103   itkSetMacro( IsForbiddenImageBinaryMask, bool );
00104   itkBooleanMacro( IsForbiddenImageBinaryMask );
00105 
00107   NodePairContainerType* GetAlivePoints();
00108 
00110   NodePairContainerType* GetTrialPoints();
00111 
00113   NodePairContainerType* GetForbiddenPoints();
00114 
00115   itkSetMacro( AliveValue, OutputPixelType );
00116   itkSetMacro( TrialValue, OutputPixelType );
00117 
00119   void Update();
00120 
00121 
00122 protected:
00123 
00125   FastMarchingImageToNodePairContainerAdaptor();
00126 
00128   virtual ~FastMarchingImageToNodePairContainerAdaptor() {}
00129 
00130   ImageConstPointer m_AliveImage;
00131   ImageConstPointer m_TrialImage;
00132   ImageConstPointer m_ForbiddenImage;
00133 
00134   NodePairContainerPointer m_AlivePoints;
00135   NodePairContainerPointer m_TrialPoints;
00136   NodePairContainerPointer m_ForbiddenPoints;
00137 
00138   OutputPixelType m_AliveValue;
00139   OutputPixelType m_TrialValue;
00140 
00141   bool m_IsForbiddenImageBinaryMask;
00142 
00143   virtual void GenerateData();
00144 
00146   void
00147   SetPointsFromImage( const ImageType* image, const LabelType& iLabel,
00148     const OutputPixelType& iValue );
00149 
00150 
00151 private:
00152 
00153   FastMarchingImageToNodePairContainerAdaptor( const Self& );
00154   void operator = ( const Self& );
00155 
00156   };
00157 }
00158 
00159 #include "itkFastMarchingImageToNodePairContainerAdaptor.hxx"
00160 #endif // __itkFastMarchingImageToNodePairContainerAdaptor_h
00161