Skip to content
Snippets Groups Projects
Commit b3c8747f authored by Julien Michel's avatar Julien Michel
Browse files

PERF: Move CovarianceEstimator updates out of BeforeThreadedGenerateData

parent b3479f43
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,7 @@ protected:
NormalizeVectorImageFilter ();
virtual ~NormalizeVectorImageFilter() { }
void GenerateOutputInformation();
void BeforeThreadedGenerateData();
private:
......
......@@ -35,6 +35,22 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage >
m_CovarianceEstimator = CovarianceEstimatorFilterType::New();
}
template < class TInputImage, class TOutputImage >
void
NormalizeVectorImageFilter< TInputImage, TOutputImage >
::GenerateOutputInformation()
{
// Call superclass implementation
Superclass::GenerateOutputInformation();
if( (m_UseMean && !m_IsGivenMean) || (m_UseStdDev && !m_IsGivenStdDev))
{
m_CovarianceEstimator->SetInput( const_cast<InputImageType*>( this->GetInput() ) );
m_CovarianceEstimator->Update();
}
}
template < class TInputImage, class TOutputImage >
void
NormalizeVectorImageFilter< TInputImage, TOutputImage >
......@@ -56,9 +72,6 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage >
if ( !m_IsGivenMean )
{
m_CovarianceEstimator->SetInput( const_cast<InputImageType*>( this->GetInput() ) );
m_CovarianceEstimator->Update();
this->GetFunctor().SetMean( m_CovarianceEstimator->GetMean() );
if ( !m_IsGivenStdDev && m_UseStdDev )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment