X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FExtensions%2FAlgorithms%2FLightCompensationFilter.hxx;h=fef98fd6e51e7fffedb8fd316978dfb12cb149a2;hb=e18f55af541dba9026284beb6f12ef06b12e6f47;hp=71dc0f60c0767e828eafa94f03bcd0bc1a522e98;hpb=aa6a578004bddb5b0bb07b780483fda0ecc6cb5e;p=cpPlugins.git diff --git a/lib/cpPlugins/Extensions/Algorithms/LightCompensationFilter.hxx b/lib/cpPlugins/Extensions/Algorithms/LightCompensationFilter.hxx index 71dc0f6..fef98fd 100644 --- a/lib/cpPlugins/Extensions/Algorithms/LightCompensationFilter.hxx +++ b/lib/cpPlugins/Extensions/Algorithms/LightCompensationFilter.hxx @@ -31,6 +31,8 @@ template< class I > void cpPlugins::Extensions::Algorithms::LightCompensationFilter< I >:: BeforeThreadedGenerateData( ) { + this->Superclass::BeforeThreadedGenerateData( ); + I* input = const_cast< I* >( this->GetInput( ) ); typename TMeanCalculator::Pointer mc = TMeanCalculator::New( ); @@ -66,12 +68,17 @@ ThreadedGenerateData( const TRegion& region, itk::ThreadIdType id ) double r = double( iIt.Get( )[ 0 ] ) * this->m_Coefficient[ 0 ]; double g = double( iIt.Get( )[ 1 ] ) * this->m_Coefficient[ 1 ]; double b = double( iIt.Get( )[ 2 ] ) * this->m_Coefficient[ 2 ]; + if( r > max_value ) r = max_value; if( g > max_value ) g = max_value; if( b > max_value ) b = max_value; - oIt.Get( ).Set( - _TPixelChannel( r ), _TPixelChannel( g ), _TPixelChannel( b ) - ); + + typename I::PixelType pix; + pix.SetRed( _TPixelChannel( r ) ); + pix.SetGreen( _TPixelChannel( g ) ); + pix.SetBlue( _TPixelChannel( b ) ); + + oIt.Set( pix ); } // rof } @@ -81,6 +88,7 @@ template< class I > void cpPlugins::Extensions::Algorithms::LightCompensationFilter< I >:: AfterThreadedGenerateData( ) { + this->Superclass::AfterThreadedGenerateData( ); } #endif // __CPPLUGINS__EXTENSIONS__ALGORITHMS__LIGHTCOMPENSATIONFILTER__HXX__