17 #ifndef __itkNoiseImageFilter_txx
18 #define __itkNoiseImageFilter_txx
24 #include "itkConfigure.h"
26 #ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY
44 template <
class TInputImage,
class TOutputImage>
51 template <
class TInputImage,
class TOutputImage>
57 Superclass::GenerateInputRequestedRegion();
61 const_cast< TInputImage *
>( this->GetInput() );
64 if ( !inputPtr || !outputPtr )
71 typename TInputImage::RegionType inputRequestedRegion;
72 inputRequestedRegion = inputPtr->GetRequestedRegion();
75 inputRequestedRegion.PadByRadius( m_Radius );
78 if ( inputRequestedRegion.Crop(inputPtr->GetLargestPossibleRegion()) )
80 inputPtr->SetRequestedRegion( inputRequestedRegion );
89 inputPtr->SetRequestedRegion( inputRequestedRegion );
92 InvalidRequestedRegionError e(__FILE__, __LINE__);
94 e.
SetDescription(
"Requested region is (at least partially) outside the largest possible region.");
101 template<
class TInputImage,
class TOutputImage>
114 typename OutputImageType::Pointer output = this->GetOutput();
115 typename InputImageType::ConstPointer input = this->GetInput();
120 faceList = bC(input, outputRegionForThread, m_Radius);
125 ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
135 for (fit=faceList.begin(); fit != faceList.end(); ++fit)
139 unsigned int neighborhoodSize = bit.
Size();
148 sum = NumericTraits<InputRealType>::Zero;
149 sumOfSquares = NumericTraits<InputRealType>::Zero;
150 for (i = 0; i < neighborhoodSize; ++i)
154 sumOfSquares += (value*value);
158 var = (sumOfSquares - (sum*sum/num)) / (num - 1.0);
159 it.
Set( static_cast<OutputPixelType>(vcl_sqrt(var)) );
163 progress.CompletedPixel();
171 template <
class TInputImage,
class TOutput>
178 Superclass::PrintSelf( os, indent );
179 os << indent <<
"Radius: " << m_Radius << std::endl;