[Insight-developers] MetaIO Unknown meta-data bug

Michael Stauffer mstauff at verizon.net
Fri Aug 17 18:17:01 EDT 2012


Hi,


I'm using the new EnableIfC and DisableIfC routines, to try and optimize itkCentralDifferenceImageFunction::Evaluate* methods by specializing for scalar and vector pixel types. I have it working using my own SFINAE method I pulled off the web. But this, requires calling templated subfunctions, which cost about 2% in overhead.


Looking at itkEnableIf.h and its usage in PatchBasedDenoisingImageFilter, I was hoping to be able to call the specialized Evalute* methods directly.


The method PatchBasedDenoisingImageFilter::GetComponent is are template-specialized to use one of two versions depending on whether the pixel is scalar or not. The method is templated.
But in PatchBasedDenoisingImageFilter::ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(), GetComponent is called without any template parameters. How does this work? I must be missing something.




template 
void
PatchBasedDenoisingImageFilter
::ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(const PixelType& a, const PixelType& b,
 const RealArrayType& weight,
 bool itkNotUsed(useCachedComputations),
 SizeValueType itkNotUsed(cacheIndex),
 EigenValuesCacheType& itkNotUsed(eigenValsCache),
 EigenVectorsCacheType& itkNotUsed(eigenVecsCache),
 RealType& diff, RealArrayType& norm)
{
 for (unsigned int pc = 0; pc < m_NumPixelComponents; ++pc)
 {
 RealValueType tmpDiff = GetComponent(b, pc) - GetComponent(a, pc);
 RealValueType tmpWeight = weight[pc];
 SetComponent(diff, pc, tmpDiff);
 norm[pc] = tmpWeight * tmpWeight * tmpDiff * tmpDiff;
 }
}



More information about the Insight-developers mailing list