[Insight-users] Speed

Gib Bogle g.bogle at auckland.ac.nz
Wed Feb 9 16:23:44 EST 2011


Thanks for the responses from Richard and others.  To respond to the questions 
raised:

I'm using the ITK Release libraries (I may be an ITK newbie but I'm not such a 
programming newbie).

My comparison code implements a 3D rectangular filter.

According to The ITK Software Guide, MeanImageFilter uses a rectangular 
neighbourhood, not a sphere. (Note that a radius of 5 gives a cube 11x11x11).  I 
haven't looked at the source code to check that this is really what it does.

I will have a look at BoxMeanImageFilter, and the Efficient Kernel Filtering 
article.

Re. profiling, I'm using MinGW tools on W7.  What would be a good profiler?

If MeanImageFilter really does use a rectangular neighbourhood, it appears that 
it could be speeded up considerably.

BTW Richard, my interest in the averaging filter is for the purpose of computing 
the background intensity, as part of localized thresholding - following your 
suggestion, I hope.

Gib


On 9/02/2011 10:53 p.m., Richard Beare wrote:
> Make sure ITK and your test is compiled in Release mode. Can make lots
> of difference.
>
> Confirm that your comparison function is really 5x5x5 and not just 5x5
> and compare what it is doing at the edges. Also the default in ITK is
> a circle, I think, not a square, which complicates the book keeping.
>
> No matter what you find, you'll probably want to try to avoid using a
> circle and try to get by with rectangles, which can be done way more
> efficiently - see the article on "Efficient kernel filtering" in IJ.
> These filters are mostly in the Review directory and you get them if
> you compile the with the consolidated morphology package enabled.
>
> On Wed, Feb 9, 2011 at 8:33 PM, Gib Bogle<g.bogle at auckland.ac.nz>  wrote:
>> I have encountered something that surprises me, and I'd like to hear any
>> comments.  I'm not being critical, it's just interesting.  I was using
>> MeanImageFilter, and was surprised at how slowly it ran on my image.  Since
>> the filter function is very simple, I decided to code up my own version, to
>> see if I could get it done faster.  I'm not really a competent C++
>> programmer, so I've just implemented an efficient algorithm in C.
>>
>> I'm testing with a greyscale image 955x963x100, on a Core i7 W7 machine (4
>> cores, 8 threads).  Setting each filter radius to 5, the MeanImageFilter
>> processing takes 1184 sec, using all 8 threads (100% CPU usage).  My own
>> averaging code takes 105 sec, using only a single thread (12.5% CPU usage).
>>
>> Why the big difference?
>>
>> Gib
>> _____________________________________
>> 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