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

Haiyong Xu haiyeong at gmail.com
Thu Apr 29 18:23:50 EDT 2010


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