[Insight-developers] NormalizedCorrelationImageFilter::SetTemplate parameter type

David Doria daviddoria at gmail.com
Tue Jun 26 12:20:50 EDT 2012


On Tue, Jun 26, 2012 at 9:42 AM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:

> David,
>
> This certainly sounds like a bug.
>
> Do you have a patch?
>
> If the patch is not invasive and gets approved today, it may... just may
> be able to make it into the RC4.
>
> Brad
>

Hi Brad,

I think there are actually three separate problems/questions here -

1)
I realized that I can specify a 4th template parameter (TOperatorValueType):

  typedef itk::NormalizedCorrelationImageFilter<FloatVectorImageType,
MaskType,
                                                FloatImageType,
FloatVectorType> CorrelationFilterType;
  CorrelationFilterType::Pointer correlationFilter =
CorrelationFilterType::New();

However, when I do this, I get a concept check error
that ‘itk::CovariantVector<float, 3u> can't be casted to type ‘float’. I'm
assuming this means that this filter can only operate on scalar images? I
guess now that I think about it, the standard correlation computation
doesn't seem to naturally extend to vector-valued pixels... Perhaps there
should at least be a mention of this in the documentation, or better, a
concept check on TInputImage.

2)
Though I don't think I'll be able to use the filter as I was trying to in
(1), I still think the variable names and default template parameters are
confusing, even for correct usage.

In the parent class:

template< class TInputImage, class TOutputImage, class TOperatorValueType =
typename TOutputImage::PixelType >
class ITK_EXPORT NeighborhoodOperatorImageFilter:

we see that TOperatorValueType defaults to the output image type. Wouldn't
it make more sense to default to the input image type, since you'd usually
be correlating two images of the same type?

3)
With or without the default in (2), the class then goes on to define:

  typedef Neighborhood< OperatorValueType,
                        itkGetStaticConstMacro(ImageDimension) >
OutputNeighborhoodType;

should this be renamed OperatorNeighborhoodType - as I'm not sure what it
has to do with 'Output'? That would then trickle down to clarify the
confusion with the type of the SetTemplate() parameter.

If you agree, I can make a patch for 2 and 3, but 1 probably just needs a
comment or a new concept check rather than a patch.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120626/37c11c4d/attachment.htm>


More information about the Insight-developers mailing list