@@ -32,7 +32,8 @@ CoocurrenceTextureFeaturesImageFilter< TInputImage, TOutputImage >
3232 m_NumberOfBinsPerAxis( itkGetStaticConstMacro( DefaultBinsPerAxis ) ),
3333 m_Min( NumericTraits<PixelType>::NonpositiveMin() ),
3434 m_Max( NumericTraits<PixelType>::max() ),
35- m_InsidePixelValue( NumericTraits<PixelType>::OneValue() ){
35+ m_InsidePixelValue( NumericTraits<PixelType>::OneValue() )
36+ {
3637 this ->SetNumberOfRequiredInputs ( 1 );
3738 this ->SetNumberOfRequiredOutputs ( 1 );
3839
7677CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
7778::BeforeThreadedGenerateData ()
7879{
79- InputImageType * maskPointer = const_cast <TInputImage *>( this ->GetMaskImage () );
80+ const InputImageType * maskPointer = this ->GetMaskImage ();
8081 this ->m_DigitalisedInputImageg = InputImageType::New ();
8182 this ->m_DigitalisedInputImageg ->SetRegions (this ->GetInput ()->GetRequestedRegion ());
8283 this ->m_DigitalisedInputImageg ->CopyInformation (this ->GetInput ());
@@ -181,13 +182,8 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
181182 continue ;
182183 }
183184 // Initialisation of the histogram
184- for (unsigned int a = 0 ; a < m_NumberOfBinsPerAxis; a++)
185- {
186- for (unsigned int b = 0 ; b < m_NumberOfBinsPerAxis; b++)
187- {
188- hist[a][b] = 0 ;
189- }
190- }
185+ hist.fill (0 );
186+
191187 totalNumberOfFreq = 0 ;
192188 // Iteration over all the offsets
193189 for ( offsets = m_Offsets->Begin (); offsets != m_Offsets->End (); ++offsets )
@@ -313,7 +309,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
313309template <typename TInputImage, typename TOutputImage>
314310void
315311CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
316- ::ComputeFeatures ( vnl_matrix<unsigned int > &hist,const unsigned int & totalNumberOfFreq,
312+ ::ComputeFeatures ( const vnl_matrix<unsigned int > &hist, const unsigned int totalNumberOfFreq,
317313 typename TOutputImage::PixelType &outputPixel)
318314{
319315 // Now get the various means and variances. This is takes two passes
@@ -390,8 +386,8 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
390386template <typename TInputImage, typename TOutputImage>
391387void
392388CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
393- ::ComputeMeansAndVariances (vnl_matrix<unsigned int > &hist,
394- const unsigned int & totalNumberOfFreq,
389+ ::ComputeMeansAndVariances (const vnl_matrix<unsigned int > &hist,
390+ const unsigned int totalNumberOfFreq,
395391 double & pixelMean,
396392 double & marginalMean,
397393 double & marginalDevSquared,
@@ -417,7 +413,6 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
417413 {
418414 for (unsigned int b = 0 ; b < m_NumberOfBinsPerAxis; b++)
419415 {
420- int k = hist[a][b];
421416 float frequency = hist[a][b] / (float )totalNumberOfFreq;
422417 pixelMean += a * frequency;
423418 marginalSums[a] += frequency;
0 commit comments