[Insight-developers] Adding an OppositeImageFilter to Review

Tom Vercauteren tom.vercauteren at m4x.org
Fri Feb 20 08:07:49 EST 2009


Hi Dan,

The naming is indeed not very nice. However:
- "negate" usually refers to "perform the NOT operation"
- "invert" usually refers to the multiplicative inverse

That's why I chose "Opposite"... Would "AdditiveInverseImageFilter" be clearer?

Regards,
Tom

P.S.: I could of course use the ShiftScaleImageFilter, the
MultiplyByConstantImageFilter, the DivideByConstantImageFilter or the
InvertIntensityImageFilter for that task but it would add some
unnecessary complexity to my feature.


On Fri, Feb 20, 2009 at 13:15, Dan Mueller <dan.muel at gmail.com> wrote:
> Hi Tom,
>
> I'm not sure I like the name. Perhaps NegateImageFilter is more descriptive?
>
> (BTW: You can achieve this functionality using the existing
> ShiftScaleImageFilter, by setting Shift==0 and Scale=-1).
>
> Regards, Dan
>
> 2009/2/20 Tom Vercauteren <tom.vercauteren at gmail.com>:
>> 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 );
>>    }
>> };
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.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
>>
>


More information about the Insight-developers mailing list