[Insight-users] FastMarchingImageFilter extremely slow for a 3D image data

Dan Mueller dan.muel at gmail.com
Fri Apr 30 01:23:16 EDT 2010


Hi Haiyong,

Are you compiling your code in Release mode? Compiling in Release mode
vs Debug mode is known to have anywhere from 3 to 300 times
performance improvement (depending on the platform, compiler, code).

Running Fast Marching on a 256x256x256 floating-point image with speed
constant 1, stopping value 500, and a single seed in the center of the
image took approximately 45 seconds on my Windows Vista, 2GHz, 3GB
RAM, Visual Studio 2005, ITK 3.16 machine.

You may consider looking at the following tests, which use the Fast
Marching filter in the manner you describe:
    Testing/Code/Algorithms/itkCurvesLevelSetImageFilterTest.cxx
    Testing/Code/Algorithms/itkLevelSetNeighborhoodExtractorTest.cxx

Please let us know if this works for you.

Regards, Dan

On 30 April 2010 00:23, Haiyong Xu <haiyeong at gmail.com> wrote:
> Hi List,
>
> I tried to use FastMarchingImageFilter with a constant speed to
> generate initial levelsets. It works very well in 2D but very slow in
> 3D. For a relative small 3D image data (60x60x60), I run the program
> for 3~5 minutes and there is no result. Is that intrinsic property of
> FastMarchingImageFilter or my mistake in programing?
>
> Below is a test program:
>
> int main( int argc, char *argv[] )
> {
>  typedef itk::Image<float, 3> ImageType;
>
>  // set up input image
>  ImageType::Pointer image = ImageType::New();
>  ImageType::RegionType region;
>  ImageType::IndexType index;
>  index[0] = index[1] = index[2] = 0;
>  ImageType::SizeType  size;
>  size[0] = 60; size[1] = 60; size[2] = 60;
>  region.SetIndex(index);
>  region.SetSize(size);
>  image->SetRegions(region);
>  image->Allocate();
>
>  // create filter and set initial point
>  typedef  itk::FastMarchingImageFilter< ImageType, ImageType >
> FastMarchingFilterType;
>  FastMarchingFilterType::Pointer  fastMarching = FastMarchingFilterType::New();
>
>  ImageType::IndexType  seedPosition;
>  seedPosition[0] = 30;  seedPosition[1] = 30; seedPosition[2] = 30;
>
>  typedef FastMarchingFilterType::NodeContainer  NodeContainer;
>  NodeContainer::Pointer seeds = NodeContainer::New();
>
>  FastMarchingFilterType::NodeType node;
>  node.SetValue( 0 );
>  node.SetIndex( seedPosition );
>  seeds->Initialize();
>  seeds->InsertElement( 0, node );
>
>  fastMarching->SetInput(image);
>  fastMarching->SetOutputSize(size);
>  fastMarching->SetTrialPoints(  seeds  );
>  fastMarching->SetSpeedConstant(1.0);
>  //fastMarching->SetStoppingValue(10);
>
>  fastMarching->Update();
>
>  return 0;
> }
>
>
> The program was built upon ITK 3.16 and run on Windows XP.
>
> Thanks for help.
>
> --Haiyong


More information about the Insight-users mailing list