]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 17 Sep 2015 12:54:44 +0000 (14:54 +0200)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 17 Sep 2015 12:54:44 +0000 (14:54 +0200)
41 files changed:
lib/cpExtensions/Algorithms/BezierCurveFunction.h
lib/cpExtensions/Algorithms/GradientFunctionBase.h
lib/cpExtensions/Algorithms/GulsunTekMedialness.h
lib/cpExtensions/Algorithms/GulsunTekMedialness.hxx
lib/cpExtensions/Algorithms/ImageFunctionFilter.h
lib/cpExtensions/Algorithms/ImageFunctorFilter.h
lib/cpExtensions/Algorithms/InertiaMedialness.h
lib/cpExtensions/Algorithms/InertiaTensorFunction.h
lib/cpExtensions/Algorithms/IsoImageSlicer.h
lib/cpExtensions/Algorithms/IterativeGaussianModelEstimator.h
lib/cpExtensions/Algorithms/KalmanConstantFilter.h
lib/cpExtensions/Algorithms/KalmanFilter.h
lib/cpExtensions/Algorithms/KalmanVelocityFilter.h
lib/cpExtensions/Algorithms/LightCompensationFilter.h
lib/cpExtensions/Algorithms/MultiScaleGaussianImageFilter.h
lib/cpExtensions/Algorithms/ParallelImageMean.h
lib/cpExtensions/Algorithms/RGBExtractFunction.h
lib/cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.h
lib/cpExtensions/Algorithms/RGBToHSVFunction.h
lib/cpExtensions/Algorithms/RGBToRGBFunction.h
lib/cpExtensions/Algorithms/RGBToYPbPrFunction.h
lib/cpExtensions/DataStructures/ITKAndVTKImage.h
lib/cpExtensions/DataStructures/QuadEdge.h
lib/cpExtensions/DataStructures/QuadEdgeCell.h
lib/cpExtensions/DataStructures/QuadEdgeIterators.h
lib/cpExtensions/DataStructures/QuadEdgeMesh.h
lib/cpExtensions/IO/MeshReader.h
lib/cpExtensions/IO/WaveFrontOBJReader.h
lib/cpExtensions/IO/WaveFrontOBJReader.hxx
lib/cpExtensions/Visualization/Image3DMPR.cxx
lib/cpExtensions/Visualization/Image3DMPR.h
lib/cpExtensions/Visualization/ImageInteractorStyle.cxx
lib/cpExtensions/Visualization/ImageInteractorStyle.h
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpExtensions/Visualization/MPRActors.h
lib/cpExtensions/Visualization/MPRWithDifferentWindows.cxx
lib/cpExtensions/Visualization/MPRWithDifferentWindows.h
lib/cpExtensions/Visualization/MeshMapper.h
lib/cpExtensions/Visualization/OpenGLMeshMapper.h
lib/cpExtensions/Visualization/OpenGLMeshMapper.hxx
lib/cpExtensions/Visualization/SeedWidgetCorrector.h

index d15f3286fe8374f21a8a0d138b619131e63dfab3..ee512da6a240b91eac6d7634687ee3d51224ef3d 100644 (file)
 #include <itkMatrix.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     * Uses the De Casteljau's algorithm.
+     */
+    template< class V >
+    class BezierCurveFunction
+      : public itk::FunctionBase< typename V::ValueType, V >
     {
-      /**
-       * Uses the De Casteljau's algorithm.
-       */
-      template< class V >
-      class BezierCurveFunction
-        : public itk::FunctionBase< typename V::ValueType, V >
-      {
-      public:
-        typedef BezierCurveFunction                           Self;
-        typedef itk::FunctionBase< typename V::ValueType, V > Superclass;
-        typedef itk::SmartPointer< Self >                     Pointer;
-        typedef itk::SmartPointer< const Self >               ConstPointer;
-
-        typedef V                     TVector;
-        typedef typename V::ValueType TScalar;
-
-        typedef
-        itk::Matrix< TScalar, TVector::Dimension, TVector::Dimension >
-        TFrame; 
-        typedef std::vector< TVector > TVectorsContainer;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( BezierCurveFunction, itkFunctionBase );
-
-      public:
-        virtual void AddPoint( const TVector& v );
-        virtual unsigned int GetNumberOfPoints( ) const;
-
-        virtual TVector Evaluate( const TScalar& u ) const;
-        virtual TFrame EvaluateFrenetFrame( const TScalar& u ) const;
-        virtual TScalar EvaluateLength( ) const;
-
-      protected:
-        BezierCurveFunction( );
-        virtual ~BezierCurveFunction( ) { }
-
-        void _UpdateDerivative( ) const;
-
-      private:
-        // Purposely not implemented
-        BezierCurveFunction( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        TVectorsContainer m_Vectors;
-        mutable Pointer   m_Derivative;
-        mutable bool      m_DerivativeUpdated;
-      };
-
-    } // ecapseman
+    public:
+      typedef BezierCurveFunction                           Self;
+      typedef itk::FunctionBase< typename V::ValueType, V > Superclass;
+      typedef itk::SmartPointer< Self >                     Pointer;
+      typedef itk::SmartPointer< const Self >               ConstPointer;
+
+      typedef V                     TVector;
+      typedef typename V::ValueType TScalar;
+
+      typedef
+      itk::Matrix< TScalar, TVector::Dimension, TVector::Dimension >
+      TFrame;
+      typedef std::vector< TVector > TVectorsContainer;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( BezierCurveFunction, itkFunctionBase );
+
+    public:
+      virtual void AddPoint( const TVector& v );
+      virtual unsigned int GetNumberOfPoints( ) const;
+
+      virtual TVector Evaluate( const TScalar& u ) const;
+      virtual TFrame EvaluateFrenetFrame( const TScalar& u ) const;
+      virtual TScalar EvaluateLength( ) const;
+
+    protected:
+      BezierCurveFunction( );
+      virtual ~BezierCurveFunction( ) { }
+
+      void _UpdateDerivative( ) const;
+
+    private:
+      // Purposely not implemented
+      BezierCurveFunction( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      TVectorsContainer m_Vectors;
+      mutable Pointer   m_Derivative;
+      mutable bool      m_DerivativeUpdated;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index a120a463211d230d55f74f4a8f22170b3377ecac..2c4f5b669d869fba67c971056f7c4408be8a1160 100644 (file)
@@ -9,69 +9,69 @@
 #include <itkImageFunction.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class G >
+    class GradientFunctionBase
+      : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType >
     {
-      /**
-       */
-      template< class G >
-      class GradientFunctionBase
-        : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType >
-      {
-      public:
-        // Types from input arguments
-        typedef G                           TGradient;
-        typedef typename G::PixelType       TVector;
-        typedef typename TVector::ValueType TScalar;
-        itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension );
-
-        // Standard itk types
-        typedef GradientFunctionBase                      Self;
-        typedef itk::ImageFunction< G, TScalar, TScalar > Superclass;
-        typedef itk::SmartPointer< Self >                 Pointer;
-        typedef itk::SmartPointer< const Self >           ConstPointer;
-
-        // Types from base itk::ImageFunction
-        typedef typename Superclass::InputType           TInput;
-        typedef typename Superclass::OutputType          TOutput;
-        typedef typename Superclass::PointType           TPoint;
-        typedef typename Superclass::ContinuousIndexType TContIndex;
-        typedef typename Superclass::IndexType           TIndex;
-
-        // Sparse buffer
-        typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
-
-      public:
-        itkTypeMacro( GradientFunctionBase, itkImageFunction );
-
-        itkBooleanMacro( BufferResults );
-        itkGetConstMacro( BufferResults, bool );
-        itkSetMacro( BufferResults, bool );
-
-      public:
-        virtual void ResetBuffer( );
-
-        virtual TOutput Evaluate( const TPoint& p ) const;
-        virtual TOutput EvaluateAtIndex( const TIndex& i ) const;
-        virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const;
-
-      protected:
-        GradientFunctionBase( );
-        virtual ~GradientFunctionBase( );
-
-        virtual TOutput _Evaluate( const TIndex& i ) const = 0;
-
-      private:
-        // Purposely not implemented.
-        GradientFunctionBase( const Self& );
-        void operator=( const Self& );
-
-      protected:
-        mutable TBuffer m_Buffer;
-        bool m_BufferResults;
-      };
-
-    } // ecapseman
+    public:
+      // Types from input arguments
+      typedef G                           TGradient;
+      typedef typename G::PixelType       TVector;
+      typedef typename TVector::ValueType TScalar;
+      itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension );
+
+      // Standard itk types
+      typedef GradientFunctionBase                      Self;
+      typedef itk::ImageFunction< G, TScalar, TScalar > Superclass;
+      typedef itk::SmartPointer< Self >                 Pointer;
+      typedef itk::SmartPointer< const Self >           ConstPointer;
+
+      // Types from base itk::ImageFunction
+      typedef typename Superclass::InputType           TInput;
+      typedef typename Superclass::OutputType          TOutput;
+      typedef typename Superclass::PointType           TPoint;
+      typedef typename Superclass::ContinuousIndexType TContIndex;
+      typedef typename Superclass::IndexType           TIndex;
+
+      // Sparse buffer
+      typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
+
+    public:
+      itkTypeMacro( GradientFunctionBase, itkImageFunction );
+
+      itkBooleanMacro( BufferResults );
+      itkGetConstMacro( BufferResults, bool );
+      itkSetMacro( BufferResults, bool );
+
+    public:
+      virtual void ResetBuffer( );
+
+      virtual TOutput Evaluate( const TPoint& p ) const;
+      virtual TOutput EvaluateAtIndex( const TIndex& i ) const;
+      virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const;
+
+    protected:
+      GradientFunctionBase( );
+      virtual ~GradientFunctionBase( );
+
+      virtual TOutput _Evaluate( const TIndex& i ) const = 0;
+
+    private:
+      // Purposely not implemented.
+      GradientFunctionBase( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      mutable TBuffer m_Buffer;
+      bool m_BufferResults;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 7ecdce9a6aa1455196c9c74fcdeea230f53d762a..27c1c7ecab644dc1cea7fa10d055a91d195db838 100644 (file)
@@ -9,70 +9,70 @@
 #include <cpExtensions/Algorithms/GradientFunctionBase.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class G >
+    class GulsunTekMedialness
+      : public GradientFunctionBase< G >
     {
-      /**
-       */
-      template< class G >
-      class GulsunTekMedialness
-        : public GradientFunctionBase< G >
-      {
-      public:
-        // Standard itk types
-        typedef GulsunTekMedialness             Self;
-        typedef GradientFunctionBase< G >       Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        // Types from superclass
-        typedef typename Superclass::TGradient  TGradient;
-        typedef typename Superclass::TVector    TVector;
-        typedef typename Superclass::TScalar    TScalar;
-        typedef typename Superclass::TInput     TInput;
-        typedef typename Superclass::TOutput    TOutput;
-        typedef typename Superclass::TPoint     TPoint;
-        typedef typename Superclass::TContIndex TContIndex;
-        typedef typename Superclass::TIndex     TIndex;
-        typedef typename Superclass::TBuffer    TBuffer;
-
-        typedef typename TIndex::OffsetType TOffset;
-        typedef std::vector< double >       TProfile;
-        typedef std::vector< TOffset >      TOffsets;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( GulsunTekMedialness, GradientFunctionBase );
-
-        itkGetConstMacro( MinRadius, double );
-        itkGetConstMacro( MaxRadius, double );
-        itkGetConstMacro( ProfileSampling, unsigned int );
-        itkGetConstMacro( RadialSampling, unsigned int );
-
-        itkSetMacro( MinRadius, double );
-        itkSetMacro( MaxRadius, double );
-        itkSetMacro( ProfileSampling, unsigned int );
-        itkSetMacro( RadialSampling, unsigned int );
-
-      protected:
-        GulsunTekMedialness( );
-        virtual ~GulsunTekMedialness( );
-
-        virtual TOutput _Evaluate( const TIndex& i ) const;
-
-      private:
-        // Purposely not implemented.
-        GulsunTekMedialness( const Self& );
-        void operator=( const Self& );
-
-      protected:
-        double       m_MinRadius;
-        double       m_MaxRadius;
-        unsigned int m_ProfileSampling;
-        unsigned int m_RadialSampling;
-      };
-
-    } // ecapseman
+    public:
+      // Standard itk types
+      typedef GulsunTekMedialness             Self;
+      typedef GradientFunctionBase< G >       Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      // Types from superclass
+      typedef typename Superclass::TGradient  TGradient;
+      typedef typename Superclass::TVector    TVector;
+      typedef typename Superclass::TScalar    TScalar;
+      typedef typename Superclass::TInput     TInput;
+      typedef typename Superclass::TOutput    TOutput;
+      typedef typename Superclass::TPoint     TPoint;
+      typedef typename Superclass::TContIndex TContIndex;
+      typedef typename Superclass::TIndex     TIndex;
+      typedef typename Superclass::TBuffer    TBuffer;
+
+      typedef typename TIndex::OffsetType TOffset;
+      typedef std::vector< double >       TProfile;
+      typedef std::vector< TOffset >      TOffsets;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( GulsunTekMedialness, GradientFunctionBase );
+
+      itkGetConstMacro( MinRadius, double );
+      itkGetConstMacro( MaxRadius, double );
+      itkGetConstMacro( ProfileSampling, unsigned int );
+      itkGetConstMacro( RadialSampling, unsigned int );
+
+      itkSetMacro( MinRadius, double );
+      itkSetMacro( MaxRadius, double );
+      itkSetMacro( ProfileSampling, unsigned int );
+      itkSetMacro( RadialSampling, unsigned int );
+
+    protected:
+      GulsunTekMedialness( );
+      virtual ~GulsunTekMedialness( );
+
+      virtual TOutput _Evaluate( const TIndex& i ) const;
+
+    private:
+      // Purposely not implemented.
+      GulsunTekMedialness( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      double       m_MinRadius;
+      double       m_MaxRadius;
+      unsigned int m_ProfileSampling;
+      unsigned int m_RadialSampling;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index d4d4556cadcab2da40ba6ebae0534cc91086c9a0..01a278bb444569a0bfd436de305d43e9e0a61287 100644 (file)
@@ -73,33 +73,33 @@ _Evaluate( const TIndex& i ) const
           gradient->TransformIndexToPhysicalPoint( neighbor, neighbor_P );
           if( double( i_P.EuclideanDistanceTo( neighbor_P ) ) > this->m_MaxRadius )
             continue;
-          
+
           // Normalize offset in terms of a l1 (manhattan) distance
           TOffset offset = neighbor - i;
           // std::cout << "Offset: " << offset << std::endl;
 
           /*
-          int max_off = 0;
-          for( unsigned int o = 0; o < Self::Dimension; ++o )
+            int max_off = 0;
+            for( unsigned int o = 0; o < Self::Dimension; ++o )
             max_off += std::abs( offset[ o ] );
-          if( max_off == 0 )
+            if( max_off == 0 )
             continue;
-          bool normalized = true;
-          TOffset normalized_offset;
-          for( unsigned int o = 0; o < Self::Dimension && normalized; ++o )
-          {
+            bool normalized = true;
+            TOffset normalized_offset;
+            for( unsigned int o = 0; o < Self::Dimension && normalized; ++o )
+            {
             if( offset[ o ] % max_off == 0 )
-              normalized_offset[ o ] = offset[ o ] / max_off;
+            normalized_offset[ o ] = offset[ o ] / max_off;
             else
-              normalized = false;
+            normalized = false;
 
-          } // rof
-          if( !normalized )
+            } // rof
+            if( !normalized )
             normalized_offset = offset;
-          std::cout << "offset: " << normalized_offset << std::endl;
+            std::cout << "offset: " << normalized_offset << std::endl;
 
-          // Update profiles
-          profiles[ normalized_offset ].push_back( neighbor );
+            // Update profiles
+            profiles[ normalized_offset ].push_back( neighbor );
           */
 
           // Update queue
index c025bcb30837580abecb12ddb8e7f18273ffa272..9c0e76d3fbaec6d29d21bbdd8fd2614ca4f2f213 100644 (file)
 #include <itkProgressReporter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I, class O, class F >
+    class ImageFunctionFilter
+      : public itk::ImageToImageFilter< I, O >
     {
-      /**
-       */
-      template< class I, class O, class F >
-      class ImageFunctionFilter
-        : public itk::ImageToImageFilter< I, O >
-      {
-      public:
-        typedef ImageFunctionFilter             Self;
-        typedef itk::ImageToImageFilter< I, O > Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef I TInputImage;
-        typedef O TOutputImage;
-        typedef F TFunction;
-
-        typedef typename O::RegionType TRegion;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( ImageFunctionFilter, itkImageToImageFilter );
-
-        itkGetObjectMacro( Function, F );
-        itkSetObjectMacro( Function, F );
-
-      protected:
-        ImageFunctionFilter( )
-          : Superclass( )
+    public:
+      typedef ImageFunctionFilter             Self;
+      typedef itk::ImageToImageFilter< I, O > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TInputImage;
+      typedef O TOutputImage;
+      typedef F TFunction;
+
+      typedef typename O::RegionType TRegion;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( ImageFunctionFilter, itkImageToImageFilter );
+
+      itkGetObjectMacro( Function, F );
+      itkSetObjectMacro( Function, F );
+
+    protected:
+      ImageFunctionFilter( )
+        : Superclass( )
+        {
+        }
+      virtual ~ImageFunctionFilter( )
+        {
+        }
+
+      virtual void ThreadedGenerateData(
+        const TRegion& region,
+        itk::ThreadIdType threadId
+        )
+        {
+          const typename TRegion::SizeType& regionSize = region.GetSize( );
+          if( regionSize[ 0 ] == 0 )
+            return;
+          const I* in = this->GetInput( );
+          O* out = this->GetOutput( 0 );
+
+          const size_t nLines = region.GetNumberOfPixels( ) / regionSize[ 0 ];
+          itk::ProgressReporter progress( this, threadId, nLines );
+
+          // Define the iterators
+          itk::ImageScanlineConstIterator< I > inIt( in, region );
+          itk::ImageScanlineIterator< O > outIt( out, region );
+
+          inIt.GoToBegin( );
+          outIt.GoToBegin( );
+          while( !inIt.IsAtEnd( ) )
           {
-          }
-        virtual ~ImageFunctionFilter( )
-          {
-          }
-
-        virtual void ThreadedGenerateData(
-          const TRegion& region,
-          itk::ThreadIdType threadId
-          )
-          {
-            const typename TRegion::SizeType& regionSize = region.GetSize( );
-            if( regionSize[ 0 ] == 0 )
-              return;
-            const I* in = this->GetInput( );
-            O* out = this->GetOutput( 0 );
-
-            const size_t nLines = region.GetNumberOfPixels( ) / regionSize[ 0 ];
-            itk::ProgressReporter progress( this, threadId, nLines );
-
-            // Define the iterators
-            itk::ImageScanlineConstIterator< I > inIt( in, region );
-            itk::ImageScanlineIterator< O > outIt( out, region );
-
-            inIt.GoToBegin( );
-            outIt.GoToBegin( );
-            while( !inIt.IsAtEnd( ) )
+            while( !inIt.IsAtEndOfLine( ) )
             {
-              while( !inIt.IsAtEndOfLine( ) )
-              {
-                outIt.Set( this->m_Function->EvaluateAtIndex( inIt.GetIndex( ) ) );
-                ++inIt;
-                ++outIt;
-
-              } // elihw
-              inIt.NextLine( );
-              outIt.NextLine( );
-              progress.CompletedPixel( );
+              outIt.Set( this->m_Function->EvaluateAtIndex( inIt.GetIndex( ) ) );
+              ++inIt;
+              ++outIt;
 
             } // elihw
-          }
+            inIt.NextLine( );
+            outIt.NextLine( );
+            progress.CompletedPixel( );
+
+          } // elihw
+        }
 
-      private:
-        // Purposely not implemented.
-        ImageFunctionFilter( const Self& );
-        void operator=( const Self& );
+    private:
+      // Purposely not implemented.
+      ImageFunctionFilter( const Self& );
+      void operator=( const Self& );
 
-      protected:
-        typename F::Pointer m_Function;
-      };
+    protected:
+      typename F::Pointer m_Function;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 782526f3998265f84c23c85bba98c26e4acd9f20..d8a7ecac73ebebf40e0d1ffe9d8a09202fc82005 100644 (file)
 #include <itkProgressReporter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I, class O, class F >
+    class ImageFunctorFilter
+      : public itk::ImageToImageFilter< I, O >
     {
-      /**
-       */
-      template< class I, class O, class F >
-      class ImageFunctorFilter
-        : public itk::ImageToImageFilter< I, O >
-      {
-      public:
-        typedef ImageFunctorFilter             Self;
-        typedef itk::ImageToImageFilter< I, O > Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef I TInputImage;
-        typedef O TOutputImage;
-        typedef F TFunctor;
-
-        typedef typename O::RegionType TRegion;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( ImageFunctorFilter, itkImageToImageFilter );
-
-        itkGetMacro( Functor, F );
-        itkGetConstMacro( Functor, F );
-
-      protected:
-        ImageFunctorFilter( )
-          : Superclass( )
+    public:
+      typedef ImageFunctorFilter             Self;
+      typedef itk::ImageToImageFilter< I, O > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TInputImage;
+      typedef O TOutputImage;
+      typedef F TFunctor;
+
+      typedef typename O::RegionType TRegion;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( ImageFunctorFilter, itkImageToImageFilter );
+
+      itkGetMacro( Functor, F );
+      itkGetConstMacro( Functor, F );
+
+    protected:
+      ImageFunctorFilter( )
+        : Superclass( )
+        {
+        }
+      virtual ~ImageFunctorFilter( )
+        {
+        }
+
+      virtual void ThreadedGenerateData(
+        const TRegion& region,
+        itk::ThreadIdType threadId
+        )
+        {
+          const typename TRegion::SizeType& regionSize = region.GetSize( );
+          if( regionSize[ 0 ] == 0 )
+            return;
+          const I* in = this->GetInput( );
+          O* out = this->GetOutput( 0 );
+
+          const size_t nLines = region.GetNumberOfPixels( ) / regionSize[ 0 ];
+          itk::ProgressReporter progress( this, threadId, nLines );
+
+          // Define the iterators
+          itk::ImageScanlineConstIterator< I > inIt( in, region );
+          itk::ImageScanlineIterator< O > outIt( out, region );
+
+          inIt.GoToBegin( );
+          outIt.GoToBegin( );
+          while( !inIt.IsAtEnd( ) )
           {
-          }
-        virtual ~ImageFunctorFilter( )
-          {
-          }
-
-        virtual void ThreadedGenerateData(
-          const TRegion& region,
-          itk::ThreadIdType threadId
-          )
-          {
-            const typename TRegion::SizeType& regionSize = region.GetSize( );
-            if( regionSize[ 0 ] == 0 )
-              return;
-            const I* in = this->GetInput( );
-            O* out = this->GetOutput( 0 );
-
-            const size_t nLines = region.GetNumberOfPixels( ) / regionSize[ 0 ];
-            itk::ProgressReporter progress( this, threadId, nLines );
-
-            // Define the iterators
-            itk::ImageScanlineConstIterator< I > inIt( in, region );
-            itk::ImageScanlineIterator< O > outIt( out, region );
-
-            inIt.GoToBegin( );
-            outIt.GoToBegin( );
-            while( !inIt.IsAtEnd( ) )
+            while( !inIt.IsAtEndOfLine( ) )
             {
-              while( !inIt.IsAtEndOfLine( ) )
-              {
-                outIt.Set( this->m_Functor( inIt.Get( ) ) );
-                ++inIt;
-                ++outIt;
-
-              } // elihw
-              inIt.NextLine( );
-              outIt.NextLine( );
-              progress.CompletedPixel( );
+              outIt.Set( this->m_Functor( inIt.Get( ) ) );
+              ++inIt;
+              ++outIt;
 
             } // elihw
-          }
+            inIt.NextLine( );
+            outIt.NextLine( );
+            progress.CompletedPixel( );
+
+          } // elihw
+        }
 
-      private:
-        // Purposely not implemented.
-        ImageFunctorFilter( const Self& );
-        void operator=( const Self& );
+    private:
+      // Purposely not implemented.
+      ImageFunctorFilter( const Self& );
+      void operator=( const Self& );
 
-      protected:
-        F m_Functor;
-      };
+    protected:
+      F m_Functor;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 1190d5637a84e3aaa052dda243fc481814ee930b..e9ad2a962698e5cf8f82366007c4cbec8a3588a5 100644 (file)
 #include <itkImageRegionConstIteratorWithIndex.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I, class S = float >
+    class InertiaMedialness
+      : public itk::ImageFunction< I, S, S >
     {
-      /**
-       */
-      template< class I, class S = float >
-      class InertiaMedialness
-        : public itk::ImageFunction< I, S, S >
-      {
-      public:
-        // Standard itk types
-        typedef InertiaMedialness               Self;
-        typedef itk::ImageFunction< I, S, S >   Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        // Types from base itk::ImageFunction
-        typedef typename Superclass::InputType           TInput;
-        typedef typename Superclass::OutputType          TOutput;
-        typedef typename Superclass::PointType           TPoint;
-        typedef typename Superclass::ContinuousIndexType TContIndex;
-        typedef typename Superclass::IndexType           TIndex;
-        typedef typename TIndex::OffsetType              TOffset;
-
-        // Sparse buffer
-        typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
-
-        typedef InertiaTensorFunction< S, I::ImageDimension > TInertia;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( InertiaMedialness, itkImageFunction );
-
-        itkBooleanMacro( BufferResults );
-        itkGetConstMacro( BufferResults, bool );
-        itkGetConstMacro( MaxRadius, double );
-
-        itkSetMacro( BufferResults, bool );
-        itkSetMacro( MaxRadius, double );
-
-      public:
-        virtual void ResetBuffer( )
+    public:
+      // Standard itk types
+      typedef InertiaMedialness               Self;
+      typedef itk::ImageFunction< I, S, S >   Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      // Types from base itk::ImageFunction
+      typedef typename Superclass::InputType           TInput;
+      typedef typename Superclass::OutputType          TOutput;
+      typedef typename Superclass::PointType           TPoint;
+      typedef typename Superclass::ContinuousIndexType TContIndex;
+      typedef typename Superclass::IndexType           TIndex;
+      typedef typename TIndex::OffsetType              TOffset;
+
+      // Sparse buffer
+      typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
+
+      typedef InertiaTensorFunction< S, I::ImageDimension > TInertia;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( InertiaMedialness, itkImageFunction );
+
+      itkBooleanMacro( BufferResults );
+      itkGetConstMacro( BufferResults, bool );
+      itkGetConstMacro( MaxRadius, double );
+
+      itkSetMacro( BufferResults, bool );
+      itkSetMacro( MaxRadius, double );
+
+    public:
+      virtual void ResetBuffer( )
+        {
+          this->m_Buffer.clear( );
+        }
+
+      virtual TOutput Evaluate( const TPoint& p ) const
+        {
+          TIndex i;
+          this->GetInputImage( )->TransformPhysicalPointToIndex( p, i );
+          return( this->EvaluateAtIndex( i ) );
+        }
+
+      virtual TOutput EvaluateAtIndex( const TIndex& i ) const
+        {
+          TOutput res = TOutput( 0 );
+          bool computed = false;
+          if( this->m_BufferResults )
           {
-            this->m_Buffer.clear( );
-          }
-
-        virtual TOutput Evaluate( const TPoint& p ) const
+            typename TBuffer::const_iterator bIt = this->m_Buffer.find( i );
+            computed = ( bIt != this->m_Buffer.end( ) );
+            res = ( computed )? bIt->second: res;
+
+          } // fi
+
+          if( !computed )
+            res = this->_Evaluate( i );
+
+          if( this->m_BufferResults )
+            this->m_Buffer[ i ] = res;
+          return( res );
+        }
+
+      virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const
+        {
+          TPoint p;
+          this->GetInputImage( )->TransformContinuousIndexToPhysicalPoint( i, p );
+          return( this->Evaluate( p ) );
+        }
+
+    protected:
+      InertiaMedialness( )
+        : Superclass( ),
+          m_BufferResults( false ),
+          m_MaxRadius( double( 1 ) )
+        {
+          this->m_Buffer.clear( );
+        }
+
+      virtual ~InertiaMedialness( )
+        {
+          this->m_Buffer.clear( );
+        }
+
+      virtual TOutput _Evaluate( const TIndex& idx ) const
+        {
+          const I* image = this->GetInputImage( );
+
+          typename I::PointType p_i;
+          image->TransformIndexToPhysicalPoint( idx, p_i );
+
+          typename I::PointType max_p, min_p;
+          for( unsigned int d = 0; d < I::ImageDimension; ++d )
           {
-            TIndex i;
-            this->GetInputImage( )->TransformPhysicalPointToIndex( p, i );
-            return( this->EvaluateAtIndex( i ) );
-          }
-
-        virtual TOutput EvaluateAtIndex( const TIndex& i ) const
+            max_p[ d ] = p_i[ d ] + this->m_MaxRadius;
+            min_p[ d ] = p_i[ d ] - this->m_MaxRadius;
+
+          } // rof
+          TIndex max_i, min_i;
+          image->TransformPhysicalPointToIndex( max_p, max_i );
+          image->TransformPhysicalPointToIndex( min_p, min_i );
+
+          typename I::RegionType in_region = image->GetRequestedRegion( );
+          TIndex in_index = in_region.GetIndex( );
+          TIndex in_last = in_index + in_region.GetSize( );
+          typename I::SizeType size;
+          for( unsigned int d = 0; d < I::ImageDimension; ++d )
           {
-            TOutput res = TOutput( 0 );
-            bool computed = false;
-            if( this->m_BufferResults )
-            {
-              typename TBuffer::const_iterator bIt = this->m_Buffer.find( i );
-              computed = ( bIt != this->m_Buffer.end( ) );
-              res = ( computed )? bIt->second: res;
+            if( min_i[ d ] < in_index[ d ] ) min_i[ d ] = in_index[ d ];
+            if( max_i[ d ] < in_index[ d ] ) max_i[ d ] = in_index[ d ];
+            if( min_i[ d ] >= in_last[ d ] ) min_i[ d ] = in_last[ d ];
+            if( max_i[ d ] >= in_last[ d ] ) max_i[ d ] = in_last[ d ];
 
-            } // fi
+            size[ d ] = max_i[ d ] - min_i[ d ];
 
-            if( !computed )
-              res = this->_Evaluate( i );
+          } // rof
 
-            if( this->m_BufferResults )
-              this->m_Buffer[ i ] = res;
-            return( res );
-          }
+          typename I::RegionType region;
+          region.SetIndex( min_i );
+          region.SetSize( size );
 
-        virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const
+          std::vector< typename TInertia::Pointer > inertias;
+          itk::ImageRegionConstIteratorWithIndex< I > it( image, region );
+          for( it.GoToBegin( ); !it.IsAtEnd( ); ++it )
           {
-            TPoint p;
-            this->GetInputImage( )->TransformContinuousIndexToPhysicalPoint( i, p );
-            return( this->Evaluate( p ) );
-          }
+            TOffset off = it.GetIndex( ) - idx;
+            unsigned long l1dist = std::abs( off[ 0 ] );
+            for( unsigned int d = 1; d < I::ImageDimension; ++d )
+              l1dist = ( std::abs( off[ d ] ) > l1dist )? std::abs( off[ d ] ): l1dist;
 
-      protected:
-        InertiaMedialness( )
-          : Superclass( ),
-            m_BufferResults( false ),
-            m_MaxRadius( double( 1 ) )
-          {
-            this->m_Buffer.clear( );
-          }
+            typename TInertia::TPoint i_pnt;
+            image->TransformIndexToPhysicalPoint( it.GetIndex( ), i_pnt );
 
-        virtual ~InertiaMedialness( )
-          {
-            this->m_Buffer.clear( );
-          }
-
-        virtual TOutput _Evaluate( const TIndex& idx ) const
-          {
-            const I* image = this->GetInputImage( );
-
-            typename I::PointType p_i;
-            image->TransformIndexToPhysicalPoint( idx, p_i );
-
-            typename I::PointType max_p, min_p;
-            for( unsigned int d = 0; d < I::ImageDimension; ++d )
+            for( unsigned long l = 0; l < l1dist; ++l )
             {
-              max_p[ d ] = p_i[ d ] + this->m_MaxRadius;
-              min_p[ d ] = p_i[ d ] - this->m_MaxRadius;
+              if( inertias.size( ) <= l )
+                inertias.push_back( TInertia::New( ) );
+              inertias[ l ]->AddMass( i_pnt.GetVectorFromOrigin( ), S( it.Get( ) ) );
+
+              /* TODO
+                 typename TInertias::iterator inIt = inertias.find( l );
+                 if( inIt == inertias.end( ) )
+                 inIt = inertias.insert( std::pair< unsigned long, typename TInertia::Pointer >( l, TInertia::New( ) ) ).first;
+              */
 
             } // rof
-            TIndex max_i, min_i;
-            image->TransformPhysicalPointToIndex( max_p, max_i );
-            image->TransformPhysicalPointToIndex( min_p, min_i );
-
-            typename I::RegionType in_region = image->GetRequestedRegion( );
-            TIndex in_index = in_region.GetIndex( );
-            TIndex in_last = in_index + in_region.GetSize( );
-            typename I::SizeType size;
-            for( unsigned int d = 0; d < I::ImageDimension; ++d )
-            {
-              if( min_i[ d ] < in_index[ d ] ) min_i[ d ] = in_index[ d ];
-              if( max_i[ d ] < in_index[ d ] ) max_i[ d ] = in_index[ d ];
-              if( min_i[ d ] >= in_last[ d ] ) min_i[ d ] = in_last[ d ];
-              if( max_i[ d ] >= in_last[ d ] ) max_i[ d ] = in_last[ d ];
 
-              size[ d ] = max_i[ d ] - min_i[ d ];
+          } // rof
 
-            } // rof
-            
-            typename I::RegionType region;
-            region.SetIndex( min_i );
-            region.SetSize( size );
-
-            std::vector< typename TInertia::Pointer > inertias;
-            itk::ImageRegionConstIteratorWithIndex< I > it( image, region );
-            for( it.GoToBegin( ); !it.IsAtEnd( ); ++it )
+          if( inertias.size( ) > 0 )
+          {
+            S res = S( 0 );
+            for( unsigned int l = 0; l < inertias.size( ); ++l )
             {
-              TOffset off = it.GetIndex( ) - idx;
-              unsigned long l1dist = std::abs( off[ 0 ] );
-              for( unsigned int d = 1; d < I::ImageDimension; ++d )
-                l1dist = ( std::abs( off[ d ] ) > l1dist )? std::abs( off[ d ] ): l1dist;
-
-              typename TInertia::TPoint i_pnt;
-              image->TransformIndexToPhysicalPoint( it.GetIndex( ), i_pnt );
-
-              for( unsigned long l = 0; l < l1dist; ++l )
-              {
-                if( inertias.size( ) <= l )
-                  inertias.push_back( TInertia::New( ) );
-                inertias[ l ]->AddMass( i_pnt.GetVectorFromOrigin( ), S( it.Get( ) ) );
-                
-                /* TODO
-                   typename TInertias::iterator inIt = inertias.find( l );
-                   if( inIt == inertias.end( ) )
-                   inIt = inertias.insert( std::pair< unsigned long, typename TInertia::Pointer >( l, TInertia::New( ) ) ).first;
-                */
-
-              } // rof
+              typename TInertia::TVector pv, r;
+              typename TInertia::TMatrix pm;
+              inertias[ l ]->GetEigenAnalysis( pm, pv, r );
+              S v = pv.GetNorm( );
+              if( l == 0 || v > res )
+                res = v;
 
             } // rof
-
-            if( inertias.size( ) > 0 )
-            {
-              S res = S( 0 );
-              for( unsigned int l = 0; l < inertias.size( ); ++l )
-              {
-                typename TInertia::TVector pv, r;
-                typename TInertia::TMatrix pm;
-                inertias[ l ]->GetEigenAnalysis( pm, pv, r );
-                S v = pv.GetNorm( );
-                if( l == 0 || v > res )
-                  res = v;
-
-              } // rof
-              return( res );
-            }
-            else
-              return( TOutput( 0 ) );
+            return( res );
           }
+          else
+            return( TOutput( 0 ) );
+        }
 
-      private:
-        // Purposely not implemented.
-        InertiaMedialness( const Self& );
-        void operator=( const Self& );
+    private:
+      // Purposely not implemented.
+      InertiaMedialness( const Self& );
+      void operator=( const Self& );
 
-      protected:
-        mutable TBuffer m_Buffer;
-        bool m_BufferResults;
+    protected:
+      mutable TBuffer m_Buffer;
+      bool m_BufferResults;
 
-        double m_MaxRadius;
-      };
+      double m_MaxRadius;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 0d088d80a23d9bb780e63fb0e31ef5bb96df0b74..de097a49dccf0f4975066745cc8e8cb9b69ca98e 100644 (file)
 
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class S, unsigned int D >
+    class InertiaTensorFunction
+      : public itk::Object
     {
-      /**
-       */
-      template< class S, unsigned int D >
-      class InertiaTensorFunction
-        : public itk::Object
-      {
-      public:
-        // Standard itk types
-        typedef InertiaTensorFunction           Self;
-        typedef itk::Object                     Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef S                           TScalar;
-        typedef itk::Matrix< S, D, D >      TMatrix;
-        typedef itk::Point< S, D >          TPoint;
-        typedef typename TPoint::VectorType TVector;
-
-      protected:
-        typedef TMatrix _TInternalMatrix;
-        typedef itk::Matrix< S, D, 1 > _TInternalVector;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( InertiaTensorFunction, itkObject );
-
-      public:
-        inline void Reset( )
+    public:
+      // Standard itk types
+      typedef InertiaTensorFunction           Self;
+      typedef itk::Object                     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef S                           TScalar;
+      typedef itk::Matrix< S, D, D >      TMatrix;
+      typedef itk::Point< S, D >          TPoint;
+      typedef typename TPoint::VectorType TVector;
+
+    protected:
+      typedef TMatrix _TInternalMatrix;
+      typedef itk::Matrix< S, D, 1 > _TInternalVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( InertiaTensorFunction, itkObject );
+
+    public:
+      inline void Reset( )
+        {
+          this->m_M = S( 0 );
+          this->m_MPP = S( 0 );
+          this->m_MP.Fill( S( 0 ) );
+          this->m_MPPT.Fill( S( 0 ) );
+          this->Modified( );
+        }
+      inline void AddMass( const TPoint& pnt, const S& mass = S( 1 ) )
+        {
+          this->AddMass( pnt.GetVectorFromOrigin( ), mass );
+        }
+      inline void AddMass( const S* data, const S& mass = S( 1 ) )
+        {
+          this->AddMass( TVector( data ), mass );
+        }
+      inline void AddMass( const TVector& vec, const S& mass = S( 1 ) )
+        {
+          this->m_M += mass;
+          this->m_MPP += mass * ( vec * vec );
+
+          _TInternalVector mp;
+          for( unsigned int d = 0; d < D; ++d )
           {
-            this->m_M = S( 0 );
-            this->m_MPP = S( 0 );
-            this->m_MP.Fill( S( 0 ) );
-            this->m_MPPT.Fill( S( 0 ) );
-            this->Modified( );
-          }
-        inline void AddMass( const TPoint& pnt, const S& mass = S( 1 ) )
-          {
-            this->AddMass( pnt.GetVectorFromOrigin( ), mass );
-          }
-        inline void AddMass( const S* data, const S& mass = S( 1 ) )
+            this->m_MP[ d ][ 0 ] += mass * vec[ d ];
+            mp[ d ][ 0 ] = vec[ d ];
+
+          } // rof
+          this->m_MPPT +=
+            _TInternalMatrix( mp.GetVnlMatrix( ) * mp.GetTranspose( ) ) *
+            mass;
+        }
+
+      inline S GetMass( ) const
+        {
+          return( this->m_M );
+        }
+
+      inline TMatrix GetInertia( ) const
+        {
+          TMatrix I;
+          if( S( 0 ) < this->m_M )
           {
-            this->AddMass( TVector( data ), mass );
+            I.SetIdentity( );
+            I *= this->m_MPP - ( ( this->m_MP.GetTranspose( ) * this->m_MP.GetVnlMatrix( ) )[ 0 ][ 0 ] / this->m_M );
+            I -= this->m_MPPT;
+            I += TMatrix( this->m_MP.GetVnlMatrix( ) * this->m_MP.GetTranspose( ) ) / this->m_M;
           }
-        inline void AddMass( const TVector& vec, const S& mass = S( 1 ) )
+          else
+            I.Fill( S( 0 ) );
+          return( I );
+        }
+
+      inline TVector GetCenterOfGravity( ) const
+        {
+          TVector cog;
+          if( S( 0 ) < this->m_M )
           {
-            this->m_M += mass;
-            this->m_MPP += mass * ( vec * vec );
-
-            _TInternalVector mp;
             for( unsigned int d = 0; d < D; ++d )
-            {
-              this->m_MP[ d ][ 0 ] += mass * vec[ d ];
-              mp[ d ][ 0 ] = vec[ d ];
-
-            } // rof
-            this->m_MPPT +=
-              _TInternalMatrix( mp.GetVnlMatrix( ) * mp.GetTranspose( ) ) *
-              mass;
+              cog[ d ] = this->m_MP[ d ][ 0 ] / this->m_M;
           }
-
-        inline S GetMass( ) const
+          else
+            cog.Fill( S( 0 ) );
+          return( cog );
+        }
+
+      inline void GetEigenAnalysis( TMatrix& pm, TVector& pv, TVector& r ) const
+        {
+          TMatrix I = this->GetInertia( );
+
+          itk::SymmetricEigenAnalysis< TMatrix, TVector, TMatrix > eigen;
+          eigen.SetDimension( D );
+          eigen.SetOrderEigenMagnitudes( true );
+          eigen.SetOrderEigenValues( 1 );
+          eigen.ComputeEigenValuesAndVectors( I, pv, pm );
+          pm = TMatrix( pm.GetTranspose( ) );
+          S det = vnl_determinant( pm.GetVnlMatrix( ) );
+          for( unsigned int d = 0; d < D; ++d )
+            pm[ d ][ D - 1 ] *= det;
+
+          if( D == 2 )
           {
-            return( this->m_M );
+            S coeff = S( 4 ) / this->m_M;
+            r[ 0 ] = std::sqrt( std::fabs( coeff * pv[ 1 ] ) );
+            r[ 1 ] = std::sqrt( std::fabs( coeff * pv[ 0 ] ) );
           }
-
-        inline TMatrix GetInertia( ) const
+          else if( D == 3 )
           {
-            TMatrix I;
-            if( S( 0 ) < this->m_M )
-            {
-              I.SetIdentity( );
-              I *= this->m_MPP - ( ( this->m_MP.GetTranspose( ) * this->m_MP.GetVnlMatrix( ) )[ 0 ][ 0 ] / this->m_M );
-              I -= this->m_MPPT;
-              I += TMatrix( this->m_MP.GetVnlMatrix( ) * this->m_MP.GetTranspose( ) ) / this->m_M;
-            }
-            else
-              I.Fill( S( 0 ) );
-            return( I );
+            S coeff = S( 2.5 ) / this->m_M;
+            r[ 0 ] = std::sqrt( std::fabs( coeff * ( pv[ 1 ] + pv[ 2 ] - pv[ 0 ] ) ) );
+            r[ 1 ] = std::sqrt( std::fabs( coeff * ( pv[ 0 ] + pv[ 2 ] - pv[ 1 ] ) ) );
+            r[ 2 ] = std::sqrt( std::fabs( coeff * ( pv[ 0 ] + pv[ 1 ] - pv[ 2 ] ) ) );
           }
-
-        inline TVector GetCenterOfGravity( ) const
-          {
-            TVector cog;
-            if( S( 0 ) < this->m_M )
-            {
-              for( unsigned int d = 0; d < D; ++d )
-                cog[ d ] = this->m_MP[ d ][ 0 ] / this->m_M;
-            }
-            else
-              cog.Fill( S( 0 ) );
-            return( cog );
-          }
-
-        inline void GetEigenAnalysis( TMatrix& pm, TVector& pv, TVector& r ) const
-          {
-            TMatrix I = this->GetInertia( );
-
-            itk::SymmetricEigenAnalysis< TMatrix, TVector, TMatrix > eigen;
-            eigen.SetDimension( D );
-            eigen.SetOrderEigenMagnitudes( true );
-            eigen.SetOrderEigenValues( 1 );
-            eigen.ComputeEigenValuesAndVectors( I, pv, pm );
-            pm = TMatrix( pm.GetTranspose( ) );
-            S det = vnl_determinant( pm.GetVnlMatrix( ) );
-            for( unsigned int d = 0; d < D; ++d )
-              pm[ d ][ D - 1 ] *= det;
-
-            if( D == 2 )
-            {
-              S coeff = S( 4 ) / this->m_M;
-              r[ 0 ] = std::sqrt( std::fabs( coeff * pv[ 1 ] ) );
-              r[ 1 ] = std::sqrt( std::fabs( coeff * pv[ 0 ] ) );
-            }
-            else if( D == 3 )
-            {
-              S coeff = S( 2.5 ) / this->m_M;
-              r[ 0 ] = std::sqrt( std::fabs( coeff * ( pv[ 1 ] + pv[ 2 ] - pv[ 0 ] ) ) );
-              r[ 1 ] = std::sqrt( std::fabs( coeff * ( pv[ 0 ] + pv[ 2 ] - pv[ 1 ] ) ) );
-              r[ 2 ] = std::sqrt( std::fabs( coeff * ( pv[ 0 ] + pv[ 1 ] - pv[ 2 ] ) ) );
-            }
-            else
-              r.Fill( S( 0 ) );
-          }
-
-      protected:
-        InertiaTensorFunction( )
-          : Superclass( )
-          {
-            this->Reset( );
-          }
-        virtual ~InertiaTensorFunction( )
-          {
-          }
-
-      private:
-        // Purposely not implemented.
-        InertiaTensorFunction( const Self& );
-        void operator=( const Self& );
-
-      protected:
-        S m_M;
-        S m_MPP;
-        _TInternalVector m_MP;
-        _TInternalMatrix m_MPPT;
-      };
-
-    } // ecapseman
+          else
+            r.Fill( S( 0 ) );
+        }
+
+    protected:
+      InertiaTensorFunction( )
+        : Superclass( )
+        {
+          this->Reset( );
+        }
+      virtual ~InertiaTensorFunction( )
+        {
+        }
+
+    private:
+      // Purposely not implemented.
+      InertiaTensorFunction( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      S m_M;
+      S m_MPP;
+      _TInternalVector m_MP;
+      _TInternalMatrix m_MPPT;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 9479d343cbea49fcde8e121fa79db02fea1034ab..2582cf9f6400859366a4326c6e2d95bdcf522f68 100644 (file)
 #include <itkVectorInterpolateImageFunction.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class R, class I >
+    class BaseImageSlicer
+      : public itk::ImageToImageFilter< typename R::InputImageType, itk::Image< typename R::InputImageType::PixelType, R::ImageDimension - 1 > >
     {
-      /**
-       */
-      template< class R, class I >
-      class BaseImageSlicer
-        : public itk::ImageToImageFilter< typename R::InputImageType, itk::Image< typename R::InputImageType::PixelType, R::ImageDimension - 1 > >
+    public:
+      // Basic types
+      typedef BaseImageSlicer            Self;
+      typedef R                          TSlicer;
+      typedef I                          TInterpolateFunction;
+      typedef typename R::InputImageType TImage;
+      typedef typename I::CoordRepType   TScalar;
+      typedef typename TImage::PixelType TPixel;
+      enum
       {
-      public:
-        // Basic types
-        typedef BaseImageSlicer            Self;
-        typedef R                          TSlicer;
-        typedef I                          TInterpolateFunction;
-        typedef typename R::InputImageType TImage;
-        typedef typename I::CoordRepType   TScalar;
-        typedef typename TImage::PixelType TPixel;
-        enum
-        {
-          Dim      = TImage::ImageDimension,
-          SliceDim = TImage::ImageDimension - 1
-        };
-        typedef itk::Image< TPixel, Self::SliceDim > TSliceImage;
-
-        // itk types
-        typedef itk::ImageToImageFilter< TImage, TSliceImage > Superclass;
-        typedef itk::SmartPointer< Self >                      Pointer;
-        typedef itk::SmartPointer< const Self >                ConstPointer;
-
-        // Internal filters
-        typedef itk::ExtractImageFilter< TImage, TSliceImage > TCollapsor;
-
-        // Various types
-        typedef typename TImage::IndexType   TIndex;
-        typedef typename TImage::RegionType  TRegion;
-        typedef typename TImage::SizeType    TSize;
-        typedef typename TImage::SpacingType TSpacing;
-        typedef typename TSpacing::ValueType TSpacingValue;
-
-        typedef itk::AffineTransform< TScalar, Self::Dim > TTransform;
-        typedef typename TTransform::MatrixType            TMatrix;
-        typedef typename TTransform::OffsetType            TVector;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( BaseImageSlicer, itkImageToImageFilter );
-
-        itkBooleanMacro( SizeFromMaximum );
-        itkBooleanMacro( SizeFromMinimum );
-        itkBooleanMacro( SpacingFromMaximum );
-        itkBooleanMacro( SpacingFromMinimum );
-
-        itkGetConstObjectMacro( Transform, TTransform );
-        itkGetConstMacro( DefaultValue, TPixel );
-        itkGetConstMacro( Size, TVector );
-        itkGetConstMacro( SizeFromMaximum, bool );
-        itkGetConstMacro( SizeFromMinimum, bool );
-        itkGetConstMacro( Spacing, TSpacingValue );
-        itkGetConstMacro( SpacingFromMaximum, bool );
-        itkGetConstMacro( SpacingFromMinimum, bool );
-
-        itkSetObjectMacro( Transform, TTransform );
-        itkSetMacro( Size, TVector );
-        itkSetMacro( DefaultValue, TPixel );
-        itkSetMacro( SizeFromMaximum, bool );
-        itkSetMacro( SizeFromMinimum, bool );
-        itkSetMacro( Spacing, TSpacingValue );
-        itkSetMacro( SpacingFromMaximum, bool );
-        itkSetMacro( SpacingFromMinimum, bool );
-
-      public:
-        virtual unsigned long GetMTime( ) const;
-
-        const TInterpolateFunction* GetInterpolator( ) const;
-        const TMatrix& GetRotation( ) const;
-        const TVector& GetTranslation( ) const;
-
-        void SetInterpolator( TInterpolateFunction* f );
-
-        template< class M >
+        Dim      = TImage::ImageDimension,
+        SliceDim = TImage::ImageDimension - 1
+      };
+      typedef itk::Image< TPixel, Self::SliceDim > TSliceImage;
+
+      // itk types
+      typedef itk::ImageToImageFilter< TImage, TSliceImage > Superclass;
+      typedef itk::SmartPointer< Self >                      Pointer;
+      typedef itk::SmartPointer< const Self >                ConstPointer;
+
+      // Internal filters
+      typedef itk::ExtractImageFilter< TImage, TSliceImage > TCollapsor;
+
+      // Various types
+      typedef typename TImage::IndexType   TIndex;
+      typedef typename TImage::RegionType  TRegion;
+      typedef typename TImage::SizeType    TSize;
+      typedef typename TImage::SpacingType TSpacing;
+      typedef typename TSpacing::ValueType TSpacingValue;
+
+      typedef itk::AffineTransform< TScalar, Self::Dim > TTransform;
+      typedef typename TTransform::MatrixType            TMatrix;
+      typedef typename TTransform::OffsetType            TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( BaseImageSlicer, itkImageToImageFilter );
+
+      itkBooleanMacro( SizeFromMaximum );
+      itkBooleanMacro( SizeFromMinimum );
+      itkBooleanMacro( SpacingFromMaximum );
+      itkBooleanMacro( SpacingFromMinimum );
+
+      itkGetConstObjectMacro( Transform, TTransform );
+      itkGetConstMacro( DefaultValue, TPixel );
+      itkGetConstMacro( Size, TVector );
+      itkGetConstMacro( SizeFromMaximum, bool );
+      itkGetConstMacro( SizeFromMinimum, bool );
+      itkGetConstMacro( Spacing, TSpacingValue );
+      itkGetConstMacro( SpacingFromMaximum, bool );
+      itkGetConstMacro( SpacingFromMinimum, bool );
+
+      itkSetObjectMacro( Transform, TTransform );
+      itkSetMacro( Size, TVector );
+      itkSetMacro( DefaultValue, TPixel );
+      itkSetMacro( SizeFromMaximum, bool );
+      itkSetMacro( SizeFromMinimum, bool );
+      itkSetMacro( Spacing, TSpacingValue );
+      itkSetMacro( SpacingFromMaximum, bool );
+      itkSetMacro( SpacingFromMinimum, bool );
+
+    public:
+      virtual unsigned long GetMTime( ) const;
+
+      const TInterpolateFunction* GetInterpolator( ) const;
+      const TMatrix& GetRotation( ) const;
+      const TVector& GetTranslation( ) const;
+
+      void SetInterpolator( TInterpolateFunction* f );
+
+      template< class M >
         void SetRotation( const M& r );
 
-        template< class V >
+      template< class V >
         void SetTranslation( const V& t );
-        void SetSize( TScalar s );
+      void SetSize( TScalar s );
 
-      protected:
-        BaseImageSlicer( );
-        virtual ~BaseImageSlicer( );
+    protected:
+      BaseImageSlicer( );
+      virtual ~BaseImageSlicer( );
 
-        virtual void GenerateOutputInformation( ); // TODO { }
-        virtual void GenerateInputRequestedRegion( );
-        virtual void GenerateData( );
+      virtual void GenerateOutputInformation( ); // TODO { }
+      virtual void GenerateInputRequestedRegion( );
+      virtual void GenerateData( );
 
-      private:
-        // Purposely not implemented
-        BaseImageSlicer( const Self& );
-        void operator=( const Self& );
+    private:
+      // Purposely not implemented
+      BaseImageSlicer( const Self& );
+      void operator=( const Self& );
 
-      protected:
-        typename TSlicer::Pointer    m_Slicer;
-        typename TCollapsor::Pointer m_Collapsor;
-        typename TTransform::Pointer m_Transform;
+    protected:
+      typename TSlicer::Pointer    m_Slicer;
+      typename TCollapsor::Pointer m_Collapsor;
+      typename TTransform::Pointer m_Transform;
 
-        TPixel m_DefaultValue;
+      TPixel m_DefaultValue;
 
-        TVector m_Size;
-        bool    m_SizeFromMaximum;
-        bool    m_SizeFromMinimum;
-
-        TSpacingValue m_Spacing;
-        bool          m_SpacingFromMaximum;
-        bool          m_SpacingFromMinimum;
-      };
+      TVector m_Size;
+      bool    m_SizeFromMaximum;
+      bool    m_SizeFromMinimum;
 
-    } // ecapseman
+      TSpacingValue m_Spacing;
+      bool          m_SpacingFromMaximum;
+      bool          m_SpacingFromMinimum;
+    };
 
   } // ecapseman
 
 } // ecapseman
 
+} // ecapseman
+
 // -------------------------------------------------------------------------
 #define CPPLUGINS_DEFINE_ISOIMAGESLICER( name, R, F )                   \
   template< class I, class S = double >                                 \
@@ -177,7 +177,7 @@ namespace cpPlugins
 
     } // ecapseman
 
-} // ecapseman
+  } // ecapseman
 
 #include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
 
index aa8e6688cc177e918cc18f7cb74a1346b3be00e7..8a30510be5b937606498dfbd43b2bfbdb84958b4 100644 (file)
 #include <vnl/vnl_matrix.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class S, unsigned int D >
+    class IterativeGaussianModelEstimator
+      : public itk::Object
     {
-      /**
-       */
-      template< class S, unsigned int D >
-      class IterativeGaussianModelEstimator
-        : public itk::Object
-      {
-      public:
-        typedef IterativeGaussianModelEstimator Self;
-        typedef itk::Object                     Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef S TScalar;
-        itkStaticConstMacro( Dimension, unsigned int, D );
-
-        // Begin concept checking
+    public:
+      typedef IterativeGaussianModelEstimator Self;
+      typedef itk::Object                     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef S TScalar;
+      itkStaticConstMacro( Dimension, unsigned int, D );
+
+      // Begin concept checking
 #ifdef ITK_USE_CONCEPT_CHECKING
-        itkConceptMacro(
-          ScalarTypeHasFloatResolution,
-          ( itk::Concept::IsFloatingPoint< S > )
-          );
+      itkConceptMacro(
+        ScalarTypeHasFloatResolution,
+        ( itk::Concept::IsFloatingPoint< S > )
+        );
 #endif
-        // End concept checking
+      // End concept checking
 
-        typedef vnl_matrix< S >        TMatrix;
-        typedef std::vector< TMatrix > TMatrices;
+      typedef vnl_matrix< S >        TMatrix;
+      typedef std::vector< TMatrix > TMatrices;
 
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( IterativeGaussianModelEstimator, itkObject );
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( IterativeGaussianModelEstimator, itkObject );
 
-      public:
-        unsigned long GetNumberOfSamples( ) const
-          { return( ( unsigned long )( this->m_N ) ); }
-        const TMatrix& GetMu( ) const
-          { return( this->m_M ); }
-        const TMatrix& GetOmega( ) const
-          { return( this->m_O ); }
+    public:
+      unsigned long GetNumberOfSamples( ) const
+        { return( ( unsigned long )( this->m_N ) ); }
+      const TMatrix& GetMu( ) const
+        { return( this->m_M ); }
+      const TMatrix& GetOmega( ) const
+        { return( this->m_O ); }
 
-        void SetNumberOfSamples( unsigned long n );
-        void SetMu( const TMatrix& m );
-        void SetOmega( const TMatrix& O );
+      void SetNumberOfSamples( unsigned long n );
+      void SetMu( const TMatrix& m );
+      void SetOmega( const TMatrix& O );
 
-        bool SaveModelToFile( const std::string& filename ) const;
-        bool LoadModelFromFile( const std::string& filename );
+      bool SaveModelToFile( const std::string& filename ) const;
+      bool LoadModelFromFile( const std::string& filename );
 
-        template< class V >
-        S Probability( const V& sample ) const;
+      template< class V >
+      S Probability( const V& sample ) const;
 
-        S Probability( const S& s_x, const S& s_y, ... ) const;
+      S Probability( const S& s_x, const S& s_y, ... ) const;
 
-        template< class V, class M >
-        void GetModel( V& m, M& E ) const;
+      template< class V, class M >
+      void GetModel( V& m, M& E ) const;
 
-        void Clear( );
+      void Clear( );
 
-        template< class V >
-        void AddSample( const V& sample );
+      template< class V >
+      void AddSample( const V& sample );
 
-        void AddSample( const S& s_x, const S& s_y, ... );
+      void AddSample( const S& s_x, const S& s_y, ... );
 
-      protected:
-        IterativeGaussianModelEstimator( );
-        virtual ~IterativeGaussianModelEstimator( );
+    protected:
+      IterativeGaussianModelEstimator( );
+      virtual ~IterativeGaussianModelEstimator( );
 
-      protected:
-        void _UpdateModel( ) const;
+    protected:
+      void _UpdateModel( ) const;
 
-      private:
-        // Purposely not implemented
-        IterativeGaussianModelEstimator( const Self& other );
-        void operator=( const Self& other );
+    private:
+      // Purposely not implemented
+      IterativeGaussianModelEstimator( const Self& other );
+      void operator=( const Self& other );
 
-      protected:
-        S m_N;
-        TMatrix m_M;
-        TMatrix m_O;
+    protected:
+      S m_N;
+      TMatrix m_M;
+      TMatrix m_O;
 
-        mutable bool m_Updated;
-        mutable TMatrix m_Cov;
-        mutable TMatrix m_Inv;
-        mutable S m_Norm;
-      };
+      mutable bool m_Updated;
+      mutable TMatrix m_Cov;
+      mutable TMatrix m_Inv;
+      mutable S m_Norm;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 76fb1b464663c4700e3833be3c6435b631f2c377..e9d0192b2c6cb89a0d065ab4d422da6686f2a915 100644 (file)
@@ -8,46 +8,46 @@
 #include <cpExtensions/Algorithms/KalmanFilter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< typename T >
+    class cpExtensions_EXPORT KalmanConstantFilter
+      : public KalmanFilter< T >
     {
-      /**
-       */
-      template< typename T >
-      class cpExtensions_EXPORT KalmanConstantFilter
-        : public KalmanFilter< T >
-      {
-      public:
-        typedef KalmanConstantFilter            Self;
-        typedef KalmanFilter< T >               Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef typename Superclass::TScalar TScalar;
-        typedef typename Superclass::TMatrix TMatrix;
-        typedef typename Superclass::TVector TVector;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( KalmanConstantFilter, KalmanFilter );
-
-      public:
-        void Configure( unsigned int m );
-
-        /// Iteration methods
+    public:
+      typedef KalmanConstantFilter            Self;
+      typedef KalmanFilter< T >               Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::TScalar TScalar;
+      typedef typename Superclass::TMatrix TMatrix;
+      typedef typename Superclass::TVector TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( KalmanConstantFilter, KalmanFilter );
+
+    public:
+      void Configure( unsigned int m );
+
+      /// Iteration methods
         virtual void Initialize( );
 
-      protected:
+    protected:
         KalmanConstantFilter( );
         virtual ~KalmanConstantFilter( );
 
-      private:
+    private:
         // Purposely not implemented.
         KalmanConstantFilter( const Self& );
         void operator=( const Self& );
-      };
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index de6090f98c72353c031905547cae6f7bf8a95eab..a96c6208c116e741bfc4d7c51670459bf66fb729 100644 (file)
@@ -13,8 +13,8 @@
 #include <vnl/vnl_vector.h>
 
 // -------------------------------------------------------------------------
-#define kalmanGetSetMacro( type, name )    \
-  itkGetConstMacro( name, type );          \
+#define kalmanGetSetMacro( type, name )         \
+  itkGetConstMacro( name, type );               \
   itkSetMacro( name, type );
 
 // -------------------------------------------------------------------------
   kalmanSetVectorMacro( var, name );
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     * Abstract class implementing the classical kalman filter. See
+     * http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf
+     * for a description of this algorithm.
+     */
+    template< typename T >
+    class cpExtensions_EXPORT KalmanFilter
+      : public itk::Object
     {
-      /**
-       * Abstract class implementing the classical kalman filter. See
-       * http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf
-       * for a description of this algorithm.
-       */
-      template< typename T >
-      class cpExtensions_EXPORT KalmanFilter
-        : public itk::Object
-      {
-      public:
-        typedef KalmanFilter                    Self;
-        typedef itk::Object                     Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
+    public:
+      typedef KalmanFilter                    Self;
+      typedef itk::Object                     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
-        // Template parameters types
-        typedef T TScalar;
+      // Template parameters types
+      typedef T TScalar;
 
-        // VNL types
-        typedef vnl_matrix< TScalar > TMatrix;
-        typedef vnl_vector< TScalar > TVector;
+      // VNL types
+      typedef vnl_matrix< TScalar > TMatrix;
+      typedef vnl_vector< TScalar > TVector;
 
-        //  stage identificators
-        enum
-        {
-          StPred,
-          StInno,
-          StFilt
-        };
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( KalmanFilter, itkObject );
-
-        // Values
-        itkGetConstMacro( StateSize, unsigned int );
-        itkGetConstMacro( InputSize, unsigned int );
-        itkGetConstMacro( MeasureSize, unsigned int );
-
-        // Matrices
-        kalmanGetSetMacro( TMatrix, A );
-        kalmanGetSetMacro( TMatrix, B );
-        kalmanGetSetMacro( TMatrix, H );
-        kalmanGetSetMacro( TMatrix, Q );
-        kalmanGetSetMacro( TMatrix, R );
-        kalmanGetSetMacro( TMatrix, P0 );
-        kalmanGetSetMacro( TMatrix, K );
-        kalmanGetSetMacro( TMatrix, Pm );
-        kalmanGetSetMacro( TMatrix, Pp );
-
-        // Vectors
-        kalmanGetSetMacro( TVector, x0 );
-        kalmanGetSetMacro( TVector, u );
-        kalmanGetSetMacro( TVector, m );
-        kalmanGetSetMacro( TVector, xm );
-        kalmanGetSetMacro( TVector, xp );
-
-        // Human-readable matrices
-        kalmanGetSetMatrixMacro( A, TransitionMatrix );
-        kalmanGetSetMatrixMacro( B, InputControlMatrix );
-        kalmanGetSetMatrixMacro( H, MeasureMatrix );
-        kalmanGetSetMatrixMacro( Q, ProcessNoise );
-        kalmanGetSetMatrixMacro( R, MeasureNoise );
-        kalmanGetSetMatrixMacro( P0, InitialNoise );
-        kalmanGetSetMatrixMacro( K, Gain );
-        kalmanGetSetMatrixMacro( Pm, APrioriNoise );
-        kalmanGetSetMatrixMacro( Pp, APosterioriNoise );
-
-        // Human-readable vectors
-        kalmanGetSetVectorMacro( x0, InitialState );
-        kalmanGetSetVectorMacro( u, Input );
-        kalmanGetSetVectorMacro( m, Measure );
-        kalmanGetSetVectorMacro( xm, APrioriState );
-        kalmanGetSetVectorMacro( xp, APosterioriState );
-
-      public:
-
-        void Configure( unsigned int s, unsigned int i, unsigned int m );
-
-        /// Iteration methods
+      //  stage identificators
+      enum
+      {
+        StPred,
+        StInno,
+        StFilt
+      };
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( KalmanFilter, itkObject );
+
+      // Values
+      itkGetConstMacro( StateSize, unsigned int );
+      itkGetConstMacro( InputSize, unsigned int );
+      itkGetConstMacro( MeasureSize, unsigned int );
+
+      // Matrices
+      kalmanGetSetMacro( TMatrix, A );
+      kalmanGetSetMacro( TMatrix, B );
+      kalmanGetSetMacro( TMatrix, H );
+      kalmanGetSetMacro( TMatrix, Q );
+      kalmanGetSetMacro( TMatrix, R );
+      kalmanGetSetMacro( TMatrix, P0 );
+      kalmanGetSetMacro( TMatrix, K );
+      kalmanGetSetMacro( TMatrix, Pm );
+      kalmanGetSetMacro( TMatrix, Pp );
+
+      // Vectors
+      kalmanGetSetMacro( TVector, x0 );
+      kalmanGetSetMacro( TVector, u );
+      kalmanGetSetMacro( TVector, m );
+      kalmanGetSetMacro( TVector, xm );
+      kalmanGetSetMacro( TVector, xp );
+
+      // Human-readable matrices
+      kalmanGetSetMatrixMacro( A, TransitionMatrix );
+      kalmanGetSetMatrixMacro( B, InputControlMatrix );
+      kalmanGetSetMatrixMacro( H, MeasureMatrix );
+      kalmanGetSetMatrixMacro( Q, ProcessNoise );
+      kalmanGetSetMatrixMacro( R, MeasureNoise );
+      kalmanGetSetMatrixMacro( P0, InitialNoise );
+      kalmanGetSetMatrixMacro( K, Gain );
+      kalmanGetSetMatrixMacro( Pm, APrioriNoise );
+      kalmanGetSetMatrixMacro( Pp, APosterioriNoise );
+
+      // Human-readable vectors
+      kalmanGetSetVectorMacro( x0, InitialState );
+      kalmanGetSetVectorMacro( u, Input );
+      kalmanGetSetVectorMacro( m, Measure );
+      kalmanGetSetVectorMacro( xm, APrioriState );
+      kalmanGetSetVectorMacro( xp, APosterioriState );
+
+    public:
+
+      void Configure( unsigned int s, unsigned int i, unsigned int m );
+
+      /// Iteration methods
         virtual void Initialize( );
         virtual void Predict( );
         virtual void Innovate( );
         virtual void Filtrate( );
         virtual void OneStep( )
-          {
-            this->Predict( );
-            this->Innovate( );
-            this->Filtrate( );
-          }
+        {
+          this->Predict( );
+          this->Innovate( );
+          this->Filtrate( );
+        }
         virtual void NSteps( unsigned int n )
-          {
-            for( unsigned int i = 0; i < n; i++ )
-              this->OneStep( );
-          }
+        {
+          for( unsigned int i = 0; i < n; i++ )
+            this->OneStep( );
+        }
         unsigned int CurrentIteration( ) const
-          { return( this->m_I ); }
+        { return( this->m_I ); }
         unsigned char CurrentStep( ) const
-          { return( this->m_Step ); }
+        { return( this->m_Step ); }
 
-      protected:
+    protected:
         KalmanFilter( );
         virtual ~KalmanFilter( );
 
-      private:
+    private:
         // Purposely not implemented
         KalmanFilter( const Self& );
         void operator=( const Self& );
 
-      protected:
+    protected:
         // Filter dimensions
         unsigned int m_StateSize;
         unsigned int m_InputSize;
@@ -168,41 +168,41 @@ namespace cpExtensions
 
         // Transition matrices
         TMatrix m_A;  /// Transition
-        TMatrix m_B;  /// Input control
-        TMatrix m_H;  /// Measure
-        TMatrix m_Id; /// Identity matrix
-
-        // Noise matrices
-        TMatrix m_Q; /// Process noise covariance
-        TMatrix m_R; /// Measure noise covariance
-
-        // Initial values
-        TVector m_x0; /// Initial state
-        TMatrix m_P0; /// Initial error covariance
-
-        // Loop vectors
-        TVector m_u;  /// Last real input
-        TVector m_m;  /// Last real measure
-        TVector m_xm; /// A priori state
-        TVector m_xp; /// A posteriori state
-
-        // Loop matrices
-        TMatrix m_K; /// kalman gain
-        TMatrix m_Pm; /// A priori error
-        TMatrix m_Pp; /// A posteriori error
-
-        // Loop values
-        unsigned int  m_I;    /// Current iteration
-        unsigned char m_Step; /// Current step within current iteration
-
-        // -----------------------------------------------------------------
-        // Classic kronecker product operator
-        // -----------------------------------------------------------------
-        template< class M >
-        static void Kronecker( M& AkB, const M& A, const M& B );
-      };
-
-    } // ecapseman
+          TMatrix m_B;  /// Input control
+            TMatrix m_H;  /// Measure
+              TMatrix m_Id; /// Identity matrix
+
+                // Noise matrices
+                TMatrix m_Q; /// Process noise covariance
+                  TMatrix m_R; /// Measure noise covariance
+
+                    // Initial values
+                    TVector m_x0; /// Initial state
+                      TMatrix m_P0; /// Initial error covariance
+
+                        // Loop vectors
+                        TVector m_u;  /// Last real input
+                          TVector m_m;  /// Last real measure
+                            TVector m_xm; /// A priori state
+                              TVector m_xp; /// A posteriori state
+
+                                // Loop matrices
+                                TMatrix m_K; /// kalman gain
+                                  TMatrix m_Pm; /// A priori error
+                                    TMatrix m_Pp; /// A posteriori error
+
+                                      // Loop values
+                                      unsigned int  m_I;    /// Current iteration
+                                        unsigned char m_Step; /// Current step within current iteration
+
+                                          // -----------------------------------------------------------------
+                                          // Classic kronecker product operator
+                                          // -----------------------------------------------------------------
+                                          template< class M >
+                                            static void Kronecker( M& AkB, const M& A, const M& B );
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 5dd3f56d3d2ee6951454eb9562e07aa573d89966..20554200c6327f40382b9517b4d6ac66edbdbced 100644 (file)
@@ -8,56 +8,56 @@
 #include <cpExtensions/Algorithms/KalmanFilter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< typename T >
+    class cpExtensions_EXPORT KalmanVelocityFilter
+      : public KalmanFilter< T >
     {
-      /**
-       */
-      template< typename T >
-      class cpExtensions_EXPORT KalmanVelocityFilter
-        : public KalmanFilter< T >
-      {
-      public:
-        typedef KalmanVelocityFilter            Self;
-        typedef KalmanFilter< T >               Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef typename Superclass::TScalar TScalar;
-        typedef typename Superclass::TMatrix TMatrix;
-        typedef typename Superclass::TVector TVector;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( KalmanVelocityFilter, KalmanFilter );
-
-        kalmanGetSetMacro( TMatrix, Sigma );
-        kalmanGetSetMatrixMacro( Sigma, AccelerationNoise );
-
-      public:
-        void Configure( unsigned int m );
-
-        TScalar GetTimeOffset( ) const;
-        void SetTimeOffset( TScalar t );
-
-        /// Iteration methods
+    public:
+      typedef KalmanVelocityFilter            Self;
+      typedef KalmanFilter< T >               Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::TScalar TScalar;
+      typedef typename Superclass::TMatrix TMatrix;
+      typedef typename Superclass::TVector TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( KalmanVelocityFilter, KalmanFilter );
+
+      kalmanGetSetMacro( TMatrix, Sigma );
+      kalmanGetSetMatrixMacro( Sigma, AccelerationNoise );
+
+    public:
+      void Configure( unsigned int m );
+
+      TScalar GetTimeOffset( ) const;
+      void SetTimeOffset( TScalar t );
+
+      /// Iteration methods
         virtual void Initialize( );
 
-      protected:
+    protected:
         KalmanVelocityFilter( );
         virtual ~KalmanVelocityFilter( );
 
-      private:
+    private:
         // Purposely not implemented.
         KalmanVelocityFilter( const Self& );
         void operator=( const Self& );
 
-      protected:
+    protected:
         TMatrix m_TimeOffset;
         TMatrix m_Sigma;
-      };
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 36f8da583948371d6c29383f9cf7920e40137000..d219c7ddd7a627d4f3a7dc97b3d223938978d2dd 100644 (file)
@@ -9,48 +9,48 @@
 #include <cpExtensions/Algorithms/ParallelImageMean.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I >
+    class LightCompensationFilter
+      : public itk::InPlaceImageFilter< I, I >
     {
-      /**
-       */
-      template< class I >
-      class LightCompensationFilter
-        : public itk::InPlaceImageFilter< I, I >
-      {
-      public:
-        typedef LightCompensationFilter         Self;
-        typedef itk::InPlaceImageFilter< I, I > Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef I TImage;
-        typedef typename I::RegionType TRegion;
-
-        typedef cpExtensions::Algorithms::ParallelImageMean< I > TMeanCalculator;
-        typedef typename TMeanCalculator::TMean TMean;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( LightCompensationFilter, itkInPlaceImageFilter );
-
-        itkGetConstMacro( Mean, TMean );
-
-      protected:
-        LightCompensationFilter( );
-        virtual ~LightCompensationFilter( );
-
-      private:
-        virtual void BeforeThreadedGenerateData( );
-        virtual void ThreadedGenerateData(
-          const TRegion& region, itk::ThreadIdType id
-          );
-        virtual void AfterThreadedGenerateData( );
-
-      protected:
-        TMean m_Mean;
-        TMean m_Coefficient;
-      };
+    public:
+      typedef LightCompensationFilter         Self;
+      typedef itk::InPlaceImageFilter< I, I > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TImage;
+      typedef typename I::RegionType TRegion;
+
+      typedef cpExtensions::Algorithms::ParallelImageMean< I > TMeanCalculator;
+      typedef typename TMeanCalculator::TMean TMean;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( LightCompensationFilter, itkInPlaceImageFilter );
+
+      itkGetConstMacro( Mean, TMean );
+
+    protected:
+      LightCompensationFilter( );
+      virtual ~LightCompensationFilter( );
+
+    private:
+      virtual void BeforeThreadedGenerateData( );
+      virtual void ThreadedGenerateData(
+        const TRegion& region, itk::ThreadIdType id
+        );
+      virtual void AfterThreadedGenerateData( );
+
+    protected:
+      TMean m_Mean;
+      TMean m_Coefficient;
+    };
 
   } // ecapseman
 
index 2ad1b5072c26264d1aa6be9f3fd1e8b88816786e..079d9d4a3eee8f22a835fa6956710ed6aebbe1bf 100644 (file)
@@ -9,85 +9,85 @@
 #include <itkImageToImageFilter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I, class O >
+    class MultiScaleGaussianImageFilter
+      : public itk::ImageToImageFilter< I, O >
     {
+    public:
+      typedef MultiScaleGaussianImageFilter   Self;
+      typedef itk::ImageToImageFilter< I, O > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TInputImage;
+      typedef O TOutputImage;
+
+      typedef std::set< double > TScalesContainer;
+
+      enum FilterId
+      {
+        Gradient = 0,
+        GradientMagnitude,
+        Hessian,
+        None
+      };
+
+    protected:
       /**
        */
-      template< class I, class O >
-      class MultiScaleGaussianImageFilter
-        : public itk::ImageToImageFilter< I, O >
+      class _Greater
       {
       public:
-        typedef MultiScaleGaussianImageFilter   Self;
-        typedef itk::ImageToImageFilter< I, O > Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef I TInputImage;
-        typedef O TOutputImage;
-
-        typedef std::set< double > TScalesContainer;
-
-        enum FilterId
-        {
-          Gradient = 0,
-          GradientMagnitude,
-          Hessian,
-          None
-        };
-
-      protected:
-        /**
-         */
-        class _Greater
-        {
-        public:
-          typedef typename O::PixelType _T;
-
-        public:
-          _Greater( );
-          virtual ~_Greater( );
-          bool operator!=( const _Greater& b ) const;
-          bool operator==( const _Greater& b ) const;
-          inline _T operator()( const _T& a ) const;
-          inline _T operator()( const _T& a, const _T& b ) const;
-        };
+        typedef typename O::PixelType _T;
 
       public:
-        itkNewMacro( Self );
-        itkTypeMacro( MultiScaleGaussianImageFilter, itkImageToImageFilter );
+        _Greater( );
+        virtual ~_Greater( );
+        bool operator!=( const _Greater& b ) const;
+        bool operator==( const _Greater& b ) const;
+        inline _T operator()( const _T& a ) const;
+        inline _T operator()( const _T& a, const _T& b ) const;
+      };
 
-      public:
-        void SetFilterToGradient( );
-        void SetFilterToGradientMagnitude( );
-        void SetFilterToHessian( );
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( MultiScaleGaussianImageFilter, itkImageToImageFilter );
 
-        bool IsGradientFilter( ) const;
-        bool IsGradientMagnitudeFilter( ) const;
-        bool IsHessianFilter( ) const;
+    public:
+      void SetFilterToGradient( );
+      void SetFilterToGradientMagnitude( );
+      void SetFilterToHessian( );
 
-        void AddScale( const double& s );
-        unsigned long GetNumberOfScales( ) const;
+      bool IsGradientFilter( ) const;
+      bool IsGradientMagnitudeFilter( ) const;
+      bool IsHessianFilter( ) const;
 
-      protected:
-        MultiScaleGaussianImageFilter( );
-        virtual ~MultiScaleGaussianImageFilter( );
+      void AddScale( const double& s );
+      unsigned long GetNumberOfScales( ) const;
 
-        virtual void GenerateData( );
+    protected:
+      MultiScaleGaussianImageFilter( );
+      virtual ~MultiScaleGaussianImageFilter( );
 
-        template< class F >
-        void _GenerateData( );
+      virtual void GenerateData( );
 
-      private:
-        // Purposely not implemented.
-        MultiScaleGaussianImageFilter( const Self& );
-        void operator=( const Self& );
+      template< class F >
+      void _GenerateData( );
 
-      protected:
-        TScalesContainer m_Scales;
-        FilterId m_FilterId;
-      };
+    private:
+      // Purposely not implemented.
+      MultiScaleGaussianImageFilter( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      TScalesContainer m_Scales;
+      FilterId m_FilterId;
+    };
 
   } // ecapseman
 
index f34ca6e5f2cf7bb9cc62179c44851625f1dc2786..1fe204ae54cf0bbcab914d0c81d8e71cca9914ba 100644 (file)
 #include <itkNumericTraits.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I >
+    class ParallelImageMean
+      : public itk::DomainThreader< itk::ThreadedImageRegionPartitioner< I::ImageDimension >, I >
     {
-      /**
-       */
-      template< class I >
-      class ParallelImageMean
-        : public itk::DomainThreader< itk::ThreadedImageRegionPartitioner< I::ImageDimension >, I >
-      {
-      public:
-        // Standard ITK typedefs.
-        typedef itk::DomainThreader< itk::ThreadedImageRegionPartitioner< I::ImageDimension >, I > Superclass;
-        typedef ParallelImageMean               Self;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef typename Superclass::DomainType DomainType;
-
-        typedef itk::Array< double > TMean;
-
-      protected:
-        typedef itk::NumericTraits< typename I::PixelType > _TPixelTraits;
-
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( ParallelImageMean, itkDomainThreader );
-
-        itkGetConstMacro( Mean, TMean );
-
-      protected:
-        ParallelImageMean( );
-        virtual ~ParallelImageMean( );
-
-      private:
-        virtual void BeforeThreadedExecution( );
-        virtual void ThreadedExecution(
-          const DomainType& region, const itk::ThreadIdType id
-          );
-        virtual void AfterThreadedExecution( );
-
-      protected:
-        itk::Array< double > m_Mean;
-        unsigned long m_N;
-      };
-
-    } // ecapseman
+    public:
+      // Standard ITK typedefs.
+      typedef itk::DomainThreader< itk::ThreadedImageRegionPartitioner< I::ImageDimension >, I > Superclass;
+      typedef ParallelImageMean               Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::DomainType DomainType;
+
+      typedef itk::Array< double > TMean;
+
+    protected:
+      typedef itk::NumericTraits< typename I::PixelType > _TPixelTraits;
+
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( ParallelImageMean, itkDomainThreader );
+
+      itkGetConstMacro( Mean, TMean );
+
+    protected:
+      ParallelImageMean( );
+      virtual ~ParallelImageMean( );
+
+    private:
+      virtual void BeforeThreadedExecution( );
+      virtual void ThreadedExecution(
+        const DomainType& region, const itk::ThreadIdType id
+        );
+      virtual void AfterThreadedExecution( );
+
+    protected:
+      itk::Array< double > m_Mean;
+      unsigned long m_N;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 8db169720ee77e49f5c3826e4a937235c4bef34d..9dd11b54cd79cd21d042728957b5f087107bcb91 100644 (file)
 #include <itkVector.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class O >
+    struct RGBExtractFunction
     {
-      /**
-       */
-      template< class O >
-      struct RGBExtractFunction
-      {
-        typedef RGBExtractFunction  Self;
-        typedef itk::Vector< O, 3 > TOutPixel;
-
-        template< class Tr, class Tg, class Tb >
-        TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
-          {
-            TOutPixel rgb;
-            rgb[ 0 ] = O( r );
-            rgb[ 1 ] = O( g );
-            rgb[ 2 ] = O( b );
-            return( rgb );
-          }
-
-        template< class C >
-        TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
-          {
-            return(
-              this->operator()(
-                rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
-                )
-              );
-          }
-      };
-
-    } // ecapseman
+      typedef RGBExtractFunction  Self;
+      typedef itk::Vector< O, 3 > TOutPixel;
+
+      template< class Tr, class Tg, class Tb >
+      TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+        {
+          TOutPixel rgb;
+          rgb[ 0 ] = O( r );
+          rgb[ 1 ] = O( g );
+          rgb[ 2 ] = O( b );
+          return( rgb );
+        }
+
+      template< class C >
+      TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
+        {
+          return(
+            this->operator()(
+              rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
+              )
+            );
+        }
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index fb04b77583a5515b9913d24cf40f1d0c6e829c84..b5370154bdda2920efdf21fb78711c62f550937b 100644 (file)
@@ -8,66 +8,66 @@
 #include <itkImageToImageFilter.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class I, class O, class C >
+    class RGBImageToOtherChannelsFilter
+      : public itk::ImageToImageFilter< I, O >
     {
-      /**
-       */
-      template< class I, class O, class C >
-      class RGBImageToOtherChannelsFilter
-        : public itk::ImageToImageFilter< I, O >
-      {
-      public:
-        typedef RGBImageToOtherChannelsFilter     Self;
-        typedef itk::ImageToImageFilter< I, O > Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef I TInputImage;
-        typedef O TOutputImage;
-        typedef C TConverter;
-        typedef typename I::PixelType TInputPixel;
-        typedef typename O::PixelType TOutputPixel;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( RGBImageToOtherChannelsFilter, itkImageToImageFilter );
-
-      public:
-        O* GetChannel1( );
-        O* GetChannel2( );
-        O* GetChannel3( );
-
-        const O* GetChannel1( ) const;
-        const O* GetChannel2( ) const;
-        const O* GetChannel3( ) const;
-
-        void GraftChannel1( O* c1 );
-        void GraftChannel2( O* c2 );
-        void GraftChannel3( O* c3 );
-
-      protected:
-        RGBImageToOtherChannelsFilter( );
-        virtual ~RGBImageToOtherChannelsFilter( );
-
-        virtual void BeforeThreadedGenerateData( );
-        virtual void AfterThreadedGenerateData( );
-
-        virtual void ThreadedGenerateData(
-          const typename Superclass::OutputImageRegionType& region,
-          itk::ThreadIdType threadId
-          );
-
-      private:
-        // Purposely not implemented
-        RGBImageToOtherChannelsFilter( const Self& other );
-        void operator=( const Self& other );
-
-      private:
-        TConverter Converter;
-      };
-
-    } // ecapseman
+    public:
+      typedef RGBImageToOtherChannelsFilter     Self;
+      typedef itk::ImageToImageFilter< I, O > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef I TInputImage;
+      typedef O TOutputImage;
+      typedef C TConverter;
+      typedef typename I::PixelType TInputPixel;
+      typedef typename O::PixelType TOutputPixel;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( RGBImageToOtherChannelsFilter, itkImageToImageFilter );
+
+    public:
+      O* GetChannel1( );
+      O* GetChannel2( );
+      O* GetChannel3( );
+
+      const O* GetChannel1( ) const;
+      const O* GetChannel2( ) const;
+      const O* GetChannel3( ) const;
+
+      void GraftChannel1( O* c1 );
+      void GraftChannel2( O* c2 );
+      void GraftChannel3( O* c3 );
+
+    protected:
+      RGBImageToOtherChannelsFilter( );
+      virtual ~RGBImageToOtherChannelsFilter( );
+
+      virtual void BeforeThreadedGenerateData( );
+      virtual void AfterThreadedGenerateData( );
+
+      virtual void ThreadedGenerateData(
+        const typename Superclass::OutputImageRegionType& region,
+        itk::ThreadIdType threadId
+        );
+
+    private:
+      // Purposely not implemented
+      RGBImageToOtherChannelsFilter( const Self& other );
+      void operator=( const Self& other );
+
+    private:
+      TConverter Converter;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 8536b4aa8df1a876d88a0e193b391d2acb8d29cb..326ec5d058f12d490e25cc626df8fff994d7bbeb 100644 (file)
 #include <itkVector.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class O >
+    struct RGBToHSVFunction
     {
-      /**
-       */
-      template< class O >
-      struct RGBToHSVFunction
-      {
-        typedef RGBToHSVFunction    Self;
-        typedef itk::Vector< O, 3 > TOutPixel;
+      typedef RGBToHSVFunction    Self;
+      typedef itk::Vector< O, 3 > TOutPixel;
 
-        template< class Tr, class Tg, class Tb >
-        TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
-          {
-            static const double mVal =
-              double( std::numeric_limits< O >::max( ) );
-            static const double _0 = double( 0 );
-            static const double _1 = double( 1 );
-            static const double _2 = double( 2 );
-            static const double _3 = double( 3 );
-            static const double _2pi = _2 * double( vnl_math::pi );
-
-            TOutPixel hsv;
+      template< class Tr, class Tg, class Tb >
+      TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+        {
+          static const double mVal =
+            double( std::numeric_limits< O >::max( ) );
+          static const double _0 = double( 0 );
+          static const double _1 = double( 1 );
+          static const double _2 = double( 2 );
+          static const double _3 = double( 3 );
+          static const double _2pi = _2 * double( vnl_math::pi );
 
-            double R = double( r );
-            double G = double( g );
-            double B = double( b );
-            double sRGB = R + G + B;
-            double RG = R - G;
-            double RB = R - B;
-            double GB = G - B;
+          TOutPixel hsv;
 
-            // Hue
-            double A = std::sqrt( ( RG * RG ) + ( RB * GB ) );
-            if( A != _0 )
-              A = std::acos( ( RG + RB ) / ( _2 * A ) );
-            A /= _2pi;
-            hsv[ 0 ] = O( mVal * ( ( G >= B )? A: _1 - A ) );
+          double R = double( r );
+          double G = double( g );
+          double B = double( b );
+          double sRGB = R + G + B;
+          double RG = R - G;
+          double RB = R - B;
+          double GB = G - B;
 
-            // Saturation
-            if( sRGB != _0 )
-            {
-              double C = ( G < R )? G: R;
-              C        = ( B < C )? B: C;
-              hsv[ 1 ] = O( mVal * ( _1 - ( ( _3 * C ) / sRGB ) ) );
-            }
-            else
-              hsv[ 1 ] = O( 0 );
-  
-            // Value
-            hsv[ 2 ] = O( sRGB / _3 );
-            return( hsv );
-          }
+          // Hue
+          double A = std::sqrt( ( RG * RG ) + ( RB * GB ) );
+          if( A != _0 )
+            A = std::acos( ( RG + RB ) / ( _2 * A ) );
+          A /= _2pi;
+          hsv[ 0 ] = O( mVal * ( ( G >= B )? A: _1 - A ) );
 
-        template< class C >
-        TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
+          // Saturation
+          if( sRGB != _0 )
           {
-            return(
-              this->operator()(
-                rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
-                )
-              );
+            double C = ( G < R )? G: R;
+            C        = ( B < C )? B: C;
+            hsv[ 1 ] = O( mVal * ( _1 - ( ( _3 * C ) / sRGB ) ) );
           }
-      };
+          else
+            hsv[ 1 ] = O( 0 );
+
+          // Value
+          hsv[ 2 ] = O( sRGB / _3 );
+          return( hsv );
+        }
+
+      template< class C >
+      TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
+        {
+          return(
+            this->operator()(
+              rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
+              )
+            );
+        }
+    };
 
   } // ecapseman
 
index 97b85ce14658f41a7f2f2ff51b43e7734f5d4c70..b7d59085d2fabf936aa11c9939463b276597e5fd 100644 (file)
 #include <itkVector.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class O >
+    struct RGBToRGBFunction
     {
-      /**
-       */
-      template< class O >
-      struct RGBToRGBFunction
-      {
-        typedef RGBToRGBFunction  Self;
-        typedef itk::Vector< O, 3 > TOutPixel;
-
-        template< class Tr, class Tg, class Tb >
-        TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
-          {
-            TOutPixel rgb;
-            rgb[ 0 ] = O( r );
-            rgb[ 1 ] = O( g );
-            rgb[ 2 ] = O( b );
-            return( rgb );
-          }
-
-        template< class C >
-        TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
-          {
-            return(
-              this->operator()(
-                rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
-                )
-              );
-          }
-      };
-
-    } // ecapseman
+      typedef RGBToRGBFunction  Self;
+      typedef itk::Vector< O, 3 > TOutPixel;
+
+      template< class Tr, class Tg, class Tb >
+      TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+        {
+          TOutPixel rgb;
+          rgb[ 0 ] = O( r );
+          rgb[ 1 ] = O( g );
+          rgb[ 2 ] = O( b );
+          return( rgb );
+        }
+
+      template< class C >
+      TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
+        {
+          return(
+            this->operator()(
+              rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
+              )
+            );
+        }
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 5b13a075395d95e4bbd66bf47fe3d8154c410bce..fb9da023cbd1d65dc841dc71fb3ab99b97354885 100644 (file)
 #include <itkVector.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class O >
+    struct RGBToYPbPrFunction
     {
-      /**
-       */
-      template< class O >
-      struct RGBToYPbPrFunction
-      {
-        typedef RGBToYPbPrFunction  Self;
-        typedef itk::Vector< O, 3 > TOutPixel;
+      typedef RGBToYPbPrFunction  Self;
+      typedef itk::Vector< O, 3 > TOutPixel;
 
-        template< class Tr, class Tg, class Tb >
-        TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
-          {
-            static const O M[] =
-              {
-                O(  0.2990 ), O(  0.5870 ), O(  0.1140 ),
-                O( -0.1687 ), O( -0.3313 ), O(  0.5000 ),
-                O(  0.5000 ), O( -0.4187 ), O( -0.0813 )
-              };
-            static const vnl_matrix< O > vM( M, 3, 3 );
-            static const itk::Matrix< O, 3, 3 > iM( vM );
+      template< class Tr, class Tg, class Tb >
+      TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+        {
+          static const O M[] =
+            {
+              O(  0.2990 ), O(  0.5870 ), O(  0.1140 ),
+              O( -0.1687 ), O( -0.3313 ), O(  0.5000 ),
+              O(  0.5000 ), O( -0.4187 ), O( -0.0813 )
+            };
+          static const vnl_matrix< O > vM( M, 3, 3 );
+          static const itk::Matrix< O, 3, 3 > iM( vM );
 
-            TOutPixel rgb;
-            rgb[ 0 ] = O( r );
-            rgb[ 1 ] = O( g );
-            rgb[ 2 ] = O( b );
-            return( iM * rgb );
-          }
+          TOutPixel rgb;
+          rgb[ 0 ] = O( r );
+          rgb[ 1 ] = O( g );
+          rgb[ 2 ] = O( b );
+          return( iM * rgb );
+        }
 
-        template< class C >
-        TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
-          {
-            return(
-              this->operator()(
-                rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
-                )
-              );
-          }
-      };
+      template< class C >
+      TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
+        {
+          return(
+            this->operator()(
+              rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
+              )
+            );
+        }
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index a3e2aacc03f4f9b5df69fcf51623e9b13832d8cc..dfcad3f6955cdefe441a103b79c7770434f53ace 100644 (file)
@@ -7,98 +7,98 @@
 #include <itkImageToVTKImageFilter.h>
 
 namespace cpExtensions
+{
+  namespace DataStructures
   {
-    namespace DataStructures
+    /**
+     */
+    template< typename P, unsigned int D >
+    struct ITKAndVTKImage
     {
-      /**
-       */
-      template< typename P, unsigned int D >
-      struct ITKAndVTKImage
-      {
-        typedef itk::Image< P, D >                   TImage;
-        typedef itk::ImageToVTKImageFilter< TImage > TItk2Vtk;
-
-        typename TImage::Pointer   ITK;
-        typename TItk2Vtk::Pointer VTK;
-
-        void CopyInformation( const itk::ImageBase< D >* i )
+      typedef itk::Image< P, D >                   TImage;
+      typedef itk::ImageToVTKImageFilter< TImage > TItk2Vtk;
+
+      typename TImage::Pointer   ITK;
+      typename TItk2Vtk::Pointer VTK;
+
+      void CopyInformation( const itk::ImageBase< D >* i )
+        {
+          this->ITK = TImage::New( );
+          this->ITK->SetLargestPossibleRegion( i->GetLargestPossibleRegion( ) );
+          this->ITK->SetRequestedRegion( i->GetRequestedRegion( ) );
+          this->ITK->SetBufferedRegion( i->GetBufferedRegion( ) );
+          this->ITK->SetSpacing( i->GetSpacing( ) );
+          this->ITK->SetOrigin( i->GetOrigin( ) );
+          this->ITK->SetDirection( i->GetDirection( ) );
+          this->ITK->Allocate( );
+        }
+
+      void SetItkImage( TImage* image )
+        {
+          this->ITK = image;
+          this->_Synch( );
+        }
+
+      std::string ReadFromFile( const std::string& filename )
+        {
+          typename itk::ImageFileReader< TImage >::Pointer r =
+            itk::ImageFileReader< TImage >::New( );
+          r->SetFileName( filename );
+          try
           {
-            this->ITK = TImage::New( );
-            this->ITK->SetLargestPossibleRegion( i->GetLargestPossibleRegion( ) );
-            this->ITK->SetRequestedRegion( i->GetRequestedRegion( ) );
-            this->ITK->SetBufferedRegion( i->GetBufferedRegion( ) );
-            this->ITK->SetSpacing( i->GetSpacing( ) );
-            this->ITK->SetOrigin( i->GetOrigin( ) );
-            this->ITK->SetDirection( i->GetDirection( ) );
-            this->ITK->Allocate( );
+            r->Update( );
           }
-
-        void SetItkImage( TImage* image )
+          catch( itk::ExceptionObject& err )
           {
-            this->ITK = image;
-            this->_Synch( );
-          }
-
-        std::string ReadFromFile( const std::string& filename )
-          {
-            typename itk::ImageFileReader< TImage >::Pointer r =
-              itk::ImageFileReader< TImage >::New( );
-            r->SetFileName( filename );
-            try
-            {
-              r->Update( );
-            }
-            catch( itk::ExceptionObject& err )
-            {
-              this->ITK = NULL;
-              return( err.GetDescription( ) );
-
-            } // fi
-            this->ITK = r->GetOutput( );
-            this->ITK->DisconnectPipeline( );
-            this->_Synch( );
-            return( "" );
-          }
-
-        std::string WriteToFile( const std::string& filename ) const
+            this->ITK = NULL;
+            return( err.GetDescription( ) );
+
+          } // fi
+          this->ITK = r->GetOutput( );
+          this->ITK->DisconnectPipeline( );
+          this->_Synch( );
+          return( "" );
+        }
+
+      std::string WriteToFile( const std::string& filename ) const
+        {
+          typename itk::ImageFileWriter< TImage >::Pointer w =
+            itk::ImageFileWriter< TImage >::New( );
+          w->SetFileName( filename );
+          w->SetInput( this->ITK );
+          try
           {
-            typename itk::ImageFileWriter< TImage >::Pointer w =
-              itk::ImageFileWriter< TImage >::New( );
-            w->SetFileName( filename );
-            w->SetInput( this->ITK );
-            try
-            {
-              w->Update( );
-            }
-            catch( itk::ExceptionObject& err )
-            {
-              return( err.GetDescription( ) );
-
-            } // fi
-            return( "" );
+            w->Update( );
           }
-
-        TImage* GetItkImage( )
-          { return( this->ITK ); }
-        vtkImageData* GetVtkImage( )
-          { return( this->VTK->GetOutput( ) ); }
-        const TImage* GetItkImage( ) const
-          { return( this->ITK ); }
-        const vtkImageData* GetVtkImage( ) const
-          { return( this->VTK->GetOutput( ) ); }
-        void DisconnectPipeline( )
-          { this->ITK->DisconnectPipeline( ); }
-
-        void _Synch( )
+          catch( itk::ExceptionObject& err )
           {
-            this->VTK = TItk2Vtk::New( );
-            this->VTK->SetInput( this->ITK );
-            this->VTK->Update( );
-          }
-
-      };
-
-    } // ecapseman
+            return( err.GetDescription( ) );
+
+          } // fi
+          return( "" );
+        }
+
+      TImage* GetItkImage( )
+        { return( this->ITK ); }
+      vtkImageData* GetVtkImage( )
+        { return( this->VTK->GetOutput( ) ); }
+      const TImage* GetItkImage( ) const
+        { return( this->ITK ); }
+      const vtkImageData* GetVtkImage( ) const
+        { return( this->VTK->GetOutput( ) ); }
+      void DisconnectPipeline( )
+        { this->ITK->DisconnectPipeline( ); }
+
+      void _Synch( )
+        {
+          this->VTK = TItk2Vtk::New( );
+          this->VTK->SetInput( this->ITK );
+          this->VTK->Update( );
+        }
+
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 9b0a66048dacb8d0ac42c05a505a810910efd701..1914d03482c61b9e59faf89eb7325c1e7aff3bc9 100644 (file)
 #include <cpExtensions/DataStructures/QuadEdgeIterators.h>
 
 namespace cpExtensions
+{
+  namespace DataStructures
   {
-    namespace DataStructures
+    /**
+     */
+    template< typename P, typename D, bool IsPrimal = true >
+    class QuadEdge
+      : public itk::LightObject
     {
+    public:
+      typedef QuadEdge                        Self;
+      typedef itk::LightObject                Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      /// Vertices and faces types
+      typedef P TPrimalGeometry;
+      typedef D TDualGeometry;
+
+      /**
+       * Dual type, basically the same type with swapped template
+       * parameters.
+       */
+      typedef QuadEdge< D, P, !IsPrimal > TDual;
+      typedef Self                        TPrimal;
+      typedef typename TDual::Pointer     PtrDual;
+      friend TDual;
+
+      /// Iterators
+      typedef QuadEdgeIterator< TPrimal >           Iterator;
+      typedef QuadEdgeConstIterator< TPrimal >      ConstIterator;
+      typedef QuadEdgePointIterator< TPrimal >      PointIterator;
+      typedef QuadEdgePointConstIterator< TPrimal > PointConstIterator;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( QuadEdge, itkLightObject );
+
+      cpPluginsExtensionsQEAllIteratorsMacro( Onext );
+      cpPluginsExtensionsQEAllIteratorsMacro( Lnext );
+      cpPluginsExtensionsQEAllIteratorsMacro( Rnext );
+      cpPluginsExtensionsQEAllIteratorsMacro( Dnext );
+      cpPluginsExtensionsQEAllIteratorsMacro( Oprev );
+      cpPluginsExtensionsQEAllIteratorsMacro( Lprev );
+      cpPluginsExtensionsQEAllIteratorsMacro( Rprev );
+      cpPluginsExtensionsQEAllIteratorsMacro( Dprev );
+
+    public:
+      void CreateRings( );
+
+      /// First order access methods
+      inline TPrimal* GetOnext( )
+        { return( this->m_Onext ); }
+      inline TDual* GetRot( )
+        { return( this->m_Rot ); }
+      inline const TPrimal* GetOnext( ) const
+        { return( this->m_Onext ); }
+      inline const TDual* GetRot( ) const
+        { return( this->m_Rot ); }
+
+      /// First order configuration methods
+      inline void SetOnext( TPrimal* e )
+        { this->m_Onext = e; }
+      inline void SetRot( TDual* e )
+        { this->m_Rot = e; }
+
+      /// Second order accessors: around base rings
+      inline TPrimal* GetSym( )
+        { return( this->m_Rot->m_Rot ); }
+      inline TDual* GetInvRot( )
+        { return( this->m_Rot->m_Rot->m_Rot ); }
+
+      /// Second order accessors: neighboring topology
+      inline TPrimal* GetLnext( )
+        { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
+      inline TPrimal* GetRnext( )
+        { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
+      inline TPrimal* GetDnext( )
+        { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
+      inline TPrimal* GetOprev( )
+        { return( this->m_Rot->m_Onext->m_Rot ); }
+      inline TPrimal* GetLprev( )
+        { return( this->m_Onext->m_Rot->m_Rot ); }
+      inline TPrimal* GetRprev( )
+        { return( this->m_Rot->m_Rot->m_Onext ); }
+      inline TPrimal* GetDprev( )
+        {
+          return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
+        }
+
+      /// Second order accessors: around base rings (const versions)
+      inline const TPrimal* GetSym( ) const
+        { return( this->m_Rot->m_Rot ); }
+      inline const TDual* GetInvRot( ) const
+        { return( this->m_Rot->m_Rot->m_Rot ); }
+
+      /// Second order accessors: neighboring topology (const versions)
+      inline const TPrimal* GetLnext( ) const
+        { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
+      inline const TPrimal* GetRnext( ) const
+        { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
+      inline const TPrimal* GetDnext( ) const
+        { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
+      inline const TPrimal* GetOprev( ) const
+        { return( this->m_Rot->m_Onext->m_Rot ); }
+      inline const TPrimal* GetLprev( ) const
+        { return( this->m_Onext->m_Rot->m_Rot ); }
+      inline const TPrimal* GetRprev( ) const
+        { return( this->m_Rot->m_Rot->m_Onext ); }
+      inline const TPrimal* GetDprev( ) const
+        {
+          return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
+        }
+
+      /// Get geometry methods
+      inline P& GetOrigin( )
+        { return ( this->m_Origin ); }
+      inline P& GetDestination( )
+        { return ( this->m_Rot->m_Rot->m_Origin ); }
+      inline D& GetRight( )
+        { return ( this->m_Rot->m_Origin ); }
+      inline D& GetLeft( )
+        { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
+
+      /// Get geometry methods (const versions)
+      inline const P& GetOrigin( ) const
+        { return ( this->m_Origin ); }
+      inline const P& GetDestination( ) const
+        { return ( this->m_Rot->m_Rot->m_Origin ); }
+      inline const D& GetRight( ) const
+        { return ( this->m_Rot->m_Origin ); }
+      inline const D& GetLeft( ) const
+        { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
+
+      /// Set geometry methods
+      inline void SetOrigin( const P& v )
+        { this->m_Origin = v; }
+      inline void SetDestination( const P& v )
+        { this->m_Rot->m_Rot->m_Origin = v; }
+      inline void SetRight( const D& v )
+        { this->m_Rot->m_Origin = v; }
+      inline void SetLeft( const D& v )
+        { this->m_Rot->m_Rot->m_Rot->m_Origin = v; }
+      inline void UnsetOrigin( )
+        { this->m_Origin = TPrimal::NoGeometry; }
+      inline void UnsetDestination( )
+        { this->m_Rot->m_Rot->m_Origin = TPrimal::NoGeometry; }
+      inline void UnsetRight( )
+        { this->m_Rot->m_Origin = TDual::NoGeometry; }
+      inline void UnsetLeft( )
+        { this->m_Rot->m_Rot->m_Rot->m_Origin = TDual::NoGeometry; }
+
+      /**
+       * Set the Left( ) of all the edges in the Lnext( ) ring of "this"
+       * with the same given geometrical information.
+       * @param  faceGeom Looks at most maxSize edges in the Lnext( ) ring.
+       * @return Returns true on success. False otherwise.
+       */
+      void SetLnextRingGeometry( const D& v );
+      void UnsetLnextRingGeometry( );
+
+      /// Topological queries
+      inline bool IsIsolated( ) const
+        { return( this == this->m_Onext ); }
+      bool IsEdgeInOnextRing( const TPrimal* e ) const;
+      bool IsEdgeInLnextRing( const TPrimal* e ) const;
+      unsigned int GetOnextRingSize( ) const;
+      unsigned int GetLnextRingSize( ) const;
+
+      /**
+       * @return Returns true when "this" has no faces set on both sides.
+       *         Return false otherwise.
+       */
+      inline bool IsWire( )
+        { return( !( this->IsLeftSet( ) ) && !( this->IsRightSet( ) ) ); }
+
       /**
+       * @return Returns true when "this" is on the boundary i.e.
+       *         one and only one of the faces is set. Return false
+       *         otherwise.
        */
-      template< typename P, typename D, bool IsPrimal = true >
-      class QuadEdge
-        : public itk::LightObject
-      {
-      public:
-        typedef QuadEdge                        Self;
-        typedef itk::LightObject                Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        /// Vertices and faces types
-        typedef P TPrimalGeometry;
-        typedef D TDualGeometry;
-
-        /**
-         * Dual type, basically the same type with swapped template
-         * parameters.
-         */
-        typedef QuadEdge< D, P, !IsPrimal > TDual;
-        typedef Self                        TPrimal;
-        typedef typename TDual::Pointer     PtrDual;
-        friend TDual;
-
-        /// Iterators
-        typedef QuadEdgeIterator< TPrimal >           Iterator;
-        typedef QuadEdgeConstIterator< TPrimal >      ConstIterator;
-        typedef QuadEdgePointIterator< TPrimal >      PointIterator;
-        typedef QuadEdgePointConstIterator< TPrimal > PointConstIterator;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( QuadEdge, itkLightObject );
-
-        cpPluginsExtensionsQEAllIteratorsMacro( Onext );
-        cpPluginsExtensionsQEAllIteratorsMacro( Lnext );
-        cpPluginsExtensionsQEAllIteratorsMacro( Rnext );
-        cpPluginsExtensionsQEAllIteratorsMacro( Dnext );
-        cpPluginsExtensionsQEAllIteratorsMacro( Oprev );
-        cpPluginsExtensionsQEAllIteratorsMacro( Lprev );
-        cpPluginsExtensionsQEAllIteratorsMacro( Rprev );
-        cpPluginsExtensionsQEAllIteratorsMacro( Dprev );
-
-      public:
-        void CreateRings( );
-
-        /// First order access methods
-        inline TPrimal* GetOnext( )
-          { return( this->m_Onext ); }
-        inline TDual* GetRot( )
-          { return( this->m_Rot ); }
-        inline const TPrimal* GetOnext( ) const
-          { return( this->m_Onext ); }
-        inline const TDual* GetRot( ) const
-          { return( this->m_Rot ); }
-
-        /// First order configuration methods
-        inline void SetOnext( TPrimal* e )
-          { this->m_Onext = e; }
-        inline void SetRot( TDual* e )
-          { this->m_Rot = e; }
-
-        /// Second order accessors: around base rings
-        inline TPrimal* GetSym( )
-          { return( this->m_Rot->m_Rot ); }
-        inline TDual* GetInvRot( )
-          { return( this->m_Rot->m_Rot->m_Rot ); }
-
-        /// Second order accessors: neighboring topology
-        inline TPrimal* GetLnext( )
-          { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
-        inline TPrimal* GetRnext( )
-          { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
-        inline TPrimal* GetDnext( )
-          { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
-        inline TPrimal* GetOprev( )
-          { return( this->m_Rot->m_Onext->m_Rot ); }
-        inline TPrimal* GetLprev( )
-          { return( this->m_Onext->m_Rot->m_Rot ); }
-        inline TPrimal* GetRprev( )
-          { return( this->m_Rot->m_Rot->m_Onext ); }
-        inline TPrimal* GetDprev( )
-          {
-            return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
-          }
-
-        /// Second order accessors: around base rings (const versions)
-        inline const TPrimal* GetSym( ) const
-          { return( this->m_Rot->m_Rot ); }
-        inline const TDual* GetInvRot( ) const
-          { return( this->m_Rot->m_Rot->m_Rot ); }
-
-        /// Second order accessors: neighboring topology (const versions)
-        inline const TPrimal* GetLnext( ) const
-          { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
-        inline const TPrimal* GetRnext( ) const
-          { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
-        inline const TPrimal* GetDnext( ) const
-          { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
-        inline const TPrimal* GetOprev( ) const
-          { return( this->m_Rot->m_Onext->m_Rot ); }
-        inline const TPrimal* GetLprev( ) const
-          { return( this->m_Onext->m_Rot->m_Rot ); }
-        inline const TPrimal* GetRprev( ) const
-          { return( this->m_Rot->m_Rot->m_Onext ); }
-        inline const TPrimal* GetDprev( ) const
-          {
-            return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
-          }
-
-        /// Get geometry methods
-        inline P& GetOrigin( )
-          { return ( this->m_Origin ); }
-        inline P& GetDestination( )
-          { return ( this->m_Rot->m_Rot->m_Origin ); }
-        inline D& GetRight( )
-          { return ( this->m_Rot->m_Origin ); }
-        inline D& GetLeft( )
-          { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
-
-        /// Get geometry methods (const versions)
-        inline const P& GetOrigin( ) const
-          { return ( this->m_Origin ); }
-        inline const P& GetDestination( ) const
-          { return ( this->m_Rot->m_Rot->m_Origin ); }
-        inline const D& GetRight( ) const
-          { return ( this->m_Rot->m_Origin ); }
-        inline const D& GetLeft( ) const
-          { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
-
-        /// Set geometry methods
-        inline void SetOrigin( const P& v )
-          { this->m_Origin = v; }
-        inline void SetDestination( const P& v )
-          { this->m_Rot->m_Rot->m_Origin = v; }
-        inline void SetRight( const D& v )
-          { this->m_Rot->m_Origin = v; }
-        inline void SetLeft( const D& v )
-          { this->m_Rot->m_Rot->m_Rot->m_Origin = v; }
-        inline void UnsetOrigin( )
-          { this->m_Origin = TPrimal::NoGeometry; }
-        inline void UnsetDestination( )
-          { this->m_Rot->m_Rot->m_Origin = TPrimal::NoGeometry; }
-        inline void UnsetRight( )
-          { this->m_Rot->m_Origin = TDual::NoGeometry; }
-        inline void UnsetLeft( )
-          { this->m_Rot->m_Rot->m_Rot->m_Origin = TDual::NoGeometry; }
-
-        /**
-         * Set the Left( ) of all the edges in the Lnext( ) ring of "this"
-         * with the same given geometrical information.
-         * @param  faceGeom Looks at most maxSize edges in the Lnext( ) ring.
-         * @return Returns true on success. False otherwise.
-         */
-        void SetLnextRingGeometry( const D& v );
-        void UnsetLnextRingGeometry( );
-
-        /// Topological queries
-        inline bool IsIsolated( ) const
-          { return( this == this->m_Onext ); }
-        bool IsEdgeInOnextRing( const TPrimal* e ) const;
-        bool IsEdgeInLnextRing( const TPrimal* e ) const;
-        unsigned int GetOnextRingSize( ) const;
-        unsigned int GetLnextRingSize( ) const;
-
-        /**
-         * @return Returns true when "this" has no faces set on both sides.
-         *         Return false otherwise.
-         */
-        inline bool IsWire( )
-          { return( !( this->IsLeftSet( ) ) && !( this->IsRightSet( ) ) ); }
-
-        /**
-         * @return Returns true when "this" is on the boundary i.e.
-         *         one and only one of the faces is set. Return false
-         *         otherwise.
-         */
-        inline bool IsAtBorder( ) const;
-
-        /**
-         * @return Returns true when "this" has faces set on both sides.
-         *         Return false otherwise.
-         */
-        inline bool IsInternal( ) const
-          { return ( this->IsLeftSet( ) && this->IsRightSet( ) ); }
-
-        /// Geometrical queries
-        inline bool IsOriginSet( ) const
-          { return ( this->m_Origin != Self::NoGeometry ); }
-        inline bool IsDestinationSet( ) const
-          { return ( this->m_Rot->m_Rot->IsOriginSet( ) ); }
-        inline bool IsRightSet( ) const
-          { return ( this->m_Rot->IsOriginSet( ) ); }
-        inline bool IsLeftSet( ) const
-          { return ( this->m_Rot->m_Rot->m_Rot->IsOriginSet( ) ); }
-
-        /**
-         * \brief Check wether edge's Origin is internal to the mesh (as
-         * opposed to being on the boundary) by looking if all the edges
-         * in the Onext() ring have a face set on both their Left() and
-         * Right() side.
-         */
-        bool IsOriginInternal( ) const;
-
-        /**
-         * Definition: an edge is said to be a boundary edge when it is
-         * adjacent to i.e. when at least one of the faces edge->GetLeft() or
-         * edge->GetRight() is unset.  Definition: an point is said to be a
-         * boundary point when at least one of the edges of it's Onext() ring
-         * is a boundary edge.
-         *
-         * Assume "this" edge belongs to a triangulation (i.e. it belongs to a
-         * QEMesh which represents a 2-manifold) which possesses a boundary.
-         * Assume "this" edge instance is a boundary edge. Let us denote by P
-         * the point which is the origin of "this" edge i.e. P is
-         * this->Origin().  By definition P is a boundary point.  Then AT
-         * LEAST two [see the note below] edges of the Onext() ring of P
-         * [which all have the point P as Origin()] are themselves boundary
-         * edges. And among those boundary edges AT LEAST one has it's Left()
-         * face unset.  By iterating over the Onext() ring (which defines a
-         * local ordering on edges) this method searches for the first edge
-         * whose Left() face is unset AND which is encountered AFTER edgeTest.
-         *
-         * @param edgeTest When present, this edge will be considered as
-         *        the entry edge in the Onext() ring. When absent it shall
-         *        be defaulted to "this" edge. (see the warning below).
-         * @return When "this" edge is a boundary edge, return the first
-         *         edge in "this" Onext() ring whose Left() face is unset
-         *         AND located after edgeTest.
-         *         When "this" edge is NOT a boundary edge the 0 is
-         *         returned.
-         * @warning When the Mesh possessing "this" edge is a 2-manifold
-         *          then result of this method is unique in the sense that
-         *          it is independent from the edgeTest parameter.
-         *          But when the Mesh is not 2-manifold (this state can
-         *          happen at intermediary stages of the building process,
-         *          or during "surgical" operations on the Mesh, and
-         *          even though the Mesh represents a triangulation)
-         *          the result of this method is not unique in the sense
-         *          that the result depends on the edgeTest parameter.
-         *          Let us illusatre this dependence by considering a
-         *          Mesh (which is a triangulation) which is not a 2-manifold.
-         *          Assume the point P (the origin of "this" edge i.e.
-         *          P = this->Originv()) is TWICE on the border i.e. it
-         *          is adjacent twice to noface. We can consider the situation
-         *          of the following diagram, which depicts some Onext()
-         *          ring around point P:
-         *
-         *                       \         /                               //
-         *                        \   *   /                                //
-         *                        i3     b2              counter-clockwise //
-         *                  *       \   /   NO FACE      Onext() order.    //
-         *                           \ /                                   //
-         *                 ----b4-----P----b1------                        //
-         *                           /|\                                   //
-         *               NO FACE    / | \                                  //
-         *                         /  |  \    *  <------ a * indicates the //
-         *                        /   |   \         the presence of a face //
-         *                       /    |    \                               //
-         *                     b5    i6     i7                             //
-         *                     /   *  |  *   \                             //
-         *                    /       |       \                            //
-         *
-         *          On this example, and if we assume the Onext() oder is
-         *          represented counter-clockwise, the edges are ordered as
-         *          follows:
-         *             b1, b2, i3, b4, b5, i6, i7
-         *          (when arbitrarily starting at edge b1).
-         *          We have four Boundary edges labeled b1, b2, b4, b5 and
-         *          we have three internal edges (i.e. non boundary edges)
-         *          labeled i3, i6 and i7.
-         *          Depending on edgeTest, the result of this method
-         *          will NOT return the same edge:
-         *            - when edgeTest == b5 (or i6 or i7 or b1) then the edge
-         *              b1 will be returned,
-         *            - when edgeTest == b2 (or i3 or b4) then the edge
-         *              b4 will be returned,
-         *          Eventually, when edgeTest is absent, the result shall
-         *          depend on the position of "this" in the Onext() ring().
-         *
-         */
-        TPrimal* GetNextBorderEdgeWithUnsetLeft( TPrimal* edge = NULL ) const;
-
-        /**
-         * Assume "this->Originv()" is a boundary point P that is thrice
-         * adjacent to noface and consider the given situation is the one
-         * depicted by the following diagram where:
-         *   - P is "this->Originv()" instance,
-         *   - the * (star) indicates the presence of a face,
-         *   - b1, b2, b3, b4, b5, b6 denote boundary edges,
-         *   - p denotes some generic point,
-         *   - A and B denote some specific points we want to discuss,
-         *   - the Onext() ring order is represented counter-clockwise
-         *     [which is coherent with the definition of edge->GetRigth()]
-         *     i.e. the ordering of the edges is:
-         *          b1, b2, b3, b4, b5, b6, b1...
-         *
-         *                    p       N       p
-         *                   / \      O      / \                            //
-         *                  /   \           /   \                           //
-         *                 /     \    F    /     \       counter-clockwise  //
-         *                /      b3   A   b2      \      Onext() ring order //
-         *               /         \  C  /         \                        //
-         *              /     *     \ E /     *     \                       //
-         *             /             \ /             \                      //
-         *             A------b4------P------b1-------B                     //
-         *                           / \                                    //
-         *                          /   \                                   //
-         *             NO FACE     /     \      NO FACE                     //
-         *                        /       \                                 //
-         *                      b5         b6                               //
-         *                      /     *     \                               //
-         *                     /             \                              //
-         *                    p---------------p                             //
-         *
-         * At P this Mesh doesn't represent a 2-manifold (since we are thrice
-         * on the boundary). Nevertheless such a situation could arise in
-         * intermediary stages (e.g. when building the Mesh, or during
-         * surgical changes on the Mesh).
-         *    Now, assume we are asked to build the triangle [P, A, B]. Note
-         * that this request is not absurd since the current situation at
-         * P isn't the one of a 2-manifold: hence when building the current
-         * Onext() ring of P, we had not enough information to decide
-         * wheter b4.Onext() should be b5 or b1. It is ONLY when we are
-         * required to build the triangle [P, A, B] that we have the
-         * additional information that b4.Onext() is indeed b1.
-         *    When we are required to build triangle [P, A, B], we hence
-         * need to change the Onext() ring order at P, i.e. we need to deal
-         * with the triangle [P, b5, b6] which currently prevents
-         * b4.Onext() to be b1. In other terms, when considering the
-         * additional information that b4.Onext() is b1, and before
-         * building the triangle [P, A, B], we need to reorder
-         * the Onext() ring of P from it's current state
-         *    b1, b2, b3, b4, b5, b6, b1...
-         * to an order coherent with the [P, A, B] request, i.e.
-         *     b1, b2, b5, b6, b3, b4, b1...
-         *
-         * In order to establish the "proper" Onext() ring at P we use
-         * two Splice operations. The algorithm goes:
-         *   - first disconnect the piece of the surface containing the edge
-         *     [PB] (it would be the same process if we chose [PA]) from
-         *     the Onext() ring at P.
-         *   - second, re-integrate the disconnected piece at the desired
-         *     location i.e. side by side with [PA] (respectively [PB] if
-         *     we chose [PA] at first stage).
-         * By "piece of surface containing the edge [PB]" we mean [all]
-         * the triangle[s] starting at [PB] in the Onext() order and
-         * having a left face set.
-         *
-         * We can illustrate this process on bit more general diagram than
-         * the last case (where the "piece of surface containing the edge
-         * [PB]" is constituted by two triangles) and when using
-         * the arguments of this method (i.e. [PA] = this and [PB] = second).
-         * The initial stage is the following (we note first=this=[PA] and
-         * second=[PB]) where the Onext() ring order is:
-         *     first, b2, b3, second, b5, bsplice, b7, first...
-         *
-         *                    p       N       A                            //
-         *                   / \      O      / \                           //
-         *                  /   \           /   \                          //
-         *                 /     \    F    /     \     counter-clockwise   //
-         *                /      b2   A  first    \    Onext() ring order  //
-         *               /         \  C  /         \                       //
-         *              /     *     \ E /     *     \                      //
-         *             /             \ /             \                     //
-         *            p-------b3------P------b7-------p                    //
-         *                           /|\                                   //
-         *                          / | \                                  //
-         *          NO FACE        /  |  \      NO FACE                    //
-         *                        /   |   \                                //
-         *                  second   b5   bsplice                          //
-         *                      /  *  |  *  \                              //
-         *                     /      |      \                             //
-         *                    B-------p-------p                            //
-         *
-         * The first stage, implemented as
-         *     second->Oprev()->Splice( bsplice ),
-         * yields the following diagram:
-         *
-         *                    p       N       A                            //
-         *                   / \      O      / \                           //
-         *                  /   \     F     /   \                          //
-         *                 /     \    A    /     \      counter-clockwise  //
-         *                /      b2   C  first    \     Onext() ring order //
-         *               /         \  E  /         \                       //
-         *              /     *     \   /     *     \                      //
-         *             /             \ /             \                     //
-         *            p-------b3------P------b7-------p                    //
-         *                                                                 //
-         *                         NO FACE                                 //
-         *                                                                 //
-         *                           /|\                                   //
-         *                          / | \                                  //
-         *                         /  |  \                                 //
-         *                        /   |   \                                //
-         *                  second   b5   bsplice                          //
-         *                      /  *  |  *  \                              //
-         *                     /      |      \                             //
-         *                    B-------p-------p                            //
-         *
-         * and the second stage, implemented as
-         *      first->Splice( bsplice ),
-         * yields the following diagram:
-         *
-         *                                    A                            //
-         *         B__        NO FACE        / \                           //
-         *         |  \__                   /   \                          //
-         *         |     \__               /     \       counter-          //
-         *         |      second         first    \      clockwise for all //
-         *         |           \__       /         \                       //
-         *         |     *        \__   /     *     \                      //
-         *         |                 \ /             \                     //
-         *         p-------b5---------P------b7-------p                    //
-         *         |               __/|\                                   //
-         *         |     *      __/   | \                                  //
-         *         |           /      |  \      NO FACE                    //
-         *         |     bsplice      |   \                                //
-         *         |   __/           b2    b3                              //
-         *         p__/               |  *  \                              //
-         *                NO FACE     |      \                             //
-         *                            p-------p                            //
-         *
-         */
-        inline static bool ReorderOnextRing( TPrimal* first, TPrimal* second );
-
-        /**
-         * \brief Basic quad-edge topological method.
-         *
-         * This method describes all possible topological operations on an
-         * edge since it is its own inverse. It works in two ways:
-         *
-         *   1. If this->m_Org != b->m_Org, it slice a face in two.
-         *   2. If this->m_Org == b->m_Org, it unifies two faces.
-         */
-        inline static void Splice( TPrimal* a, TPrimal* b );
-
-      protected:
-        QuadEdge( );
-        virtual ~QuadEdge( );
-
-      public:
-        static const TPrimalGeometry NoGeometry;
-
-      protected:
-        Pointer         m_Onext;  /**< Onext ring */
-        PtrDual         m_Rot;    /**< Rot ring */
-        TPrimalGeometry m_Origin; /**< Geometry attached to edge's origin */
-      };
-
-    } // ecapseman
+      inline bool IsAtBorder( ) const;
+
+      /**
+       * @return Returns true when "this" has faces set on both sides.
+       *         Return false otherwise.
+       */
+      inline bool IsInternal( ) const
+        { return ( this->IsLeftSet( ) && this->IsRightSet( ) ); }
+
+      /// Geometrical queries
+      inline bool IsOriginSet( ) const
+        { return ( this->m_Origin != Self::NoGeometry ); }
+      inline bool IsDestinationSet( ) const
+        { return ( this->m_Rot->m_Rot->IsOriginSet( ) ); }
+      inline bool IsRightSet( ) const
+        { return ( this->m_Rot->IsOriginSet( ) ); }
+      inline bool IsLeftSet( ) const
+        { return ( this->m_Rot->m_Rot->m_Rot->IsOriginSet( ) ); }
+
+      /**
+       * \brief Check wether edge's Origin is internal to the mesh (as
+       * opposed to being on the boundary) by looking if all the edges
+       * in the Onext() ring have a face set on both their Left() and
+       * Right() side.
+       */
+      bool IsOriginInternal( ) const;
+
+      /**
+       * Definition: an edge is said to be a boundary edge when it is
+       * adjacent to i.e. when at least one of the faces edge->GetLeft() or
+       * edge->GetRight() is unset.  Definition: an point is said to be a
+       * boundary point when at least one of the edges of it's Onext() ring
+       * is a boundary edge.
+       *
+       * Assume "this" edge belongs to a triangulation (i.e. it belongs to a
+       * QEMesh which represents a 2-manifold) which possesses a boundary.
+       * Assume "this" edge instance is a boundary edge. Let us denote by P
+       * the point which is the origin of "this" edge i.e. P is
+       * this->Origin().  By definition P is a boundary point.  Then AT
+       * LEAST two [see the note below] edges of the Onext() ring of P
+       * [which all have the point P as Origin()] are themselves boundary
+       * edges. And among those boundary edges AT LEAST one has it's Left()
+       * face unset.  By iterating over the Onext() ring (which defines a
+       * local ordering on edges) this method searches for the first edge
+       * whose Left() face is unset AND which is encountered AFTER edgeTest.
+       *
+       * @param edgeTest When present, this edge will be considered as
+       *        the entry edge in the Onext() ring. When absent it shall
+       *        be defaulted to "this" edge. (see the warning below).
+       * @return When "this" edge is a boundary edge, return the first
+       *         edge in "this" Onext() ring whose Left() face is unset
+       *         AND located after edgeTest.
+       *         When "this" edge is NOT a boundary edge the 0 is
+       *         returned.
+       * @warning When the Mesh possessing "this" edge is a 2-manifold
+       *          then result of this method is unique in the sense that
+       *          it is independent from the edgeTest parameter.
+       *          But when the Mesh is not 2-manifold (this state can
+       *          happen at intermediary stages of the building process,
+       *          or during "surgical" operations on the Mesh, and
+       *          even though the Mesh represents a triangulation)
+       *          the result of this method is not unique in the sense
+       *          that the result depends on the edgeTest parameter.
+       *          Let us illusatre this dependence by considering a
+       *          Mesh (which is a triangulation) which is not a 2-manifold.
+       *          Assume the point P (the origin of "this" edge i.e.
+       *          P = this->Originv()) is TWICE on the border i.e. it
+       *          is adjacent twice to noface. We can consider the situation
+       *          of the following diagram, which depicts some Onext()
+       *          ring around point P:
+       *
+       *                       \         /                               //
+       *                        \   *   /                                //
+       *                        i3     b2              counter-clockwise //
+       *                  *       \   /   NO FACE      Onext() order.    //
+       *                           \ /                                   //
+       *                 ----b4-----P----b1------                        //
+       *                           /|\                                   //
+       *               NO FACE    / | \                                  //
+       *                         /  |  \    *  <------ a * indicates the //
+       *                        /   |   \         the presence of a face //
+       *                       /    |    \                               //
+       *                     b5    i6     i7                             //
+       *                     /   *  |  *   \                             //
+       *                    /       |       \                            //
+       *
+       *          On this example, and if we assume the Onext() oder is
+       *          represented counter-clockwise, the edges are ordered as
+       *          follows:
+       *             b1, b2, i3, b4, b5, i6, i7
+       *          (when arbitrarily starting at edge b1).
+       *          We have four Boundary edges labeled b1, b2, b4, b5 and
+       *          we have three internal edges (i.e. non boundary edges)
+       *          labeled i3, i6 and i7.
+       *          Depending on edgeTest, the result of this method
+       *          will NOT return the same edge:
+       *            - when edgeTest == b5 (or i6 or i7 or b1) then the edge
+       *              b1 will be returned,
+       *            - when edgeTest == b2 (or i3 or b4) then the edge
+       *              b4 will be returned,
+       *          Eventually, when edgeTest is absent, the result shall
+       *          depend on the position of "this" in the Onext() ring().
+       *
+       */
+      TPrimal* GetNextBorderEdgeWithUnsetLeft( TPrimal* edge = NULL ) const;
+
+      /**
+       * Assume "this->Originv()" is a boundary point P that is thrice
+       * adjacent to noface and consider the given situation is the one
+       * depicted by the following diagram where:
+       *   - P is "this->Originv()" instance,
+       *   - the * (star) indicates the presence of a face,
+       *   - b1, b2, b3, b4, b5, b6 denote boundary edges,
+       *   - p denotes some generic point,
+       *   - A and B denote some specific points we want to discuss,
+       *   - the Onext() ring order is represented counter-clockwise
+       *     [which is coherent with the definition of edge->GetRigth()]
+       *     i.e. the ordering of the edges is:
+       *          b1, b2, b3, b4, b5, b6, b1...
+       *
+       *                    p       N       p
+       *                   / \      O      / \                            //
+       *                  /   \           /   \                           //
+       *                 /     \    F    /     \       counter-clockwise  //
+       *                /      b3   A   b2      \      Onext() ring order //
+       *               /         \  C  /         \                        //
+       *              /     *     \ E /     *     \                       //
+       *             /             \ /             \                      //
+       *             A------b4------P------b1-------B                     //
+       *                           / \                                    //
+       *                          /   \                                   //
+       *             NO FACE     /     \      NO FACE                     //
+       *                        /       \                                 //
+       *                      b5         b6                               //
+       *                      /     *     \                               //
+       *                     /             \                              //
+       *                    p---------------p                             //
+       *
+       * At P this Mesh doesn't represent a 2-manifold (since we are thrice
+       * on the boundary). Nevertheless such a situation could arise in
+       * intermediary stages (e.g. when building the Mesh, or during
+       * surgical changes on the Mesh).
+       *    Now, assume we are asked to build the triangle [P, A, B]. Note
+       * that this request is not absurd since the current situation at
+       * P isn't the one of a 2-manifold: hence when building the current
+       * Onext() ring of P, we had not enough information to decide
+       * wheter b4.Onext() should be b5 or b1. It is ONLY when we are
+       * required to build the triangle [P, A, B] that we have the
+       * additional information that b4.Onext() is indeed b1.
+       *    When we are required to build triangle [P, A, B], we hence
+       * need to change the Onext() ring order at P, i.e. we need to deal
+       * with the triangle [P, b5, b6] which currently prevents
+       * b4.Onext() to be b1. In other terms, when considering the
+       * additional information that b4.Onext() is b1, and before
+       * building the triangle [P, A, B], we need to reorder
+       * the Onext() ring of P from it's current state
+       *    b1, b2, b3, b4, b5, b6, b1...
+       * to an order coherent with the [P, A, B] request, i.e.
+       *     b1, b2, b5, b6, b3, b4, b1...
+       *
+       * In order to establish the "proper" Onext() ring at P we use
+       * two Splice operations. The algorithm goes:
+       *   - first disconnect the piece of the surface containing the edge
+       *     [PB] (it would be the same process if we chose [PA]) from
+       *     the Onext() ring at P.
+       *   - second, re-integrate the disconnected piece at the desired
+       *     location i.e. side by side with [PA] (respectively [PB] if
+       *     we chose [PA] at first stage).
+       * By "piece of surface containing the edge [PB]" we mean [all]
+       * the triangle[s] starting at [PB] in the Onext() order and
+       * having a left face set.
+       *
+       * We can illustrate this process on bit more general diagram than
+       * the last case (where the "piece of surface containing the edge
+       * [PB]" is constituted by two triangles) and when using
+       * the arguments of this method (i.e. [PA] = this and [PB] = second).
+       * The initial stage is the following (we note first=this=[PA] and
+       * second=[PB]) where the Onext() ring order is:
+       *     first, b2, b3, second, b5, bsplice, b7, first...
+       *
+       *                    p       N       A                            //
+       *                   / \      O      / \                           //
+       *                  /   \           /   \                          //
+       *                 /     \    F    /     \     counter-clockwise   //
+       *                /      b2   A  first    \    Onext() ring order  //
+       *               /         \  C  /         \                       //
+       *              /     *     \ E /     *     \                      //
+       *             /             \ /             \                     //
+       *            p-------b3------P------b7-------p                    //
+       *                           /|\                                   //
+       *                          / | \                                  //
+       *          NO FACE        /  |  \      NO FACE                    //
+       *                        /   |   \                                //
+       *                  second   b5   bsplice                          //
+       *                      /  *  |  *  \                              //
+       *                     /      |      \                             //
+       *                    B-------p-------p                            //
+       *
+       * The first stage, implemented as
+       *     second->Oprev()->Splice( bsplice ),
+       * yields the following diagram:
+       *
+       *                    p       N       A                            //
+       *                   / \      O      / \                           //
+       *                  /   \     F     /   \                          //
+       *                 /     \    A    /     \      counter-clockwise  //
+       *                /      b2   C  first    \     Onext() ring order //
+       *               /         \  E  /         \                       //
+       *              /     *     \   /     *     \                      //
+       *             /             \ /             \                     //
+       *            p-------b3------P------b7-------p                    //
+       *                                                                 //
+       *                         NO FACE                                 //
+       *                                                                 //
+       *                           /|\                                   //
+       *                          / | \                                  //
+       *                         /  |  \                                 //
+       *                        /   |   \                                //
+       *                  second   b5   bsplice                          //
+       *                      /  *  |  *  \                              //
+       *                     /      |      \                             //
+       *                    B-------p-------p                            //
+       *
+       * and the second stage, implemented as
+       *      first->Splice( bsplice ),
+       * yields the following diagram:
+       *
+       *                                    A                            //
+       *         B__        NO FACE        / \                           //
+       *         |  \__                   /   \                          //
+       *         |     \__               /     \       counter-          //
+       *         |      second         first    \      clockwise for all //
+       *         |           \__       /         \                       //
+       *         |     *        \__   /     *     \                      //
+       *         |                 \ /             \                     //
+       *         p-------b5---------P------b7-------p                    //
+       *         |               __/|\                                   //
+       *         |     *      __/   | \                                  //
+       *         |           /      |  \      NO FACE                    //
+       *         |     bsplice      |   \                                //
+       *         |   __/           b2    b3                              //
+       *         p__/               |  *  \                              //
+       *                NO FACE     |      \                             //
+       *                            p-------p                            //
+       *
+       */
+      inline static bool ReorderOnextRing( TPrimal* first, TPrimal* second );
+
+      /**
+       * \brief Basic quad-edge topological method.
+       *
+       * This method describes all possible topological operations on an
+       * edge since it is its own inverse. It works in two ways:
+       *
+       *   1. If this->m_Org != b->m_Org, it slice a face in two.
+       *   2. If this->m_Org == b->m_Org, it unifies two faces.
+       */
+      inline static void Splice( TPrimal* a, TPrimal* b );
+
+    protected:
+      QuadEdge( );
+      virtual ~QuadEdge( );
+
+    public:
+      static const TPrimalGeometry NoGeometry;
+
+    protected:
+      Pointer         m_Onext;  /**< Onext ring */
+      PtrDual         m_Rot;    /**< Rot ring */
+      TPrimalGeometry m_Origin; /**< Geometry attached to edge's origin */
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index ff7e5a40a78ba5d40808c7488f7413566236ff16..d177e3d47ab381f462d2d83d7229bf252c56c7ba 100644 (file)
 #include <vector>
 
 namespace cpExtensions
+{
+  namespace DataStructures
   {
-    namespace DataStructures
+    /**
+     */
+    template< class I, class E >
+    class QuadEdgeCell
+      : public I
     {
-      /**
-       */
-      template< class I, class E >
-      class QuadEdgeCell
-        : public I
-      {
-      public:
-        // Base types
-        typedef QuadEdgeCell                   Self;
-        typedef I                              Superclass;
-        typedef itk::AutoPointer< Self >       SelfAutoPointer;
-        typedef itk::AutoPointer< const Self > ConstSelfAutoPointer;
-        typedef Self*                          RawPointer;
-        typedef const Self*                    ConstRawPointer;
-
-        // QuadEdge objects
-        typedef E                 TPrimalEdge;
-        typedef typename E::TDual TDualEdge;
-
-        // Inherited types
-        typedef typename I::PixelType                PixelType;
-        typedef typename I::CellType                 CellType;
-        typedef typename I::CellAutoPointer          CellAutoPointer;
-        typedef typename I::CellConstAutoPointer     CellConstAutoPointer;
-        typedef typename I::CellRawPointer           CellRawPointer;
-        typedef typename I::CellConstRawPointer      CellConstRawPointer;
-        typedef typename I::CellTraits               CellTraits;
-        typedef typename I::CoordRepType             CoordRepType;
-        typedef typename I::InterpolationWeightType  InterpolationWeightType;
-        typedef typename I::PointIdentifier          PointIdentifier;
-        typedef typename I::PointIdIterator          PointIdIterator;
-        typedef typename I::PointIdConstIterator     PointIdConstIterator;
-        typedef typename I::CellIdentifier           CellIdentifier;
-        typedef typename I::CellFeatureIdentifier    CellFeatureIdentifier;
-        typedef typename I::CellFeatureIdentifier    CellFeatureCount;
-        typedef typename I::PointType                PointType;
-        typedef typename I::VectorType               VectorType;
-        typedef typename I::PointsContainer          PointsContainer;
-        typedef typename I::UsingCellsContainer      UsingCellsContainer;
-        typedef typename I::CellGeometry             CellGeometry;
-        typedef typename I::ParametricCoordArrayType ParametricCoordArrayType;
-        typedef typename I::ShapeFunctionsArrayType  ShapeFunctionsArrayType;
-
-        itkStaticConstMacro( PointDimension, unsigned int, I::PointDimension );
-        itkStaticConstMacro( CellDimension, unsigned int, 2 );
-
-      public:
-        itkTypeMacro( QuadEdgeCell, I );
-
-      public:
-        QuadEdgeCell( );
-        QuadEdgeCell( E* entry );
-        virtual ~QuadEdgeCell( );
-
-        /// Implement the standard CellInterface.
-        virtual CellGeometry GetType( ) const;
-        virtual void MakeCopy( CellAutoPointer& other ) const;
-        virtual unsigned int GetDimension( ) const;
-        virtual unsigned int GetNumberOfPoints( ) const;
-        virtual CellFeatureCount GetNumberOfBoundaryFeatures(
-          int dimension
-          ) const;
-        virtual bool GetBoundaryFeature(
-          int dimension, CellFeatureIdentifier fId, CellAutoPointer& ptr
-          );
-        virtual void SetPointIds( PointIdConstIterator first );
-        virtual void SetPointIds(
-          PointIdConstIterator first, PointIdConstIterator last
-          );
-        virtual void AddPointId( PointIdentifier pId );
-        virtual void RemovePointId( PointIdentifier pId );
-        virtual void SetPointIds(
-          int dummy, int num, PointIdConstIterator first
-          );
-        virtual void BuildEdges( );
-        virtual void ClearPoints( );
-        virtual void SetPointId( int localId, PointIdentifier pId );
-
-        // Visitor methods
-        static int GetTopologyId( );
-        virtual void Accept(
-          CellIdentifier cellid,
-          typename itk::CellInterface< PixelType, CellTraits >::
-          MultiVisitor* mv
-          );
-
-        // Iterators
-        virtual PointIdIterator      PointIdsBegin( );
-        virtual PointIdConstIterator PointIdsBegin( ) const;
-        virtual PointIdIterator      PointIdsEnd( );
-        virtual PointIdConstIterator PointIdsEnd( ) const;
-
-        /// QuadEdgeCell-specific interface.
-        virtual E* GetEntryPrimalEdge( );
-        virtual const E* GetEntryPrimalEdge( ) const;
-        virtual void SetEntryPrimalEdge( E* entry );
-
-      private:
-        /// Purposely not implemented.
-      QuadEdgeCell( const Self& );
-        Self& operator=( const Self& );
-
-      protected:
-        E* m_EntryEdge;
-      };
-
-    } // ecapseman
+    public:
+      // Base types
+      typedef QuadEdgeCell                   Self;
+      typedef I                              Superclass;
+      typedef itk::AutoPointer< Self >       SelfAutoPointer;
+      typedef itk::AutoPointer< const Self > ConstSelfAutoPointer;
+      typedef Self*                          RawPointer;
+      typedef const Self*                    ConstRawPointer;
+
+      // QuadEdge objects
+      typedef E                 TPrimalEdge;
+      typedef typename E::TDual TDualEdge;
+
+      // Inherited types
+      typedef typename I::PixelType                PixelType;
+      typedef typename I::CellType                 CellType;
+      typedef typename I::CellAutoPointer          CellAutoPointer;
+      typedef typename I::CellConstAutoPointer     CellConstAutoPointer;
+      typedef typename I::CellRawPointer           CellRawPointer;
+      typedef typename I::CellConstRawPointer      CellConstRawPointer;
+      typedef typename I::CellTraits               CellTraits;
+      typedef typename I::CoordRepType             CoordRepType;
+      typedef typename I::InterpolationWeightType  InterpolationWeightType;
+      typedef typename I::PointIdentifier          PointIdentifier;
+      typedef typename I::PointIdIterator          PointIdIterator;
+      typedef typename I::PointIdConstIterator     PointIdConstIterator;
+      typedef typename I::CellIdentifier           CellIdentifier;
+      typedef typename I::CellFeatureIdentifier    CellFeatureIdentifier;
+      typedef typename I::CellFeatureIdentifier    CellFeatureCount;
+      typedef typename I::PointType                PointType;
+      typedef typename I::VectorType               VectorType;
+      typedef typename I::PointsContainer          PointsContainer;
+      typedef typename I::UsingCellsContainer      UsingCellsContainer;
+      typedef typename I::CellGeometry             CellGeometry;
+      typedef typename I::ParametricCoordArrayType ParametricCoordArrayType;
+      typedef typename I::ShapeFunctionsArrayType  ShapeFunctionsArrayType;
+
+      itkStaticConstMacro( PointDimension, unsigned int, I::PointDimension );
+      itkStaticConstMacro( CellDimension, unsigned int, 2 );
+
+    public:
+      itkTypeMacro( QuadEdgeCell, I );
+
+    public:
+      QuadEdgeCell( );
+      QuadEdgeCell( E* entry );
+      virtual ~QuadEdgeCell( );
+
+      /// Implement the standard CellInterface.
+      virtual CellGeometry GetType( ) const;
+      virtual void MakeCopy( CellAutoPointer& other ) const;
+      virtual unsigned int GetDimension( ) const;
+      virtual unsigned int GetNumberOfPoints( ) const;
+      virtual CellFeatureCount GetNumberOfBoundaryFeatures(
+        int dimension
+        ) const;
+      virtual bool GetBoundaryFeature(
+        int dimension, CellFeatureIdentifier fId, CellAutoPointer& ptr
+        );
+      virtual void SetPointIds( PointIdConstIterator first );
+      virtual void SetPointIds(
+        PointIdConstIterator first, PointIdConstIterator last
+        );
+      virtual void AddPointId( PointIdentifier pId );
+      virtual void RemovePointId( PointIdentifier pId );
+      virtual void SetPointIds(
+        int dummy, int num, PointIdConstIterator first
+        );
+      virtual void BuildEdges( );
+      virtual void ClearPoints( );
+      virtual void SetPointId( int localId, PointIdentifier pId );
+
+      // Visitor methods
+      static int GetTopologyId( );
+      virtual void Accept(
+        CellIdentifier cellid,
+        typename itk::CellInterface< PixelType, CellTraits >::
+        MultiVisitor* mv
+        );
+
+      // Iterators
+      virtual PointIdIterator      PointIdsBegin( );
+      virtual PointIdConstIterator PointIdsBegin( ) const;
+      virtual PointIdIterator      PointIdsEnd( );
+      virtual PointIdConstIterator PointIdsEnd( ) const;
+
+      /// QuadEdgeCell-specific interface.
+      virtual E* GetEntryPrimalEdge( );
+      virtual const E* GetEntryPrimalEdge( ) const;
+      virtual void SetEntryPrimalEdge( E* entry );
+
+    private:
+      /// Purposely not implemented.
+    QuadEdgeCell( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      E* m_EntryEdge;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 9f0973b1b5165c37143b0e9f4f86f679cad757d7..c1a06a73691d5cc43a6060fbc0fb151b15a73b26 100644 (file)
   cpPluginsExtensionsQEPointIteratorsMacro( op, Iterator, ConstIterator );
 
 namespace cpExtensions
+{
+  namespace DataStructures
   {
-    namespace DataStructures
+    /**
+     */
+    template< class E >
+    class QuadEdgeBaseIterator
     {
-      /**
-       */
-      template< class E >
-      class QuadEdgeBaseIterator
-      {
-      public:
-        typedef QuadEdgeBaseIterator Self;
-        typedef E                    TQuadEdge;
-
-        // Different types of logical iterators
-        enum
-        {
-          OpOnext = 0,
-          OpLnext = 1,
-          OpRnext = 2,
-          OpDnext = 3,
-          OpOprev = 4,
-          OpLprev = 5,
-          OpRprev = 6,
-          OpDprev = 7
-        };
-
-      public:
-        QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true );
-        virtual ~QuadEdgeBaseIterator( );
-        Self& operator=( const Self& r );
-
-        E*   GetStartEdge( ) const;
-        E*   GetIterator( ) const;
-        int  GetOpType( ) const;
-        bool GetStart( ) const;
-
-        bool  operator==( Self& r );
-        bool  operator==( const Self& r ) const;
-        bool  operator!=( Self& r );
-        bool  operator!=( const Self& r ) const;
-        Self& operator++( );
-        Self& operator++( int );
-
-      protected:
-        /// Method that should do all the iteration work
-      virtual void _GoToNext( );
-
-      protected:
-        E*   m_StartEdge; /**< Start edge */
-        E*   m_Iterator;  /**< Current iteration position */
-        int  m_OpType;    /**< Operation type */
-        bool m_Start;     /**< Indicates iteration has just started */
-      };
-
-      /**
-       */
-      template< class E >
-      class QuadEdgeIterator
-        : public QuadEdgeBaseIterator< E >
-      {
-      public:
-        typedef QuadEdgeIterator          Self;
-        typedef QuadEdgeBaseIterator< E > Superclass;
-        typedef E                         TQuadEdge;
-
-      public:
-        QuadEdgeIterator(
-          E* e = NULL, int op = Superclass::OpOnext, bool start = true
-          );
-        virtual ~QuadEdgeIterator( );
-        E* operator*( );
-      };
-
-      /**
-       */
-      template< class E >
-      class QuadEdgeConstIterator
-        : public QuadEdgeBaseIterator< const E >
-      {
-      public:
-        typedef QuadEdgeConstIterator           Self;
-        typedef QuadEdgeBaseIterator< const E > Superclass;
-        typedef E                               TQuadEdge;
-
-      public:
-        QuadEdgeConstIterator(
-          const E* e = NULL, int op = Superclass::OpOnext, bool start = true
-          );
-        virtual ~QuadEdgeConstIterator( );
-        const E* operator*( ) const;
-      };
+    public:
+      typedef QuadEdgeBaseIterator Self;
+      typedef E                    TQuadEdge;
 
-      /**
-       */
-      template< class E >
-      class QuadEdgePointIterator
-        : public QuadEdgeBaseIterator< const E >
+      // Different types of logical iterators
+      enum
       {
-      public:
-        typedef QuadEdgePointIterator           Self;
-        typedef QuadEdgeBaseIterator< const E > Superclass;
-        typedef E                               TQuadEdge;
-
-      public:
-        QuadEdgePointIterator(
-          const E* e = NULL, int op = Superclass::OpOnext, bool start = true
-          );
-        virtual ~QuadEdgePointIterator( );
-        typename E::TPrimalGeometry& operator*( );
+        OpOnext = 0,
+        OpLnext = 1,
+        OpRnext = 2,
+        OpDnext = 3,
+        OpOprev = 4,
+        OpLprev = 5,
+        OpRprev = 6,
+        OpDprev = 7
       };
 
-      /**
-       */
-      template< class E >
-      class QuadEdgePointConstIterator
-        : public QuadEdgeBaseIterator< const E >
-      {
-      public:
-        typedef QuadEdgePointConstIterator      Self;
-        typedef QuadEdgeBaseIterator< const E > Superclass;
-        typedef E                               TQuadEdge;
-
-      public:
-        QuadEdgePointConstIterator(
-          const E* e = NULL, int op = Superclass::OpOnext, bool start = true
-          );
-        virtual ~QuadEdgePointConstIterator( );
-        const typename E::TPrimalGeometry& operator*( ) const;
-      };
-
-    } // ecapseman
+    public:
+      QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true );
+      virtual ~QuadEdgeBaseIterator( );
+      Self& operator=( const Self& r );
+
+      E*   GetStartEdge( ) const;
+      E*   GetIterator( ) const;
+      int  GetOpType( ) const;
+      bool GetStart( ) const;
+
+      bool  operator==( Self& r );
+      bool  operator==( const Self& r ) const;
+      bool  operator!=( Self& r );
+      bool  operator!=( const Self& r ) const;
+      Self& operator++( );
+      Self& operator++( int );
+
+    protected:
+      /// Method that should do all the iteration work
+    virtual void _GoToNext( );
+
+    protected:
+      E*   m_StartEdge; /**< Start edge */
+      E*   m_Iterator;  /**< Current iteration position */
+      int  m_OpType;    /**< Operation type */
+      bool m_Start;     /**< Indicates iteration has just started */
+    };
+
+    /**
+     */
+    template< class E >
+    class QuadEdgeIterator
+      : public QuadEdgeBaseIterator< E >
+    {
+    public:
+      typedef QuadEdgeIterator          Self;
+      typedef QuadEdgeBaseIterator< E > Superclass;
+      typedef E                         TQuadEdge;
+
+    public:
+      QuadEdgeIterator(
+        E* e = NULL, int op = Superclass::OpOnext, bool start = true
+        );
+      virtual ~QuadEdgeIterator( );
+      E* operator*( );
+    };
+
+    /**
+     */
+    template< class E >
+    class QuadEdgeConstIterator
+      : public QuadEdgeBaseIterator< const E >
+    {
+    public:
+      typedef QuadEdgeConstIterator           Self;
+      typedef QuadEdgeBaseIterator< const E > Superclass;
+      typedef E                               TQuadEdge;
+
+    public:
+      QuadEdgeConstIterator(
+        const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+        );
+      virtual ~QuadEdgeConstIterator( );
+      const E* operator*( ) const;
+    };
+
+    /**
+     */
+    template< class E >
+    class QuadEdgePointIterator
+      : public QuadEdgeBaseIterator< const E >
+    {
+    public:
+      typedef QuadEdgePointIterator           Self;
+      typedef QuadEdgeBaseIterator< const E > Superclass;
+      typedef E                               TQuadEdge;
+
+    public:
+      QuadEdgePointIterator(
+        const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+        );
+      virtual ~QuadEdgePointIterator( );
+      typename E::TPrimalGeometry& operator*( );
+    };
+
+    /**
+     */
+    template< class E >
+    class QuadEdgePointConstIterator
+      : public QuadEdgeBaseIterator< const E >
+    {
+    public:
+      typedef QuadEdgePointConstIterator      Self;
+      typedef QuadEdgeBaseIterator< const E > Superclass;
+      typedef E                               TQuadEdge;
+
+    public:
+      QuadEdgePointConstIterator(
+        const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+        );
+      virtual ~QuadEdgePointConstIterator( );
+      const typename E::TPrimalGeometry& operator*( ) const;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 977bc5d0e9db222f987db9bb882d93d8fa6d54fe..7ce48fe6fa534f93af9989d289dce107d2b7b694 100644 (file)
 #include <cpExtensions/DataStructures/QuadEdge.h>
 
 namespace cpExtensions
+{
+  namespace DataStructures
   {
-    namespace DataStructures
+    /**
+     */
+    template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
+    class QuadEdgeMesh
+      : public itk::Mesh< P, D, T >
     {
-      /**
-       */
-      template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
-      class QuadEdgeMesh
-        : public itk::Mesh< P, D, T >
-      {
-      public:
-        typedef QuadEdgeMesh                    Self;
-        typedef itk::Mesh< P, D, T >            Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        /// Types from superclass
-        typedef typename
-        Superclass::BoundaryAssignmentsContainer
-        BoundaryAssignmentsContainer;
-
-        typedef typename
-        Superclass::BoundaryAssignmentsContainerPointer
-        BoundaryAssignmentsContainerPointer;
-
-        typedef typename Superclass::BoundingBoxType       BoundingBoxType;
-        typedef typename Superclass::CellAutoPointer       CellAutoPointer;
-        typedef typename Superclass::CellsContainer        CellsContainer;
-        typedef typename Superclass::CellDataContainer     CellDataContainer;
-        typedef typename Superclass::CellFeatureCount      CellFeatureCount;
-        typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
-        typedef typename Superclass::CellIdentifier        CellIdentifier;
-        typedef typename Superclass::CellLinksContainer    CellLinksContainer;
-        typedef typename Superclass::CellMultiVisitorType  CellMultiVisitorType;
-        typedef typename Superclass::CellPixelType         CellPixelType;
-        typedef typename Superclass::CellType              CellType;
-        typedef typename Superclass::PointIdentifier       PointIdentifier;
-        typedef typename Superclass::PointsContainer       PointsContainer;
-        typedef typename Superclass::PointType             PointType;
-
-        /// QuadEdge types (primal and dual)
-        typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
-        typedef typename TPrimalEdge::TDual                 TDualEdge;
-        typedef QuadEdgeCell< CellType, TPrimalEdge >       TQuadEdgeCell;
-
-        /// Memory management objects
-        typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
-        typedef std::set< typename TDualEdge::Pointer >   CntDualEdges;
-        typedef std::vector< TPrimalEdge* > CntOnextRings;
-
-        /// More geometry types
-        typedef typename PointType::VectorType      VectorType;
-        typedef typename VectorType::ValueType      TScalar;
-        typedef std::vector< VectorType >           CntNormals;
-        typedef typename CntNormals::const_iterator NormalsIterator;
-
-      protected:
-        typedef std::vector< TPrimalEdge* > _TEdges;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( QuadEdgeMesh, itkMesh );
-
-      public:
-        // Edge related methods
-        TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
-        TPrimalEdge* FindEdge(
-          const PointIdentifier& a, const PointIdentifier& b
-          ) const;
-        TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
-
-        /// New geometric methods
-        const CntNormals& GetPointNormalsContainer( ) const;
-        NormalsIterator BeginPointNormals( ) const;
-        NormalsIterator EndPointNormals( ) const;
-        const VectorType& GetPointNormal( const PointIdentifier& id ) const;
-
-        /// itk::DataObject methods overloading 
-        virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
-
-        /// itk::PointSet methods overloading 
-        virtual void SetPoints( PointsContainer* points );
-        virtual void SetPoint( PointIdentifier id , PointType point );
-
-        /// itk::Mesh methods overloading
-        virtual void PassStructure( Self* inputMesh )
-          {
-            std::cout << "PassStructure" << std::endl;
-            std::exit( 1 );
-          }
-
-        virtual void Initialize( );
-        virtual void Graft( const itk::DataObject* data );
-
-        void SetCellLinks( CellLinksContainer* cellLinks )
-          {
-            std::cout << "SetCellLinks" << std::endl;
-            std::exit( 1 );
-          }
-        virtual CellLinksContainer* GetCellLinks( )
-          {
-            std::cout << "GetCellLinks" << std::endl;
-            std::exit( 1 );
-          }
-        virtual const CellLinksContainer* GetCellLinks( ) const
-          {
-            std::cout << "GetCellLinks (const)" << std::endl;
-            std::exit( 1 );
-          }
-        virtual void SetCells( CellsContainer* cells );
-        virtual void SetCellData( CellDataContainer* data );
-        virtual CellDataContainer* GetCellData( )
-          {
-            std::cout << "GetCellData" << std::endl;
-            std::exit( 1 );
-          }
-        virtual const CellDataContainer* GetCellData( ) const
-          {
-            std::cout << "GetCellData (const)" << std::endl;
-            std::exit( 1 );
-          }
+    public:
+      typedef QuadEdgeMesh                    Self;
+      typedef itk::Mesh< P, D, T >            Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      /// Types from superclass
+      typedef typename
+      Superclass::BoundaryAssignmentsContainer
+      BoundaryAssignmentsContainer;
+
+      typedef typename
+      Superclass::BoundaryAssignmentsContainerPointer
+      BoundaryAssignmentsContainerPointer;
+
+      typedef typename Superclass::BoundingBoxType       BoundingBoxType;
+      typedef typename Superclass::CellAutoPointer       CellAutoPointer;
+      typedef typename Superclass::CellsContainer        CellsContainer;
+      typedef typename Superclass::CellDataContainer     CellDataContainer;
+      typedef typename Superclass::CellFeatureCount      CellFeatureCount;
+      typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
+      typedef typename Superclass::CellIdentifier        CellIdentifier;
+      typedef typename Superclass::CellLinksContainer    CellLinksContainer;
+      typedef typename Superclass::CellMultiVisitorType  CellMultiVisitorType;
+      typedef typename Superclass::CellPixelType         CellPixelType;
+      typedef typename Superclass::CellType              CellType;
+      typedef typename Superclass::PointIdentifier       PointIdentifier;
+      typedef typename Superclass::PointsContainer       PointsContainer;
+      typedef typename Superclass::PointType             PointType;
+
+      /// QuadEdge types (primal and dual)
+      typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
+      typedef typename TPrimalEdge::TDual                 TDualEdge;
+      typedef QuadEdgeCell< CellType, TPrimalEdge >       TQuadEdgeCell;
+
+      /// Memory management objects
+      typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
+      typedef std::set< typename TDualEdge::Pointer >   CntDualEdges;
+      typedef std::vector< TPrimalEdge* > CntOnextRings;
+
+      /// More geometry types
+      typedef typename PointType::VectorType      VectorType;
+      typedef typename VectorType::ValueType      TScalar;
+      typedef std::vector< VectorType >           CntNormals;
+      typedef typename CntNormals::const_iterator NormalsIterator;
+
+    protected:
+      typedef std::vector< TPrimalEdge* > _TEdges;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( QuadEdgeMesh, itkMesh );
+
+    public:
+      // Edge related methods
+      TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
+      TPrimalEdge* FindEdge(
+        const PointIdentifier& a, const PointIdentifier& b
+        ) const;
+      TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
+
+      /// New geometric methods
+      const CntNormals& GetPointNormalsContainer( ) const;
+      NormalsIterator BeginPointNormals( ) const;
+      NormalsIterator EndPointNormals( ) const;
+      const VectorType& GetPointNormal( const PointIdentifier& id ) const;
+
+      /// itk::DataObject methods overloading
+      virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
+
+      /// itk::PointSet methods overloading
+      virtual void SetPoints( PointsContainer* points );
+      virtual void SetPoint( PointIdentifier id , PointType point );
+
+      /// itk::Mesh methods overloading
+      virtual void PassStructure( Self* inputMesh )
+        {
+          std::cout << "PassStructure" << std::endl;
+          std::exit( 1 );
+        }
+
+      virtual void Initialize( );
+      virtual void Graft( const itk::DataObject* data );
+
+      void SetCellLinks( CellLinksContainer* cellLinks )
+        {
+          std::cout << "SetCellLinks" << std::endl;
+          std::exit( 1 );
+        }
+      virtual CellLinksContainer* GetCellLinks( )
+        {
+          std::cout << "GetCellLinks" << std::endl;
+          std::exit( 1 );
+        }
+      virtual const CellLinksContainer* GetCellLinks( ) const
+        {
+          std::cout << "GetCellLinks (const)" << std::endl;
+          std::exit( 1 );
+        }
+      virtual void SetCells( CellsContainer* cells );
+      virtual void SetCellData( CellDataContainer* data );
+      virtual CellDataContainer* GetCellData( )
+        {
+          std::cout << "GetCellData" << std::endl;
+          std::exit( 1 );
+        }
+      virtual const CellDataContainer* GetCellData( ) const
+        {
+          std::cout << "GetCellData (const)" << std::endl;
+          std::exit( 1 );
+        }
 
 #if !defined( CABLE_CONFIGURATION )
-        virtual void SetBoundaryAssignments(
-          int dimension, BoundaryAssignmentsContainer* container
-          )
-          {
-            std::cout << "SetBoundaryAssignments" << std::endl;
-            std::exit( 1 );
-          }
-        virtual BoundaryAssignmentsContainerPointer
-        GetBoundaryAssignments( int dimension )
-          {
-            std::cout << "GetBoundaryAssignments" << std::endl;
-            std::exit( 1 );
-          }
-        virtual const BoundaryAssignmentsContainerPointer
-        GetBoundaryAssignments( int dimension ) const
-          {
-            std::cout << "GetBoundaryAssignments (const)" << std::endl;
-            std::exit( 1 );
-          }
+      virtual void SetBoundaryAssignments(
+        int dimension, BoundaryAssignmentsContainer* container
+        )
+        {
+          std::cout << "SetBoundaryAssignments" << std::endl;
+          std::exit( 1 );
+        }
+      virtual BoundaryAssignmentsContainerPointer
+      GetBoundaryAssignments( int dimension )
+        {
+          std::cout << "GetBoundaryAssignments" << std::endl;
+          std::exit( 1 );
+        }
+      virtual const BoundaryAssignmentsContainerPointer
+      GetBoundaryAssignments( int dimension ) const
+        {
+          std::cout << "GetBoundaryAssignments (const)" << std::endl;
+          std::exit( 1 );
+        }
 #endif
 
-        virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
-        virtual void SetCellData( CellIdentifier id, CellPixelType data );
-        virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
-          {
-            std::cout << "GetCellData" << std::endl;
-            std::exit( 1 );
-          }
-        virtual void SetBoundaryAssignment(
-          int dimension, CellIdentifier cellId,
-          CellFeatureIdentifier featureId,
-          CellIdentifier boundaryId
-          )
-          {
-            std::cout << "SetBoundaryAssignment" << std::endl;
-            std::exit( 1 );
-          }
-        virtual bool GetBoundaryAssignment(
-          int dimension, CellIdentifier cellId,
-          CellFeatureIdentifier featureId,
-          CellIdentifier* boundaryId
-          ) const
-          {
-            std::cout << "GetBoundaryAssignment" << std::endl;
-            std::exit( 1 );
-          }
-        virtual bool RemoveBoundaryAssignment(
-          int dimension, CellIdentifier cellId,
-          CellFeatureIdentifier featureId
-          )
-          {
-            std::cout << "RemoveBoundaryAssignment" << std::endl;
-            std::exit( 1 );
-          }
-        virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
-          int dimension,
-          CellIdentifier id
-          ) const
-          {
-            std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
-            std::exit( 1 );
-          }
-        virtual bool GetCellBoundaryFeature(
-          int dimension, CellIdentifier id,
-          CellFeatureIdentifier fid,
-          CellAutoPointer& ptr
-          ) const
-          {
-            std::cout << "GetCellBoundaryFeature" << std::endl;
-            std::exit( 1 );
-          }
-        virtual CellIdentifier GetCellBoundaryFeatureNeighbors( 
-          int dimension,
-          CellIdentifier id,
-          CellFeatureIdentifier fid,
-          std::set< CellIdentifier >* cellSet )
-          {
-            std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
-            std::exit( 1 );
-          }
-        virtual CellIdentifier GetCellNeighbors(
-          CellIdentifier cellId,
-          std::set< CellIdentifier >* cellSet
-          )
-          {
-            std::cout << "GetCellNeighbors" << std::endl;
-            std::exit( 1 );
-          }
-        virtual bool GetAssignedCellBoundaryIfOneExists(
-          int dimension, CellIdentifier id,
-          CellFeatureIdentifier fid,
-          CellAutoPointer& ptr
-          ) const
-          {
-            std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
-            std::exit( 1 );
-          }
-        virtual void BuildCellLinks( ) const;
-
-        virtual void Accept( CellMultiVisitorType* mv ) const
-          {
-            std::cout << "Accept" << std::endl;
-            std::exit( 1 );
-          }
-
-      protected:
-        QuadEdgeMesh( );
-        virtual ~QuadEdgeMesh( );
-
-        virtual void ReleaseCellsMemory( )
-          {
-            std::cout << "ReleaseCellsMemory" << std::endl;
-            std::exit( 1 );
-          }
-
-        inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
-        inline void _DeletePoint( const PointIdentifier& pId );
-        inline TPrimalEdge* _CreateQuadEdge(
-          const PointIdentifier& a, const PointIdentifier& b
-          );
-        inline void _DeleteEdge( TPrimalEdge* edge );
-        inline void _DeleteFace( const CellIdentifier& f );
-        inline void _ConstructEdges(
-          _TEdges& edges, const CellAutoPointer& ptr
-          );
-        virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
-        inline void _ReleaseQuadEdgeObjects( );
-
-      private:
-        QuadEdgeMesh( const Self& );   // Not implemented
-        void operator=( const Self& ); // Not implemented
-
-      protected:
-        CntPrimalEdges m_PrimalEdges;
-        CntDualEdges   m_DualEdges;
-
-        CntOnextRings m_OnextRings;
-
-        CntNormals m_PointNormals;
-      };
-
-    } // ecapseman
+      virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
+      virtual void SetCellData( CellIdentifier id, CellPixelType data );
+      virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
+        {
+          std::cout << "GetCellData" << std::endl;
+          std::exit( 1 );
+        }
+      virtual void SetBoundaryAssignment(
+        int dimension, CellIdentifier cellId,
+        CellFeatureIdentifier featureId,
+        CellIdentifier boundaryId
+        )
+        {
+          std::cout << "SetBoundaryAssignment" << std::endl;
+          std::exit( 1 );
+        }
+      virtual bool GetBoundaryAssignment(
+        int dimension, CellIdentifier cellId,
+        CellFeatureIdentifier featureId,
+        CellIdentifier* boundaryId
+        ) const
+        {
+          std::cout << "GetBoundaryAssignment" << std::endl;
+          std::exit( 1 );
+        }
+      virtual bool RemoveBoundaryAssignment(
+        int dimension, CellIdentifier cellId,
+        CellFeatureIdentifier featureId
+        )
+        {
+          std::cout << "RemoveBoundaryAssignment" << std::endl;
+          std::exit( 1 );
+        }
+      virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
+        int dimension,
+        CellIdentifier id
+        ) const
+        {
+          std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
+          std::exit( 1 );
+        }
+      virtual bool GetCellBoundaryFeature(
+        int dimension, CellIdentifier id,
+        CellFeatureIdentifier fid,
+        CellAutoPointer& ptr
+        ) const
+        {
+          std::cout << "GetCellBoundaryFeature" << std::endl;
+          std::exit( 1 );
+        }
+      virtual CellIdentifier GetCellBoundaryFeatureNeighbors(
+        int dimension,
+        CellIdentifier id,
+        CellFeatureIdentifier fid,
+        std::set< CellIdentifier >* cellSet )
+        {
+          std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
+          std::exit( 1 );
+        }
+      virtual CellIdentifier GetCellNeighbors(
+        CellIdentifier cellId,
+        std::set< CellIdentifier >* cellSet
+        )
+        {
+          std::cout << "GetCellNeighbors" << std::endl;
+          std::exit( 1 );
+        }
+      virtual bool GetAssignedCellBoundaryIfOneExists(
+        int dimension, CellIdentifier id,
+        CellFeatureIdentifier fid,
+        CellAutoPointer& ptr
+        ) const
+        {
+          std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
+          std::exit( 1 );
+        }
+      virtual void BuildCellLinks( ) const;
+
+      virtual void Accept( CellMultiVisitorType* mv ) const
+        {
+          std::cout << "Accept" << std::endl;
+          std::exit( 1 );
+        }
+
+    protected:
+      QuadEdgeMesh( );
+      virtual ~QuadEdgeMesh( );
+
+      virtual void ReleaseCellsMemory( )
+        {
+          std::cout << "ReleaseCellsMemory" << std::endl;
+          std::exit( 1 );
+        }
+
+      inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
+      inline void _DeletePoint( const PointIdentifier& pId );
+      inline TPrimalEdge* _CreateQuadEdge(
+        const PointIdentifier& a, const PointIdentifier& b
+        );
+      inline void _DeleteEdge( TPrimalEdge* edge );
+      inline void _DeleteFace( const CellIdentifier& f );
+      inline void _ConstructEdges(
+        _TEdges& edges, const CellAutoPointer& ptr
+        );
+      virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
+      inline void _ReleaseQuadEdgeObjects( );
+
+    private:
+      QuadEdgeMesh( const Self& );   // Not implemented
+      void operator=( const Self& ); // Not implemented
+
+    protected:
+      CntPrimalEdges m_PrimalEdges;
+      CntDualEdges   m_DualEdges;
+
+      CntOnextRings m_OnextRings;
+
+      CntNormals m_PointNormals;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 94880a9644f67ed4f0065128a62e0eb9dc84a9d5..d6e8e1fadbd4bb0fe32c9c45f50a4678bb40dc9f 100644 (file)
@@ -5,53 +5,53 @@
 #include <itkMeshSource.h>
 
 namespace cpExtensions
+{
+  namespace IO
   {
-    namespace IO
+    /**
+     */
+    template< typename M >
+    class MeshReader
+      : public itk::MeshSource< M >
     {
-      /**
-       */
-      template< typename M >
-      class MeshReader
-        : public itk::MeshSource< M >
-      {
-      public:
-        typedef MeshReader                      Self;
-        typedef itk::MeshSource< M >            Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef M MeshType;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( MeshReader, itkMeshSource );
-
-        itkSetStringMacro( FileName );
-        itkGetStringMacro( FileName );
-
-      public:
-        virtual itk::ModifiedTimeType GetMTime( ) const;
-
-      protected:
-        MeshReader( );
-        virtual ~MeshReader( );
-
-        virtual void GenerateData( );
-
-        template< class R >
-        void _Read( );
-
-      private:
-        // Purposely not implemented
-        MeshReader( const Self& );
-        Self& operator=( const Self & );
-
-      protected:
-        typename Superclass::Pointer m_Reader;
-        std::string m_FileName;
-      };
-
-    } // ecapseman
+    public:
+      typedef MeshReader                      Self;
+      typedef itk::MeshSource< M >            Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef M MeshType;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( MeshReader, itkMeshSource );
+
+      itkSetStringMacro( FileName );
+      itkGetStringMacro( FileName );
+
+    public:
+      virtual itk::ModifiedTimeType GetMTime( ) const;
+
+    protected:
+      MeshReader( );
+      virtual ~MeshReader( );
+
+      virtual void GenerateData( );
+
+      template< class R >
+      void _Read( );
+
+    private:
+      // Purposely not implemented
+      MeshReader( const Self& );
+      Self& operator=( const Self & );
+
+    protected:
+      typename Superclass::Pointer m_Reader;
+      std::string m_FileName;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 9ce320d19b90f37a2bf4d355d9bc1f9c1a6ce9cb..98274d8cc81db19906f8db326ac88c0a264810e3 100644 (file)
@@ -8,67 +8,67 @@
 #include <itkPolygonCell.h>
 
 namespace cpExtensions
+{
+  namespace IO
   {
-    namespace IO
+    /**
+     * \class WaveFrontOBJReader
+     * \brief
+     * Reads a wavefront OBJ file and create an itkMesh.
+     *
+     * Caveat1: itkWaveFrontOBJReader will read only vertices and faces.
+     *          Normal, parameters and textures vectors are ignored.
+     *
+     */
+    template< typename M >
+    class WaveFrontOBJReader
+      : public itk::MeshSource< M >
     {
-      /**
-       * \class WaveFrontOBJReader
-       * \brief
-       * Reads a wavefront OBJ file and create an itkMesh.
-       *
-       * Caveat1: itkWaveFrontOBJReader will read only vertices and faces.
-       *          Normal, parameters and textures vectors are ignored.
-       *
-       */
-      template< typename M >
-      class WaveFrontOBJReader
-        : public itk::MeshSource< M >
-      {
-      public:
-        typedef WaveFrontOBJReader              Self;
-        typedef itk::MeshSource< M >            Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
+    public:
+      typedef WaveFrontOBJReader              Self;
+      typedef itk::MeshSource< M >            Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
-        typedef M                                    MeshType;
-        typedef typename M::MeshTraits               MeshTraits;
-        typedef typename M::PointType                PointType;
-        typedef typename MeshTraits::PixelType       PixelType;
-        typedef typename M::Pointer                  MeshPointer;
-        typedef typename M::CellTraits               CellTraits;
-        typedef typename M::CellIdentifier           CellIdentifier;
-        typedef typename M::CellType                 CellType;
-        typedef typename M::CellAutoPointer          CellAutoPointer;
-        typedef typename M::PointIdentifier          PointIdentifier;
-        typedef typename CellTraits::PointIdIterator PointIdIterator;
-        typedef typename M::PointsContainerPointer   PointsContainerPointer;
-        typedef typename M::PointsContainer          PointsContainer;
+      typedef M                                    MeshType;
+      typedef typename M::MeshTraits               MeshTraits;
+      typedef typename M::PointType                PointType;
+      typedef typename MeshTraits::PixelType       PixelType;
+      typedef typename M::Pointer                  MeshPointer;
+      typedef typename M::CellTraits               CellTraits;
+      typedef typename M::CellIdentifier           CellIdentifier;
+      typedef typename M::CellType                 CellType;
+      typedef typename M::CellAutoPointer          CellAutoPointer;
+      typedef typename M::PointIdentifier          PointIdentifier;
+      typedef typename CellTraits::PointIdIterator PointIdIterator;
+      typedef typename M::PointsContainerPointer   PointsContainerPointer;
+      typedef typename M::PointsContainer          PointsContainer;
 
-        typedef itk::PolygonCell< CellType > TPolygonCell;
+      typedef itk::PolygonCell< CellType > TPolygonCell;
 
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( WaveFrontOBJReader, itkMeshSource );
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( WaveFrontOBJReader, itkMeshSource );
 
-        itkSetStringMacro( FileName );
-        itkGetStringMacro( FileName );
+      itkSetStringMacro( FileName );
+      itkGetStringMacro( FileName );
 
-      protected:
-        WaveFrontOBJReader( );
-        virtual ~WaveFrontOBJReader( );
+    protected:
+      WaveFrontOBJReader( );
+      virtual ~WaveFrontOBJReader( );
 
-        virtual void GenerateData( );
+      virtual void GenerateData( );
 
-      private:
-        // Purposely not implemented
-        WaveFrontOBJReader( const Self& );
-        Self& operator=( const Self & );
+    private:
+      // Purposely not implemented
+      WaveFrontOBJReader( const Self& );
+      Self& operator=( const Self & );
 
-      protected:
-        std::string m_FileName;
-      };
+    protected:
+      std::string m_FileName;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 94db473d2a7084c04bfdc5aff3290a603d07af26..355f77964adfca5ec591ed6dc42fe9869b104316 100644 (file)
@@ -79,7 +79,7 @@ GenerateData( )
           pnt[ 3 ] = TScalar( std::atof( line[ 4 ].c_str( ) ) );
         else
           pnt[ 4 ] = TScalar( 1 );
-            
+
       } // fi
       out->SetPoint( out->GetNumberOfPoints( ), pnt );
     }
index 86225b56c25560efa9ec2a9eb2b171711993bc26..7812300214b975bb6b339211b2b0df39f78fa5cf 100644 (file)
@@ -20,7 +20,7 @@ public:
     {
       if( eventId == vtkCommand::KeyPressEvent )
       {
-        vtkRenderWindowInteractor* iren = 
+        vtkRenderWindowInteractor* iren =
           static_cast< vtkRenderWindowInteractor* >( caller );
         if( caller == NULL )
           return;
index 37240a7a7019bcaaa2c3140fd9505c5072bce369..2cbb9b7b7741a3ef2194bb09b3459f142019c632 100644 (file)
 #include <vtkLookupTable.h>
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    class cpExtensions_EXPORT Image3DMPR
     {
-      /**
-       */
-      class cpExtensions_EXPORT Image3DMPR
-      {
-      public:
-        Image3DMPR( );
-        virtual ~Image3DMPR( );
+    public:
+      Image3DMPR( );
+      virtual ~Image3DMPR( );
 
-        void SetImage( vtkImageData* image );
-        void SetBackground( double r, double g, double b );
-        void SetSize( unsigned int w, unsigned int h );
-        void SetWindowLevel( double w, double l );
+      void SetImage( vtkImageData* image );
+      void SetBackground( double r, double g, double b );
+      void SetSize( unsigned int w, unsigned int h );
+      void SetWindowLevel( double w, double l );
 
-        void AddPolyData( vtkPolyData* pd, double opacity = double( 1 ) );
-        void AddPolyData(
-          vtkPolyData* pd,
-          double r, double g, double b, double opacity = double( 1 )
-          );
-        void AddPolyData(
-          vtkPolyData* pd,
-          vtkLookupTable* lut,
-          double opacity = double( 1 )
-          );
+      void AddPolyData( vtkPolyData* pd, double opacity = double( 1 ) );
+      void AddPolyData(
+        vtkPolyData* pd,
+        double r, double g, double b, double opacity = double( 1 )
+        );
+      void AddPolyData(
+        vtkPolyData* pd,
+        vtkLookupTable* lut,
+        double opacity = double( 1 )
+        );
 
-        unsigned int GetNumberOfSeeds( ) const;
-        void GetSeed( int n, double* s ) const;
-        unsigned int AddSeed(
-          const double& x, const double& y, const double& z
-          ) const;
+      unsigned int GetNumberOfSeeds( ) const;
+      void GetSeed( int n, double* s ) const;
+      unsigned int AddSeed(
+        const double& x, const double& y, const double& z
+        ) const;
 
-        vtkRenderWindow* GetWindow( ) const;
-        vtkRenderer* GetRenderer( ) const;
+      vtkRenderWindow* GetWindow( ) const;
+      vtkRenderer* GetRenderer( ) const;
 
-        void Start( );
-        void Render( );
+      void Start( );
+      void Render( );
 
-      protected:
-        vtkSmartPointer< vtkImageData >              m_Image;
-        vtkSmartPointer< vtkOutlineSource >          m_Outline;
-        vtkSmartPointer< vtkPolyDataMapper >         m_OutlineMapper;
-        vtkSmartPointer< vtkActor >                  m_OutlineActor;
-        vtkSmartPointer< vtkCellPicker >             m_Picker;
-        vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetX;
-        vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetY;
-        vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetZ;
-        vtkSmartPointer< vtkRenderer >               m_Renderer;
-        vtkSmartPointer< vtkRenderWindow >           m_Window;
-        vtkSmartPointer< vtkRenderWindowInteractor > m_Interactor;
+    protected:
+      vtkSmartPointer< vtkImageData >              m_Image;
+      vtkSmartPointer< vtkOutlineSource >          m_Outline;
+      vtkSmartPointer< vtkPolyDataMapper >         m_OutlineMapper;
+      vtkSmartPointer< vtkActor >                  m_OutlineActor;
+      vtkSmartPointer< vtkCellPicker >             m_Picker;
+      vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetX;
+      vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetY;
+      vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetZ;
+      vtkSmartPointer< vtkRenderer >               m_Renderer;
+      vtkSmartPointer< vtkRenderWindow >           m_Window;
+      vtkSmartPointer< vtkRenderWindowInteractor > m_Interactor;
 
-        std::vector< vtkSmartPointer< vtkPolyData > >       m_PolyDatas;
-        std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_Mappers;
-        std::vector< vtkSmartPointer< vtkActor > >          m_Actors;
+      std::vector< vtkSmartPointer< vtkPolyData > >       m_PolyDatas;
+      std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_Mappers;
+      std::vector< vtkSmartPointer< vtkActor > >          m_Actors;
 
-        // Create the widget and its representation
-        vtkSmartPointer< vtkPointHandleRepresentation3D >
-          m_SeedHandleRepresentation;
-        vtkSmartPointer< vtkSeedRepresentation > m_SeedRepresentation;
-        vtkSmartPointer< vtkSeedWidget >         m_SeedWidget;
-      };
+      // Create the widget and its representation
+      vtkSmartPointer< vtkPointHandleRepresentation3D >
+        m_SeedHandleRepresentation;
+      vtkSmartPointer< vtkSeedRepresentation > m_SeedRepresentation;
+      vtkSmartPointer< vtkSeedWidget >         m_SeedWidget;
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index 33999255c599b996c779e59c2fd5f556d4a3da09..236fb43144f92da41dce1a664bb67e7578edd9d1 100644 (file)
@@ -123,7 +123,7 @@ OnMouseMove( )
 {
   if( this->m_MPRActors == NULL )
     return;
-  
+
   if( this->CursorMoving )
   {
     bool picked = this->_PickPosition( this->Cursor );
index 3a36885c554ee6fe9012e90cca3ffdd86ea0681a..df8422c72b273acdb652535c8e80961beaeb1c73 100644 (file)
 #include <cpExtensions/cpExtensions_Export.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageInteractorStyle_ObserverMacro( e )               \
-  inline unsigned long Add##e##Observer( vtkCommand* observer )         \
-  { return( this->AddObserver( Self::e##Event, observer ) ); }          \
-  inline void Remove##e##Observer( unsigned long tag )                  \
-  { this->RemoveObserver( tag ); }                                      \
-  inline void Remove##e##Observer( vtkCommand* observer )               \
-  { this->RemoveObserver( observer ); }                                 \
-  inline void Remove##e##Observers( )                                   \
+#define cpPlugins_ImageInteractorStyle_ObserverMacro( e )       \
+  inline unsigned long Add##e##Observer( vtkCommand* observer ) \
+  { return( this->AddObserver( Self::e##Event, observer ) ); }  \
+  inline void Remove##e##Observer( unsigned long tag )          \
+  { this->RemoveObserver( tag ); }                              \
+  inline void Remove##e##Observer( vtkCommand* observer )       \
+  { this->RemoveObserver( observer ); }                         \
+  inline void Remove##e##Observers( )                           \
   { this->RemoveObservers( Self::e##Event ); }
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    class ImageSliceActors;
+    class MPRActors;
+
+    /**
+     */
+    class cpExtensions_EXPORT ImageInteractorStyle
+      : public vtkInteractorStyleImage
     {
-      class ImageSliceActors;
-      class MPRActors;
+    public:
+      typedef ImageInteractorStyle Self;
 
-      /**
-       */
-      class cpExtensions_EXPORT ImageInteractorStyle
-        : public vtkInteractorStyleImage
+      enum InteractionMode
       {
-      public:
-        typedef ImageInteractorStyle Self;
-
-        enum InteractionMode
-        {
-          NavigationMode = 0,
-          DeformationMode
-        };
-
-      public:
-        vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
-
-        cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick );
-        cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor );
-        cpPlugins_ImageInteractorStyle_ObserverMacro( Radius );
-
-      public:
-        static Self* New( );
-
-        void Configure(
-          ImageSliceActors* slice_actors,
-          MPRActors* mpr_actors = NULL
-          );
-        void AssociateInteractor( vtkRenderWindowInteractor* interactor );
-
-        void SetModeToNavigation( );
-        void SetModeToDeformation( );
-        virtual void SetInteractor(
-          vtkRenderWindowInteractor* interactor, const int& axis
-          );
-
-        // Description:
-        // Event bindings controlling the effects of pressing mouse buttons
-        // or moving the mouse.
-        virtual void OnMouseMove( );
-        virtual void OnLeftButtonDown( );
-        virtual void OnLeftButtonUp( );
-        virtual void OnMiddleButtonDown( );
-        virtual void OnMiddleButtonUp( );
-        virtual void OnRightButtonDown( );
-        virtual void OnRightButtonUp( );
-        virtual void OnMouseWheelForward( );
-        virtual void OnMouseWheelBackward( );
-
-        // Description:
-        // Override the "fly-to" (f keypress) for images.
-        virtual void OnChar( );
-
-        // These methods for the different interactions in different modes
-        // are overridden in subclasses to perform the correct motion. Since
-        // they might be called from OnTimer, they do not have mouse coord
-        // parameters (use interactor's GetEventPosition and
-        // GetLastEventPosition)
-
-        virtual void Rotate( ) { }
-        virtual void Spin( )   { }
-        virtual void Zoom( )   { }
-        virtual void Pick( )   { }
-        virtual void Slice( )  { }
-        virtual void WindowLevel( );
-
-        // Interaction mode entry points used internally.
-        virtual void StartPick( )  { }
-        virtual void EndPick( )    { }
-        virtual void StartSlice( ) { }
-        virtual void EndSlice( )   { }
-        virtual void StartWindowLevel( );
-        virtual void EndWindowLevel( );
-
-        // New events
-        virtual void StartCursorMoving( );
-        virtual void EndCursorMoving( );
-        virtual void StartRadiusMoving( );
-        virtual void EndRadiusMoving( );
-
-      protected:
-        ImageInteractorStyle( );
-        virtual ~ImageInteractorStyle( );
-
-        void _RenderAssociateInteractors( );
-        bool _PickPosition( double pos[ 3 ] );
-        void _UpdateCursor( );
-        void _UpdateRadius( );
-
-      private:
-        // Purposely not implemented
-        ImageInteractorStyle( const Self& );
-        Self& operator=( const Self& );
-
-      protected:
-        Self::InteractionMode Mode;
-
-        ImageSliceActors* m_SliceActors;
-        MPRActors*        m_MPRActors;
-
-        vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
-        vtkSmartPointer< vtkPropPicker > PropPicker;
-
-        std::vector< vtkRenderWindowInteractor* > AssociatedInteractors;
-
-        bool CursorMoving;
-        double Cursor[ 3 ];
-
-        bool RadiusMoving;
-        double Radius[ 3 ];
-        vtkSmartPointer< vtkPolyData > Circle;
-        vtkSmartPointer< vtkPolyDataMapper > CircleMapper;
-        vtkSmartPointer< vtkActor > CircleActor;
-
-      public:
-        static const int CursorEvent;
-        static const int RadiusEvent;
-        static const int DoubleClickEvent;
+        NavigationMode = 0,
+        DeformationMode
       };
 
-    } // ecapseman
+    public:
+      vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
+
+      cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick );
+      cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor );
+      cpPlugins_ImageInteractorStyle_ObserverMacro( Radius );
+
+    public:
+      static Self* New( );
+
+      void Configure(
+        ImageSliceActors* slice_actors,
+        MPRActors* mpr_actors = NULL
+        );
+      void AssociateInteractor( vtkRenderWindowInteractor* interactor );
+
+      void SetModeToNavigation( );
+      void SetModeToDeformation( );
+      virtual void SetInteractor(
+        vtkRenderWindowInteractor* interactor, const int& axis
+        );
+
+      // Description:
+      // Event bindings controlling the effects of pressing mouse buttons
+      // or moving the mouse.
+      virtual void OnMouseMove( );
+      virtual void OnLeftButtonDown( );
+      virtual void OnLeftButtonUp( );
+      virtual void OnMiddleButtonDown( );
+      virtual void OnMiddleButtonUp( );
+      virtual void OnRightButtonDown( );
+      virtual void OnRightButtonUp( );
+      virtual void OnMouseWheelForward( );
+      virtual void OnMouseWheelBackward( );
+
+      // Description:
+      // Override the "fly-to" (f keypress) for images.
+      virtual void OnChar( );
+
+      // These methods for the different interactions in different modes
+      // are overridden in subclasses to perform the correct motion. Since
+      // they might be called from OnTimer, they do not have mouse coord
+      // parameters (use interactor's GetEventPosition and
+      // GetLastEventPosition)
+
+      virtual void Rotate( ) { }
+      virtual void Spin( )   { }
+      virtual void Zoom( )   { }
+      virtual void Pick( )   { }
+      virtual void Slice( )  { }
+      virtual void WindowLevel( );
+
+      // Interaction mode entry points used internally.
+      virtual void StartPick( )  { }
+      virtual void EndPick( )    { }
+      virtual void StartSlice( ) { }
+      virtual void EndSlice( )   { }
+      virtual void StartWindowLevel( );
+      virtual void EndWindowLevel( );
+
+      // New events
+      virtual void StartCursorMoving( );
+      virtual void EndCursorMoving( );
+      virtual void StartRadiusMoving( );
+      virtual void EndRadiusMoving( );
+
+    protected:
+      ImageInteractorStyle( );
+      virtual ~ImageInteractorStyle( );
+
+      void _RenderAssociateInteractors( );
+      bool _PickPosition( double pos[ 3 ] );
+      void _UpdateCursor( );
+      void _UpdateRadius( );
+
+    private:
+      // Purposely not implemented
+      ImageInteractorStyle( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      Self::InteractionMode Mode;
+
+      ImageSliceActors* m_SliceActors;
+      MPRActors*        m_MPRActors;
+
+      vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
+      vtkSmartPointer< vtkPropPicker > PropPicker;
+
+      std::vector< vtkRenderWindowInteractor* > AssociatedInteractors;
+
+      bool CursorMoving;
+      double Cursor[ 3 ];
+
+      bool RadiusMoving;
+      double Radius[ 3 ];
+      vtkSmartPointer< vtkPolyData > Circle;
+      vtkSmartPointer< vtkPolyDataMapper > CircleMapper;
+      vtkSmartPointer< vtkActor > CircleActor;
+
+    public:
+      static const int CursorEvent;
+      static const int RadiusEvent;
+      static const int DoubleClickEvent;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 3991ab39419309ec5f7399ea3e3a7381128cf2a7..37aeac402cef79579d23b0bbab961fbb209b162c 100644 (file)
 #include <vtkTextActor.h>
 
 // -------------------------------------------------------------------------
-#define cpPlugins_ImageSliceActors( name, type )                        \
-  inline type* Get##name##Actor( ) const                                \
-  {                                                                     \
-    return(                                                             \
-      dynamic_cast< type* >(                                            \
-        const_cast< Self* >( this )->                                   \
-        GetItemAsObject( this->name##ActorIndex )                       \
-        )                                                               \
-      );                                                                \
+#define cpPlugins_ImageSliceActors( name, type )        \
+  inline type* Get##name##Actor( ) const                \
+  {                                                     \
+    return(                                             \
+      dynamic_cast< type* >(                            \
+        const_cast< Self* >( this )->                   \
+        GetItemAsObject( this->name##ActorIndex )       \
+        )                                               \
+      );                                                \
   }
 
 // -------------------------------------------------------------------------
@@ -30,66 +30,66 @@ class vtkImageData;
 
 // -------------------------------------------------------------------------
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    class cpExtensions_EXPORT ImageSliceActors
+      : public vtkPropCollection
     {
-      /**
-       */
-      class cpExtensions_EXPORT ImageSliceActors
-        : public vtkPropCollection
-      {
-      public:
-        typedef ImageSliceActors Self;
-
-      public:
-        vtkTypeMacro( ImageSliceActors, vtkPropCollection );
-
-        cpPlugins_ImageSliceActors( Image, vtkImageActor );
-        cpPlugins_ImageSliceActors( Text, vtkTextActor );
-        cpPlugins_ImageSliceActors( Plane, vtkActor );
-
-      public:
-        // Creation
-        static ImageSliceActors* New( );
-
-        void SetInputConnection( vtkAlgorithmOutput* aout, int axis );
-        void SetInputData( vtkImageData* data, int axis );
-
-        double* GetDisplayBounds( ) const;
-        void GetDisplayBounds( double bounds[ 6 ] ) const;
-
-        int GetAxis( ) const;
-        int GetSliceNumber( ) const;
-        int GetSliceNumberMinValue( ) const;
-        int GetSliceNumberMaxValue( ) const;
-        void SetSliceNumber( const int& slice );
-        void UpdateText( );
-
-      protected:
-        ImageSliceActors( );
-        virtual ~ImageSliceActors( );
-
-      private:
-        // Purposely not implemented
-        ImageSliceActors( const Self& );
-        Self& operator=( const Self& );
-
-      protected:
-        vtkSmartPointer< vtkImageSliceMapper > SliceMapper;
-        vtkSmartPointer< vtkPolyData >         PlaneSource;
-        vtkSmartPointer< vtkPolyDataMapper >   PlaneMapper;
-        char                                   TextBuffer[ 1024 ];
-
-        vtkSmartPointer< vtkImageActor > ImageActor;
-        vtkSmartPointer< vtkTextActor >  TextActor;
-        vtkSmartPointer< vtkActor >      PlaneActor;
-
-        unsigned int ImageActorIndex;
-        unsigned int TextActorIndex;
-        unsigned int PlaneActorIndex;
-      };
-
-    } // ecapseman
+    public:
+      typedef ImageSliceActors Self;
+
+    public:
+      vtkTypeMacro( ImageSliceActors, vtkPropCollection );
+
+      cpPlugins_ImageSliceActors( Image, vtkImageActor );
+      cpPlugins_ImageSliceActors( Text, vtkTextActor );
+      cpPlugins_ImageSliceActors( Plane, vtkActor );
+
+    public:
+      // Creation
+      static ImageSliceActors* New( );
+
+      void SetInputConnection( vtkAlgorithmOutput* aout, int axis );
+      void SetInputData( vtkImageData* data, int axis );
+
+      double* GetDisplayBounds( ) const;
+      void GetDisplayBounds( double bounds[ 6 ] ) const;
+
+      int GetAxis( ) const;
+      int GetSliceNumber( ) const;
+      int GetSliceNumberMinValue( ) const;
+      int GetSliceNumberMaxValue( ) const;
+      void SetSliceNumber( const int& slice );
+      void UpdateText( );
+
+    protected:
+      ImageSliceActors( );
+      virtual ~ImageSliceActors( );
+
+    private:
+      // Purposely not implemented
+      ImageSliceActors( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      vtkSmartPointer< vtkImageSliceMapper > SliceMapper;
+      vtkSmartPointer< vtkPolyData >         PlaneSource;
+      vtkSmartPointer< vtkPolyDataMapper >   PlaneMapper;
+      char                                   TextBuffer[ 1024 ];
+
+      vtkSmartPointer< vtkImageActor > ImageActor;
+      vtkSmartPointer< vtkTextActor >  TextActor;
+      vtkSmartPointer< vtkActor >      PlaneActor;
+
+      unsigned int ImageActorIndex;
+      unsigned int TextActorIndex;
+      unsigned int PlaneActorIndex;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 8cdfe5a963c9abbdfae81ec36ab2316563d45794..85c7b63f49dc96e2afbc6090b65dca98ff1fb196 100644 (file)
@@ -16,97 +16,97 @@ class vtkWindowLevelLookupTable;
 
 // -------------------------------------------------------------------------
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    class cpExtensions_EXPORT MPRActors
+      : public vtkPropCollection
     {
-      /**
-       */
-      class cpExtensions_EXPORT MPRActors
-        : public vtkPropCollection
-      {
-      public:
-        typedef MPRActors Self;
-
-      public:
-        vtkTypeMacro( MPRActors, vtkPropCollection );
-
-        cpPlugins_ImageSliceActors( ImageOutline, vtkImageActor );
-
-      public:
-        // Creation
-        static MPRActors* New( );
-
-        ImageSliceActors* GetSliceActors( const int& i ) const;
-        void SetInputConnection( vtkAlgorithmOutput* aout );
-        void SetInputData( vtkImageData* image );
-
-        void PushDataInto(
-          vtkRenderer* x,
-          vtkRenderer* y,
-          vtkRenderer* z,
-          vtkRenderer* w
-          );
-        void PopDataFrom(
-          vtkRenderer* x,
-          vtkRenderer* y,
-          vtkRenderer* z,
-          vtkRenderer* w
-          );
-
-        // Lookup table methods
-        vtkScalarsToColors* GetLookupTable( ) const;
-        void SetLookupTable( vtkScalarsToColors* lut );
-
-        // Grayscale window/level lookup
-        vtkWindowLevelLookupTable* GetLookupTableAsWindowLevel( ) const;
-        void SetLookupTableToWindowLevel( );
-        double GetMinWindow( ) const;
-        double GetMaxWindow( ) const;
-        double GetMinLevel( ) const;
-        double GetMaxLevel( ) const;
-        double GetWindow( ) const;
-        double GetLevel( ) const;
-        void SetWindow( const double& w );
-        void SetLevel( const double& l );
-        void SetWindowLevel( const double& w, const double& l );
-        void ResetWindowLevel( );
-
-        // Slice access
-        int GetSliceNumberMinValue( const int& axis ) const;
-        int GetSliceNumberMaxValue( const int& axis ) const;
-        int GetSlice( const int& axis ) const;
-        void SetSlice( const int& axis, const int& slice );
-        void SetSlice( const int& axis, const double& slice );
-        void ResetSlices( );
-
-        // General accessors 
-        void GetImageBounds( double bounds[ 6 ] ) const;
-
-      protected:
-        MPRActors( );
-        virtual ~MPRActors( );
-
-        vtkImageData* _InputImage( ) const;
-        void _UpdateSlices( );
-
-      private:
-        // Purposely not implemented
-        MPRActors( const Self& );
-        Self& operator=( const Self& );
-
-      protected:
-        vtkSmartPointer< vtkImageMapToColors > ImageMapToColors;
-        vtkSmartPointer< vtkActor >            ImageOutlineActor;
-
-        typedef
-          cpExtensions::Visualization::ImageSliceActors
-          _TSlice;
-        vtkSmartPointer< _TSlice > Slices[ 3 ];
-
-        unsigned int ImageOutlineActorIndex;
-      };
-
-    } // ecapseman
+    public:
+      typedef MPRActors Self;
+
+    public:
+      vtkTypeMacro( MPRActors, vtkPropCollection );
+
+      cpPlugins_ImageSliceActors( ImageOutline, vtkImageActor );
+
+    public:
+      // Creation
+      static MPRActors* New( );
+
+      ImageSliceActors* GetSliceActors( const int& i ) const;
+      void SetInputConnection( vtkAlgorithmOutput* aout );
+      void SetInputData( vtkImageData* image );
+
+      void PushDataInto(
+        vtkRenderer* x,
+        vtkRenderer* y,
+        vtkRenderer* z,
+        vtkRenderer* w
+        );
+      void PopDataFrom(
+        vtkRenderer* x,
+        vtkRenderer* y,
+        vtkRenderer* z,
+        vtkRenderer* w
+        );
+
+      // Lookup table methods
+      vtkScalarsToColors* GetLookupTable( ) const;
+      void SetLookupTable( vtkScalarsToColors* lut );
+
+      // Grayscale window/level lookup
+      vtkWindowLevelLookupTable* GetLookupTableAsWindowLevel( ) const;
+      void SetLookupTableToWindowLevel( );
+      double GetMinWindow( ) const;
+      double GetMaxWindow( ) const;
+      double GetMinLevel( ) const;
+      double GetMaxLevel( ) const;
+      double GetWindow( ) const;
+      double GetLevel( ) const;
+      void SetWindow( const double& w );
+      void SetLevel( const double& l );
+      void SetWindowLevel( const double& w, const double& l );
+      void ResetWindowLevel( );
+
+      // Slice access
+      int GetSliceNumberMinValue( const int& axis ) const;
+      int GetSliceNumberMaxValue( const int& axis ) const;
+      int GetSlice( const int& axis ) const;
+      void SetSlice( const int& axis, const int& slice );
+      void SetSlice( const int& axis, const double& slice );
+      void ResetSlices( );
+
+      // General accessors
+      void GetImageBounds( double bounds[ 6 ] ) const;
+
+    protected:
+      MPRActors( );
+      virtual ~MPRActors( );
+
+      vtkImageData* _InputImage( ) const;
+      void _UpdateSlices( );
+
+    private:
+      // Purposely not implemented
+      MPRActors( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      vtkSmartPointer< vtkImageMapToColors > ImageMapToColors;
+      vtkSmartPointer< vtkActor >            ImageOutlineActor;
+
+      typedef
+        cpExtensions::Visualization::ImageSliceActors
+        _TSlice;
+      vtkSmartPointer< _TSlice > Slices[ 3 ];
+
+      unsigned int ImageOutlineActorIndex;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 076b09b12954bad1a5303f3809315626596c43b7..cf0a68c42150b8c72e40967282dbce2d427ad0e8 100644 (file)
@@ -110,7 +110,7 @@ SetModeToNavigation( )
   {
     if( this->m_Styles[ i ].GetPointer( ) != NULL )
       this->m_Styles[ i ]->SetModeToNavigation( );
-    
+
   } // rof
 }
 
@@ -122,7 +122,7 @@ SetModeToDeformation( )
   {
     if( this->m_Styles[ i ].GetPointer( ) != NULL )
       this->m_Styles[ i ]->SetModeToDeformation( );
-    
+
   } // rof
 }
 
index d2c10b558595fda6727d2d010331db7b438d9d36..2b5a4e7e4c37ba20fc8632fb6b255e2899590332 100644 (file)
 
 // -------------------------------------------------------------------------
 #define cpPlugins_MPRWithDifferentWindows_ObserverMacro( e )    \
-inline void Add##e##Observer( vtkCommand* observer )            \
-{                                                               \
-  for( int i = 0; i < 3; ++i )                                  \
-    if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
-      this->m_Styles[ i ]->Add##e##Observer( observer );        \
-}                                                               \
-inline void Remove##e##Observer( vtkCommand* observer )         \
-{                                                               \
-  for( int i = 0; i < 3; ++i )                                  \
-    if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
-      this->m_Styles[ i ]->Remove##e##Observer( observer );     \
-}                                                               \
-inline void Remove##e##Observers( )                             \
-{                                                               \
-  for( int i = 0; i < 3; ++i )                                  \
-    if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
-      this->m_Styles[ i ]->Remove##e##Observers( );             \
-}
+  inline void Add##e##Observer( vtkCommand* observer )          \
+  {                                                             \
+    for( int i = 0; i < 3; ++i )                                \
+      if( this->m_Styles[ i ].GetPointer( ) != NULL )           \
+        this->m_Styles[ i ]->Add##e##Observer( observer );      \
+  }                                                             \
+  inline void Remove##e##Observer( vtkCommand* observer )       \
+  {                                                             \
+    for( int i = 0; i < 3; ++i )                                \
+      if( this->m_Styles[ i ].GetPointer( ) != NULL )           \
+        this->m_Styles[ i ]->Remove##e##Observer( observer );   \
+  }                                                             \
+  inline void Remove##e##Observers( )                           \
+  {                                                             \
+    for( int i = 0; i < 3; ++i )                                \
+      if( this->m_Styles[ i ].GetPointer( ) != NULL )           \
+        this->m_Styles[ i ]->Remove##e##Observers( );           \
+  }
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    class cpExtensions_EXPORT MPRWithDifferentWindows
     {
-      /**
-       */
-      class cpExtensions_EXPORT MPRWithDifferentWindows
-      {
-      public:
-        typedef cpExtensions::Visualization::
+    public:
+      typedef cpExtensions::Visualization::
         MPRActors TMPRActors;
-        typedef cpExtensions::Visualization::
+      typedef cpExtensions::Visualization::
         ImageInteractorStyle TStyle;
 
-      public:
-        cpPlugins_MPRWithDifferentWindows_ObserverMacro( DoubleClick );
-        cpPlugins_MPRWithDifferentWindows_ObserverMacro( Cursor );
-        cpPlugins_MPRWithDifferentWindows_ObserverMacro( Radius );
+    public:
+      cpPlugins_MPRWithDifferentWindows_ObserverMacro( DoubleClick );
+      cpPlugins_MPRWithDifferentWindows_ObserverMacro( Cursor );
+      cpPlugins_MPRWithDifferentWindows_ObserverMacro( Radius );
 
-      public:
-        MPRWithDifferentWindows(
-          vtkRenderWindow* xWin = NULL,
-          vtkRenderWindow* yWin = NULL,
-          vtkRenderWindow* zWin = NULL,
-          vtkRenderWindow* auxWin = NULL
-          );
-        virtual ~MPRWithDifferentWindows( );
+    public:
+      MPRWithDifferentWindows(
+        vtkRenderWindow* xWin = NULL,
+        vtkRenderWindow* yWin = NULL,
+        vtkRenderWindow* zWin = NULL,
+        vtkRenderWindow* auxWin = NULL
+        );
+      virtual ~MPRWithDifferentWindows( );
 
-        void SetImage( vtkImageData* image );
-        void SetModeToNavigation( );
-        void SetModeToDeformation( );
+      void SetImage( vtkImageData* image );
+      void SetModeToNavigation( );
+      void SetModeToDeformation( );
 
-        void ResetCamera( const int& id );
-        void ResetCameras( );
-        void Render( const int& id );
-        void RenderAll( );
+      void ResetCamera( const int& id );
+      void ResetCameras( );
+      void Render( const int& id );
+      void RenderAll( );
 
-        vtkRenderer* GetRenderer( const int& id ) const;
+      vtkRenderer* GetRenderer( const int& id ) const;
 
-        void Add3DActor( vtkProp3D* prop );
+      void Add3DActor( vtkProp3D* prop );
 
-      protected:
-        // Inputs
-        vtkRenderWindow* m_Windows[ 4 ];
+    protected:
+      // Inputs
+      vtkRenderWindow* m_Windows[ 4 ];
 
-        // Internal pipelines
-        vtkSmartPointer< TMPRActors >  m_MPRActors;
-        vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
-        vtkSmartPointer< TStyle >      m_Styles[ 3 ];
-      };
+      // Internal pipelines
+      vtkSmartPointer< TMPRActors >  m_MPRActors;
+      vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
+      vtkSmartPointer< TStyle >      m_Styles[ 3 ];
+    };
 
-    } // ecapseman
+  } // ecapseman
 
 } // ecapseman
 
index e72ba037ab3372b37b144682b8024f8483603d87..e833f128f03496ca133c78a5be1862e99dd2c397 100644 (file)
@@ -9,90 +9,90 @@ class vtkInformation;
 class vtkRenderer;
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    template< class M >
+    class MeshMapper
+      : public vtkMapper
     {
-      /**
-       */
-      template< class M >
-      class MeshMapper
-        : public vtkMapper
-      {
-      public:
-        typedef MeshMapper Self;
-        vtkTypeMacro( MeshMapper, vtkMapper );
-
-        typedef M                             TMesh;
-        typedef typename M::PointType         TPoint;
-        typedef typename TPoint::VectorType   TVector;
-        typedef typename TPoint::CoordRepType TScalar;
-        itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
-
-        // Begin concept checking
+    public:
+      typedef MeshMapper Self;
+      vtkTypeMacro( MeshMapper, vtkMapper );
+
+      typedef M                             TMesh;
+      typedef typename M::PointType         TPoint;
+      typedef typename TPoint::VectorType   TVector;
+      typedef typename TPoint::CoordRepType TScalar;
+      itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
+
+      // Begin concept checking
 #ifdef ITK_USE_CONCEPT_CHECKING
-        /* TODO
-           itkConceptMacro(
-           InputMeshIsTwoOrThreeimensionalCheck,
-           ( itk::Concept::SameDimensionOrMinusOne< Self::Dimension, 3 > )
-           );
-           itkConceptMacro(
-           ScalarTypeHasFloatResolution,
-           ( itk::Concept::IsFloatingPoint< TScalar > )
-           );
-        */
+      /* TODO
+         itkConceptMacro(
+         InputMeshIsTwoOrThreeimensionalCheck,
+         ( itk::Concept::SameDimensionOrMinusOne< Self::Dimension, 3 > )
+         );
+         itkConceptMacro(
+         ScalarTypeHasFloatResolution,
+         ( itk::Concept::IsFloatingPoint< TScalar > )
+         );
+      */
 #endif
-        // End concept checking
-
-      public:
-        // TODO: static Self* New( );
-        virtual void ShallowCopy( vtkAbstractMapper* m );
-
-        virtual void SetInputData( M* in );
-        virtual M* GetInput( );
-        virtual const M* GetInput( ) const;
-
-        virtual double* GetBounds( );
-        virtual void GetBounds( double bounds[ 6 ] );
-
-        virtual void RenderPiece( vtkRenderer* aren, vtkActor* act ) = 0;
-        virtual void Render( vtkRenderer* aren, vtkActor* act );
-        virtual void Update( );
-        virtual void Update( int port );
-
-        virtual void MapDataArrayToVertexAttribute(
-          const char* vertexAttributeName,
-          const char* dataArrayName,
-          int fieldAssociation,
-          int componentno = -1
-          );
-        virtual void MapDataArrayToMultiTextureAttribute(
-          int unit,
-          const char* dataArrayName,
-          int fieldAssociation,
-          int componentno = -1
-          );
-        virtual void RemoveVertexAttributeMapping(
-          const char* vertexAttributeName
-          );
-        virtual void RemoveAllVertexAttributeMappings( );
-
-      protected:
-        MeshMapper( );
-        virtual ~MeshMapper( );
-
-        virtual void ComputeBounds( );
-        virtual int FillInputPortInformation( int port, vtkInformation* info );
-
-      private:
-        // These methods aren't supposed to be implemented
-        MeshMapper( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        typename M::Pointer Mesh;
-      };
-
-    } // ecapseman
+      // End concept checking
+
+    public:
+      // TODO: static Self* New( );
+      virtual void ShallowCopy( vtkAbstractMapper* m );
+
+      virtual void SetInputData( M* in );
+      virtual M* GetInput( );
+      virtual const M* GetInput( ) const;
+
+      virtual double* GetBounds( );
+      virtual void GetBounds( double bounds[ 6 ] );
+
+      virtual void RenderPiece( vtkRenderer* aren, vtkActor* act ) = 0;
+      virtual void Render( vtkRenderer* aren, vtkActor* act );
+      virtual void Update( );
+      virtual void Update( int port );
+
+      virtual void MapDataArrayToVertexAttribute(
+        const char* vertexAttributeName,
+        const char* dataArrayName,
+        int fieldAssociation,
+        int componentno = -1
+        );
+      virtual void MapDataArrayToMultiTextureAttribute(
+        int unit,
+        const char* dataArrayName,
+        int fieldAssociation,
+        int componentno = -1
+        );
+      virtual void RemoveVertexAttributeMapping(
+        const char* vertexAttributeName
+        );
+      virtual void RemoveAllVertexAttributeMappings( );
+
+    protected:
+      MeshMapper( );
+      virtual ~MeshMapper( );
+
+      virtual void ComputeBounds( );
+      virtual int FillInputPortInformation( int port, vtkInformation* info );
+
+    private:
+      // These methods aren't supposed to be implemented
+      MeshMapper( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename M::Pointer Mesh;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
index 6a959e39329c4b2ef97004af70f67530889fd194..02ffeac9d9fc24216c2b83b6933a95b84772fad3 100644 (file)
@@ -6,69 +6,69 @@
 #include <cpExtensions/Visualization/MeshMapper.h>
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    template< class M >
+    class OpenGLMeshMapper
+      : public MeshMapper< M >
     {
-      /**
-       */
-      template< class M >
-      class OpenGLMeshMapper
-        : public MeshMapper< M >
-      {
-      public:
-        typedef OpenGLMeshMapper Self;
-        vtkTypeMacro( OpenGLMeshMapper, MeshMapper< M > );
-
-        typedef typename Superclass::TMesh   TMesh;
-        typedef typename Superclass::TPoint  TPoint;
-        typedef typename Superclass::TVector TVector;
-        typedef typename Superclass::TScalar TScalar;
-
-      protected:
-        typedef unsigned int                            TIndex;
-        typedef typename M::CellType                    TCell;
-        typedef typename M::CellsContainer              TCellsContainer;
-        typedef typename TCellsContainer::ConstIterator TCellIt;
-
-      public:
-        virtual const char* GetNameOfClass( ) const
-          { return( "cpExtensions::OpenGLMeshMapper" ); }
-        static Self* New( );
-
-        virtual void RenderPiece( vtkRenderer* aren, vtkActor* act );
-        virtual void ReleaseGraphicsResources( vtkWindow* win );
-        virtual int Draw( vtkRenderer* aren, vtkActor* act );
-
-      protected:
-        OpenGLMeshMapper( );
-        virtual ~OpenGLMeshMapper( );
-
-        bool _ConfigureOpenGL( );
-
-      private:
-        // Purposely not implemented
-        OpenGLMeshMapper( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        vtkIdType TotalCells;
-        // TODO: vtkSmartPointer< vtkOpenGLTexture > InternalColorTexture;
-
-        bool FirstRendering;
-
-        bool VBOSupported;
-        unsigned int VBOID1, VBOID2;
-
-        std::vector< unsigned int > Sizes;
-        std::vector< TIndex > Indices;
-        long IndexElementType;
-        long ElementValueType;
-      };
-
-    } // ecapseman
+    public:
+      typedef OpenGLMeshMapper Self;
+      vtkTypeMacro( OpenGLMeshMapper, MeshMapper< M > );
+
+      typedef typename Superclass::TMesh   TMesh;
+      typedef typename Superclass::TPoint  TPoint;
+      typedef typename Superclass::TVector TVector;
+      typedef typename Superclass::TScalar TScalar;
+
+    protected:
+      typedef unsigned int                            TIndex;
+      typedef typename M::CellType                    TCell;
+      typedef typename M::CellsContainer              TCellsContainer;
+      typedef typename TCellsContainer::ConstIterator TCellIt;
+
+    public:
+      virtual const char* GetNameOfClass( ) const
+        { return( "cpExtensions::OpenGLMeshMapper" ); }
+      static Self* New( );
+
+      virtual void RenderPiece( vtkRenderer* aren, vtkActor* act );
+      virtual void ReleaseGraphicsResources( vtkWindow* win );
+      virtual int Draw( vtkRenderer* aren, vtkActor* act );
+
+    protected:
+      OpenGLMeshMapper( );
+      virtual ~OpenGLMeshMapper( );
+
+      bool _ConfigureOpenGL( );
+
+    private:
+      // Purposely not implemented
+      OpenGLMeshMapper( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      vtkIdType TotalCells;
+      // TODO: vtkSmartPointer< vtkOpenGLTexture > InternalColorTexture;
+
+      bool FirstRendering;
+
+      bool VBOSupported;
+      unsigned int VBOID1, VBOID2;
+
+      std::vector< unsigned int > Sizes;
+      std::vector< TIndex > Indices;
+      long IndexElementType;
+      long ElementValueType;
+    };
 
   } // ecapseman
 
+} // ecapseman
+
 #include <cpExtensions/Visualization/OpenGLMeshMapper.hxx>
 
 #endif // __CPEXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
index 61a9e1a9066a381cb6158ebde274d2e0edce56e3..ab2fc60d490661cbd645527c70798a8ad937d896 100644 (file)
@@ -131,14 +131,14 @@ RenderPiece( vtkRenderer* aren, vtkActor* act )
   if( this->ColorTextureMap )
   {
     /* TODO
-      if( !this->InternalColorTexture )
-      {
-      this->InternalColorTexture =
-      vtkSmartPointer< vtkOpenGLTexture >::New( );
-      this->InternalColorTexture->RepeatOff( );
-
-      } // fi
-      this->InternalColorTexture->SetInputData( this->ColorTextureMap );
+       if( !this->InternalColorTexture )
+       {
+       this->InternalColorTexture =
+       vtkSmartPointer< vtkOpenGLTexture >::New( );
+       this->InternalColorTexture->RepeatOff( );
+
+       } // fi
+       this->InternalColorTexture->SetInputData( this->ColorTextureMap );
     */
 
     // Keep color from interacting with texture.
index 13bd75cb1d6663bb7c2006af413a0e4cbc9845ab..541d60c74237de1636518884a289c51238789553 100644 (file)
@@ -9,34 +9,34 @@ class vtkCellPicker;
 class vtkSeedWidget;
 
 namespace cpExtensions
+{
+  namespace Visualization
   {
-    namespace Visualization
+    /**
+     */
+    class cpExtensions_EXPORT SeedWidgetCorrector
+      : public vtkCommand
     {
-      /**
-       */
-      class cpExtensions_EXPORT SeedWidgetCorrector
-        : public vtkCommand
-      {
-      public:
-        static SeedWidgetCorrector* New( );
-
-        void Configure( vtkCellPicker* picker );
-
-        virtual void Execute(
-          vtkObject* caller,
-          unsigned long eventId,
-          void* arguments
-          );
-
-      protected:
-        SeedWidgetCorrector( );
-        virtual ~SeedWidgetCorrector( );
-
-      protected:
-        vtkCellPicker* m_Picker;
-      };
-
-    } // ecapseman
+    public:
+      static SeedWidgetCorrector* New( );
+
+      void Configure( vtkCellPicker* picker );
+
+      virtual void Execute(
+        vtkObject* caller,
+        unsigned long eventId,
+        void* arguments
+        );
+
+    protected:
+      SeedWidgetCorrector( );
+      virtual ~SeedWidgetCorrector( );
+
+    protected:
+      vtkCellPicker* m_Picker;
+    };
+
+  } // ecapseman
 
 } // ecapseman