--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__PARALLELIMAGEMEAN__HXX__
+#define __CPEXTENSIONS__ALGORITHMS__PARALLELIMAGEMEAN__HXX__
+
+#include <itkImageRegionConstIterator.h>
+
+// -------------------------------------------------------------------------
+template< class I >
+cpExtensions::Algorithms::ParallelImageMean< I >::
+ParallelImageMean( )
+ : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+cpExtensions::Algorithms::ParallelImageMean< I >::
+~ParallelImageMean( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+void cpExtensions::Algorithms::ParallelImageMean< I >::
+BeforeThreadedExecution( )
+{
+ this->m_Mean.SetSize( _TPixelTraits::GetLength( ) );
+ this->m_Mean.Fill( double( 0 ) );
+ this->m_N = 0;
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+void cpExtensions::Algorithms::ParallelImageMean< I >::
+ThreadedExecution( const DomainType& region, const itk::ThreadIdType id )
+{
+ itk::ImageRegionConstIterator< I > i( this->m_Associate, region );
+ for( i.GoToBegin( ); !i.IsAtEnd( ); ++i )
+ {
+ for( unsigned int d = 0; d < _TPixelTraits::GetLength( ); ++d )
+ {
+ this->m_Mean.SetElement(
+ d, this->m_Mean.GetElement( d ) + double( i.Get( )[ d ] )
+ );
+ this->m_N++;
+
+ } // rof
+
+ } // rof
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+void cpExtensions::Algorithms::ParallelImageMean< I >::
+AfterThreadedExecution( )
+{
+ this->m_Mean /= double( this->m_N );
+}
+
+#endif // __CPEXTENSIONS__ALGORITHMS__PARALLELIMAGEMEAN__HXX__
+
+// eof - $RCSfile$