[Insight-developers] Adding an OppositeImageFilter to Review

Tom Vercauteren tom.vercauteren at gmail.com
Fri Feb 20 06:59:53 EST 2009


Hi all,

I'd like to add a feature to ExponentialDeformationFieldImageFilter
before the start of the feature freeze period. For that purpose, I'd
like to add a new class called OppositeImageFilter to the review
directory.

What it does is simply return the opposite (additive inverse) of the
input image. It is a simple UnaryFunctorImageFilter that uses the
functor shown hereafter.

Can I simply commit this filter with its unit test to the repository,
or do I have to go through an IJ submission for that?

Tom

template< class TInput, class TOutput>
class Opposite
{
public:
  Opposite() {};
  ~Opposite() {};
  bool operator!=( const Opposite & other ) const
    {
    return false;
    }
  bool operator==( const Opposite & other ) const
    {
    return true;
    }
  inline TOutput operator()( const TInput & A )
    {
    // We don't check if the TOutput can be signed.
    // It's up to the user to decide whether this makes sense.
    return static_cast<TOutput>( - A );
    }
};


More information about the Insight-developers mailing list