[Insight-users] Speed: Is this the right way?

Richard Beare richard.beare at gmail.com
Tue Oct 28 18:58:36 EDT 2008


There has been quite a bit of work done on speeding up some kernel
filters, including the morphology ones. Most of these are part of the
review section, which isn't built by default, or available via the
insight journal. They can make a very big difference in speed,
especially as you increase the size of your kernel.

Also, make sure that you are building in release mode.

Note that in the code above you should do

imout->DisconnectPipeline()

before returning imout.

On Wed, Oct 29, 2008 at 1:49 AM, Koen Vermeer <koen at vermeer.tv> wrote:
> Hi,
>
> I'm just doing some tests to see if ITK is feasible for my projects. As
> one of the tests, I tried to do binary dilation of a 3D volume. The code
> I use is shown below. Given that I'm new to ITK, I was wondering if this
> is the right way to do the dilation. The speed is not bad, but I'd like
> it to be faster.
>
>
> typedef itk::Image<unsigned char,3> ImageType;
>
> ImageType::Pointer BinaryDilate( ImageType::Pointer image )
> {
>   typedef unsigned char PixelType;
>   typedef itk::BinaryBallStructuringElement< PixelType, 3 > SEType;
>   typedef itk::BinaryDilateImageFilter< ImageType, ImageType, SEType >
> DilateFilterType;
>
>   DilateFilterType::Pointer binaryDilate = DilateFilterType::New();
>
>   SEType sE;
>   sE.SetRadius( 2 );
>   sE.CreateStructuringElement();
>   binaryDilate->SetKernel( sE );
>
>   binaryDilate->SetInput( image );
>   binaryDilate->SetDilateValue( 1 );
>
>   ImageType::Pointer imout = binaryDilate->GetOutput();
>   imout->Update();
>   return imout;
> }
>
>
> Thanks for any comments!
>
> Best,
> Koen
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list