4 template <
class ImageType,
class DataImageType>
5 NonLocalT2DistributionPatchSearcher <ImageType, DataImageType>
10 m_MeanMinThreshold = 0.95;
11 m_VarMinThreshold = 0.5;
14 template <
class ImageType,
class DataImageType>
17 ::TestPatchConformity(
unsigned int index,
const IndexType &refIndex,
const IndexType &movingIndex)
19 unsigned int numTestImages = m_MeanImages.size();
21 for (
unsigned int i = 0;i < numTestImages;++i)
23 double refMeanValue = m_MeanImages[i]->GetPixel(refIndex);
24 double floMeanValue = m_MeanImages[i]->GetPixel(movingIndex);
26 double refVarValue = m_VarImages[i]->GetPixel(refIndex);
27 double floVarValue = m_VarImages[i]->GetPixel(movingIndex);
29 double meanRate = refMeanValue / floMeanValue;
30 double varianceRate = refVarValue / floVarValue;
32 bool testRate = ( meanRate > m_MeanMinThreshold ) && ( meanRate < ( 1.0 / m_MeanMinThreshold ) ) &&
33 ( varianceRate > m_VarMinThreshold ) && ( varianceRate < ( 1.0 / m_VarMinThreshold ) );
42 template <
class ImageType,
class DataImageType>
47 typedef itk::ImageRegionConstIteratorWithIndex< DataImageType > InIteratorType;
49 unsigned int numTestImages = m_PatchTestImages.size();
50 double globalWeightValue = 0.0;
52 for (
unsigned int i = 0;i < numTestImages;++i)
54 InIteratorType tmpIt (m_PatchTestImages[i], refPatch);
55 InIteratorType tmpMovingIt (m_PatchTestImages[i], movingPatch);
59 double weightValue = 0.0;
60 unsigned int numVoxels = 0;
62 while (!tmpIt.IsAtEnd())
64 tmpDiffValue = (double)tmpIt.Get() - (double)tmpMovingIt.Get();
65 weightValue += tmpDiffValue * tmpDiffValue;
72 globalWeightValue -= weightValue / (2.0 * m_BetaParameter * m_NoiseCovariances[i] * numVoxels);
75 return std::exp(globalWeightValue / numTestImages);
ImageType::RegionType ImageRegionType
ImageType::IndexType IndexType