X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FAlgorithms%2FDiscontinuityMapImageFilter.hxx;fp=lib%2FcpExtensions%2FAlgorithms%2FDiscontinuityMapImageFilter.hxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=f1786b4d6f43e43fa5bed4d68d424a85e00168b9;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpExtensions/Algorithms/DiscontinuityMapImageFilter.hxx b/lib/cpExtensions/Algorithms/DiscontinuityMapImageFilter.hxx deleted file mode 100644 index f1786b4..0000000 --- a/lib/cpExtensions/Algorithms/DiscontinuityMapImageFilter.hxx +++ /dev/null @@ -1,91 +0,0 @@ -// ------------------------------------------------------------------------- -// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) -// ------------------------------------------------------------------------- - -#ifndef __cpExtensions__Algorithms__DiscontinuityMapImageFilter__hxx__ -#define __cpExtensions__Algorithms__DiscontinuityMapImageFilter__hxx__ - -#include -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -template< class _TInputImage > -cpExtensions::Algorithms::DiscontinuityMapImageFilter< _TInputImage >:: -DiscontinuityMapImageFilter( ) - : Superclass( ), - m_UseSquareRoot( false ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TInputImage > -cpExtensions::Algorithms::DiscontinuityMapImageFilter< _TInputImage >:: -~DiscontinuityMapImageFilter( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TInputImage > -void cpExtensions::Algorithms::DiscontinuityMapImageFilter< _TInputImage >:: -ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId ) -{ - unsigned int i; - - itk::ZeroFluxNeumannBoundaryCondition< TInputImage > nbc; - itk::ConstNeighborhoodIterator< TInputImage > bit; - itk::ImageRegionIterator< TOutputImage > it; - - // Allocate output - typename TOutputImage::Pointer output = this->GetOutput( ); - typename TInputImage::ConstPointer input = this->GetInput( ); - - // Find the data-set boundary "faces" - typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< TInputImage >::FaceListType faceList; - itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< TInputImage > bC; - faceList = bC( input, region, this->GetRadius( ) ); - - typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< TInputImage >::FaceListType::iterator fit; - - TOutputPixel sum1, sum2; - TOutputPixel neighborhoodSize; - - // Process each of the boundary faces. These are N-d regions which border - // the edge of the buffer. - for( fit = faceList.begin( ); fit != faceList.end( ); ++fit ) - { - bit = itk::ConstNeighborhoodIterator< TInputImage >( this->GetRadius( ), input, *fit ); - neighborhoodSize = TOutputPixel( bit.Size( ) ); - it = itk::ImageRegionIterator< TOutputImage >( output, *fit ); - bit.OverrideBoundaryCondition( &nbc ); - bit.GoToBegin( ); - while( !bit.IsAtEnd( ) ) - { - sum1 = itk::NumericTraits< TOutputPixel >::ZeroValue( ); - sum2 = itk::NumericTraits< TOutputPixel >::ZeroValue( ); - for ( i = 0; i < neighborhoodSize; ++i ) - { - TOutputPixel v = TOutputPixel( bit.GetPixel( i ) ); - sum1 += v; - sum2 += v * v; - } - TOutputPixel var = - ( sum2 - ( ( sum1 * sum1 ) / neighborhoodSize ) ) / - ( neighborhoodSize - TOutputPixel( 1 ) ); - if( this->m_UseSquareRoot ) - it.Set( std::sqrt( double( var ) ) ); - else - it.Set( var ); - ++bit; - ++it; - - } // elihw - - } // rof -} - -#endif // __cpExtensions__Algorithms__DiscontinuityMapImageFilter__hxx__ - -// eof - $RCSfile$