X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FAlgorithms%2FRegionOfInterestImageCalculator.hxx;fp=lib%2FcpExtensions%2FAlgorithms%2FRegionOfInterestImageCalculator.hxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=fd7867f58d161105906040813017e0edb92dc324;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx b/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx deleted file mode 100644 index fd7867f..0000000 --- a/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// ------------------------------------------------------------------------- -// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) -// ------------------------------------------------------------------------- - -#ifndef __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__ -#define __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__ - -#include - -// ------------------------------------------------------------------------- -template< class _TImage > -void cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >:: -Compute( ) -{ - typedef itk::ImageRegionConstIteratorWithIndex< _TImage > _TIterator; - typedef typename _TImage::RegionType _TRegion; - - if( this->m_Image.IsNotNull( ) ) - { - _TRegion region = this->m_Image->GetRequestedRegion( ); - TIndex minidx = region.GetIndex( ); - TIndex maxidx = minidx + region.GetSize( ); - for( unsigned int d = 0; d < _TImage::ImageDimension; ++d ) - maxidx[ d ] -= 1; - - bool first = true; - _TIterator i( this->m_Image, region ); - for( i.GoToBegin( ); !i.IsAtEnd( ); ++i ) - { - if( i.Get( ) != this->m_BackgroundValue ) - { - TIndex idx = i.GetIndex( ); - if( !first ) - { - for( unsigned int d = 0; d < _TImage::ImageDimension; ++d ) - { - minidx[ d ] = ( idx[ d ] < minidx[ d ] )? idx[ d ]: minidx[ d ]; - maxidx[ d ] = ( idx[ d ] > maxidx[ d ] )? idx[ d ]: maxidx[ d ]; - - } // rof - } - else - { - minidx = maxidx = idx; - first = false; - - } // fi - - } // fi - - } // rof - this->m_Minimum = minidx; - this->m_Maximum = maxidx; - } - else - { - this->m_Minimum.Fill( 0 ); - this->m_Maximum.Fill( 0 ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TImage > -cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >:: -RegionOfInterestImageCalculator( ) - : Superclass( ), - m_BackgroundValue( TPixel( 0 ) ) -{ - this->m_Minimum.Fill( 0 ); - this->m_Maximum.Fill( 0 ); -} - -// ------------------------------------------------------------------------- -template< class _TImage > -cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >:: -~RegionOfInterestImageCalculator( ) -{ -} - - -/* TODO - typename _TImage::ConstPointer m_Image; - TPixel m_BackgroundValue; - TIndex m_Minimum; - TIndex m_Maximum; - }; -*/ - -#endif // __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__ - -// eof - $RCSfile$