[Insight-developers] Variable sigma along each axis in itk::SmoothingRecursiveGaussianImageFilter

Luis Ibanez luis.ibanez at kitware.com
Fri Jun 18 09:27:49 EDT 2010


BTW,
we should get rid of the methods:

void SetVariance (const double *v);
void SetVariance (const float *v);

They are unsafe and error prone.


Most of them have never been tested
(or can't even be tested) for:


      1) Null pointer
      2) Dangling pointers
      3) Deallocated pointer
      4) Uninitialized pointer
      5) Pointer to an array of wrong size.
      6) Pointer to wrong type
      7) Accidental aliasing to types
          that can be converted to pointers
          (for example, integers, and anything
          that can be converted to integer)


We should insist on using API that take
advantage of C++ type safety.


   My 2 typed cents


     Luis


-----------------------------------------------------------------------------
On Thu, Jun 17, 2010 at 2:05 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:

> Hello Karthik,
>
> In general I think this is a good idea. However looking at the convention
> for the DiscreteGaussianImageFilter, I see that it uses methods overloading
> to have the following functions:
> virtual void SetVarriance( ArrayType _arg );
> void SetVariance (const typename ArrayType::ValueType v);
> void SetVariance (const double *v);
> void SetVariance (const float *v);
>
> with only one get method:
> virtual ArrayType GetVariance( void ) const;
>
> However looking at all the other recursive Gaussian filters (not
> compressive list):
> GradientMagnitudeRecursiveGaussianImageFilter
> RecursiveGaussianImageFilter
> GradientRecursiveGaussianImageFilter
> HessianRecursiveGaussianImageFilter
> SmoothingRecursiveGaussianImageFilter
> LaplacianRecursiveGaussianImageFilter.h
>
> They currently seem to follow the convention of just:
> void SetSigma( RealType sigma );
> RealType GetSigma( void );
>
> 1) While there is not consistency between the Discrete and Recursive
> filters they currently are consistent amongst themselves. If array methods
> are added to one recursive filter, they should be added to them all to
> maintain the same interface.
> 2) More often then not I believe function overloading with different
> parameters is used to set the array in this type of situation. Again a
> constant interface is good.
> 3) Due to not being able to overload return methods, I don't think we can
> get a good interface with the Get methods...
>
> my thoughts,
> Brad
>
> On Jun 17, 2010, at 1:12 PM, Karthik Krishnan wrote:
>
> I'd like to commit a minor enhancement to
> itk::SmoothingRecursiveGaussianImageFilter to be able to take in variable
> sigma along each dimension. The patch is attached. All tests seem to be
> passing on the experimental submitted to the dashboard from isengard.
>
> There are no changes to the public or protected API. Just the addition of
> the method SetSigmaArray( const SigmaArrayType & ) . The existing SetSigma(
> scalar ) method goes through the above method. Also the type of m_Sigma is
> been changed from a scalar to a vector, but this should cause no issues to
> users or derived classes, since m_Sigma is private.
>
> Thanks
> --
> karthik
> <itkSmoothingRecursiveGaussianImageFilter.patch><ATT00001..txt>
>
>
> ========================================================
>
> Bradley Lowekamp
>
> Lockheed Martin Contractor for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine
>
> blowekamp at mail.nih.gov
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100618/a7b879e8/attachment.htm>


More information about the Insight-developers mailing list