<commit_before>/*==========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkCentralDerivativeImageFunction.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2000 National Library of Medicine
  All rights reserved.

  See COPYRIGHT.txt for copyright details.

==========================================================================*/
#ifndef _itkCentralDerivativeImageFunction_h
#define _itkCentralDerivativeImageFunction_h

#include "itkImageFunction.h"

namespace itk
{

/**
 * \class CentralDerivativeImageFunction
 * \brief Calculate the derivative by central differencing
 *
 * This class is templated over the input image type.
 *
 * Possible improvements:
 * - the use of Neighborhood operators may improve efficiency.
 */
template <class TInputImage >
class ITK_EXPORT CentralDerivativeImageFunction :
  public ImageFunction< TInputImage, double >
{
public:
  /**
   * Standard "Self" typedef
   */
  typedef CentralDerivativeImageFunction Self;

  /**
   * Standard "Superclass" typedef
   */
  typedef ImageFunction<TInputImage, double> Superclass;

  /**
   * Smart pointer typedef support.
   */
  typedef SmartPointer<Self> Pointer;
  typedef SmartPointer<const Self>  ConstPointer;

  /**
   * Method for creation through the object factory.
   */
  itkNewMacro(Self);

  /**
   * InputImageType typedef support.
   */
  typedef TInputImage InputImageType;

  /**
   * Dimension of the underlying image.
   */
  enum { ImageDimension = InputImageType::ImageDimension };

  /**
   * Index typedef support.
   */
  typedef Index<ImageDimension> IndexType;

  /**
   * Set the input image.
   */
  virtual void SetInputImage( InputImageType * ptr );

  /**
   * Evalulate the function at specified index
   */
  virtual double Evaluate( const IndexType& index, unsigned int dim = 0 );
  virtual double Evaluate( const IndexType& index )
  {
    return ( this->Evaluate( index, 0 ) );
  }

  /**
   * Evaluate the function at a non-integer position
   */
  virtual double Evaluate( double coord[], unsigned int dim = 0 )
    {
      IndexType index;
      for( int j = 0; j < ImageDimension; j++ )
        {
          index[j] = vnl_math_rnd( coord[j] );
        }
      return ( this->Evaluate( index, dim ) );
    };

  /**
   * Get the derivative from last evaluation
   */
  virtual double GetDerivative() const
  { return m_Derivative; }

protected:
  CentralDerivativeImageFunction(){};
  CentralDerivativeImageFunction( const Self& ){};

  ~CentralDerivativeImageFunction(){};

  void operator=( const Self& ){};
  void PrintSelf(std::ostream& os, Indent indent);

  double                  m_Derivative;

private:
  Size<ImageDimension>    m_ImageSize;

};

} // namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkCentralDerivativeImageFunction.txx"
#endif

#endif

<commit_msg>BUG: override Evaluate(double coord[] ) to match superclass to prevent SGI warnings<commit_after>/*==========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkCentralDerivativeImageFunction.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2000 National Library of Medicine
  All rights reserved.

  See COPYRIGHT.txt for copyright details.

==========================================================================*/
#ifndef _itkCentralDerivativeImageFunction_h
#define _itkCentralDerivativeImageFunction_h

#include "itkImageFunction.h"

namespace itk
{

/**
 * \class CentralDerivativeImageFunction
 * \brief Calculate the derivative by central differencing
 *
 * This class is templated over the input image type.
 *
 * Possible improvements:
 * - the use of Neighborhood operators may improve efficiency.
 */
template <class TInputImage >
class ITK_EXPORT CentralDerivativeImageFunction :
  public ImageFunction< TInputImage, double >
{
public:
  /**
   * Standard "Self" typedef
   */
  typedef CentralDerivativeImageFunction Self;

  /**
   * Standard "Superclass" typedef
   */
  typedef ImageFunction<TInputImage, double> Superclass;

  /**
   * Smart pointer typedef support.
   */
  typedef SmartPointer<Self> Pointer;
  typedef SmartPointer<const Self>  ConstPointer;

  /**
   * Method for creation through the object factory.
   */
  itkNewMacro(Self);

  /**
   * InputImageType typedef support.
   */
  typedef TInputImage InputImageType;

  /**
   * Dimension of the underlying image.
   */
  enum { ImageDimension = InputImageType::ImageDimension };

  /**
   * Index typedef support.
   */
  typedef Index<ImageDimension> IndexType;

  /**
   * Set the input image.
   */
  virtual void SetInputImage( InputImageType * ptr );

  /**
   * Evalulate the function at specified index
   */
  virtual double Evaluate( const IndexType& index, unsigned int dim = 0 );
  virtual double Evaluate( const IndexType& index )
  {
    return ( this->Evaluate( index, 0 ) );
  }

  /**
   * Evaluate the function at a non-integer position
   */
  virtual double Evaluate( double coord[], unsigned int dim = 0 )
    {
      IndexType index;
      for( int j = 0; j < ImageDimension; j++ )
        {
          index[j] = vnl_math_rnd( coord[j] );
        }
      return ( this->Evaluate( index, dim ) );
    };

  /**
   * Evaluate the function at a non-integer position
   */
  virtual double Evaluate( double coord[] )
  {
    return ( this->Evaluate( coord, 0 ) );
  }

  /**
   * Get the derivative from last evaluation
   */
  virtual double GetDerivative() const
  { return m_Derivative; }

protected:
  CentralDerivativeImageFunction(){};
  CentralDerivativeImageFunction( const Self& ){};

  ~CentralDerivativeImageFunction(){};

  void operator=( const Self& ){};
  void PrintSelf(std::ostream& os, Indent indent);

  double                  m_Derivative;

private:
  Size<ImageDimension>    m_ImageSize;

};

} // namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkCentralDerivativeImageFunction.txx"
#endif

#endif


{'fraction_non_alphanumeric': 0.14227041235419746, 'fraction_numerical': 0.002792837194020043, 'mean_word_length': 3.516320474777448, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2359535', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1708, 'n_words': 496}