4 #include <itkConstNeighborhoodIterator.h> 5 #include <itkNeighborhoodInnerProduct.h> 6 #include <itkImageRegionIterator.h> 8 #include <itkProgressReporter.h> 13 template <
class TInputImage,
class TOutputImage>
18 this->SetNumberOfRequiredOutputs( 2 );
19 this->SetNthOutput( 0, this->MakeOutput( 0 ) );
20 this->SetNthOutput( 1, this->MakeOutput( 1 ) );
23 template<
class TInputImage,
class TOutputImage>
29 typename OutputImageType::Pointer output1 = this->GetOutput(0);
30 typename OutputImageType::Pointer output2 = this->GetOutput(1);
31 typename InputImageType::ConstPointer input = this->GetInput();
35 itk::ConstNeighborhoodIterator<InputImageType> bit(m_Radius, input,outputRegionForThread);
36 unsigned int neighborhoodSize = bit.Size();
37 itk::ImageRegionIterator<OutputImageType> it1(output1, outputRegionForThread);
38 itk::ImageRegionIterator<OutputImageType> it2(output2, outputRegionForThread);
40 while ( ! bit.IsAtEnd() )
42 sum = itk::NumericTraits<InputRealType>::Zero;
43 var = itk::NumericTraits<InputRealType>::Zero;
45 for (
unsigned int i = 0; i < neighborhoodSize; ++i)
48 var +=
static_cast<InputRealType>( bit.GetPixel(i) * bit.GetPixel(i) );
54 ((
double) neighborhoodSize / (neighborhoodSize - 1.0)));
67 template <
class TInputImage,
class TOutput>
72 Superclass::PrintSelf( os, indent );
73 os << indent <<
"Radius: " << m_Radius << std::endl;
itk::NumericTraits< InputPixelType >::RealType InputRealType
OutputImageType::PixelType OutputPixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
OutputImageType::RegionType OutputImageRegionType
MeanAndVarianceImagesFilter()
void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE