[Insight-users] Does data type has an influence on filter performance?

Luis Ibanez luis.ibanez at kitware.com
Sun Nov 1 16:50:27 EST 2009


Michael,

Just to complement what Kishore an Ivan already pointed out,

Please note that the behavior of the filters (in performance) will
be very different depending on the filter's implementation.

In summary:

It is reasonable to expect that the computation time may change
as a result of changing the pixel type of the input or output images.


In practice:

You should *measure* these changes.

You may find useful to look at the TimeProbesCollectorBase class,
for this purpose.

A typical use of this class would be:

itk::TimeProbesCollectorBase  chronometer;
chronometer.Start("smoothing");
smoothingFilter->Update();
chronometer.Stop("smoothing");
chronometer.Report( std::cout );


       Regards,


               Luis

-----------------------------------------------------------
On Thu, Oct 29, 2009 at 11:37 AM, Iván Macía <imacia at vicomtech.org> wrote:
> Hi,
>
> 1) Absolutely, it is not the same to perform operations on double floating
> point precision that with signed scalars. However, the input data, the
> nature and complexity of the operations performed by the filter and the
> desired precision will determine the pixel types to use and the difference
> in speed. In this sense, one has to be extremely careful here not lose
> information by wrong pixel choices.
> 2) The <short,short> should be faster, but in some cases not appropriate,
> for example if the output is the result of a floating point calculation.
> However, in some cases, the speed difference may be negligible compared to
> other considerations such as memory. For example if you have to perform
> morphological operations on a binary image and you choose the input and
> output to be float, your memory consumption will be increased by a factor of
> 8, and in this case it does not make sense. If you perform Hessian based
> calculations on an input image and you choose your output to be a tensor of
> doubles instead of floats, you may run into memory problems, and probably
> float will be enough for you.
>
> Hope that helps
>
> Iván
>
> -----Mensaje original-----
> De: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org] En
> nombre de Kishore Mosaliganti
> Enviado el: miércoles, 28 de octubre de 2009 20:26
> Para: Michael Xanadu
> CC: insight-users at itk.org
> Asunto: Re: [Insight-users] Does data type has an influence on filter
> performance?
>
> My 2 cents:
>
> I think if you ensure same datatype for input and output, some ITK
> filters are derived from InPlaceFilter and so this can reuse the input
> memory. So, you will reduce the memory usage by 1/2.
>
> Kishore
>
> On Wed, Oct 28, 2009 at 12:51 PM, Michael Xanadu
> <xanadu.michael at googlemail.com> wrote:
>> Hi,
>>
>> 1. I wonder if the datatype I choose for a filter (e.g. signed short,
> float,
>> unsigned char etc.) does have an influence on the performance?
>>
>> 2. Does a filter, which has got a different input & output datattype,
>> performs slower than a filter, in which I only use one datatype?
>>
>> // filter with different types...
>> myfilter<short, float>
>>
>> // ...compared to a filter with same types. is this filter fasterr?
>> myfilter<short, short>
>>
>>
>>
>> Regards, Michael
>>
>> _____________________________________
>> 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://www.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-users
>>
>>
> _____________________________________
> 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://www.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-users
>
> _____________________________________
> 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://www.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-users
>


More information about the Insight-users mailing list