[Insight-users] Feature Image and Processing Time Geodesic Active Contours
Ella Maria Kadas
ella_kadas at yahoo.com
Tue Mar 1 11:30:36 EST 2011
Hi, I know I've know i already asked that, but i was wondering, better hoping that i am doing something wrong: I am using a dicom Series of 25 slices of image t2 Head MRT 640x640 min gray value = -51 max gray value = 1359 I want to use the GeodesicActiveContourFilter, but i get only bad Segmentation results. So i tried to improve the Output of the Sigmoid, which is still partly to dark. I read what it does but still couldn't get good parameters so that the final segmentation is a good one. A more important question is this normal that the computation of the sigmoid output in the pipeline step for this filters takes around 3 minutes? It is really important for me to know because i intend to use it on a dicom series of 160 slices.This is a part of my code If anyone has an idea why it is so slow please let me know:
Reading dicom series works just fine and fast
GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New(); SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New(); sigmoid->SetOutputMinimum(0.0); sigmoid->SetOutputMaximum(1.0); smoothing->SetInput(reader->GetOutput()); gradientMagnitude->SetInput(smoothing->GetOutput()); sigmoid->SetInput(gradientMagnitude->GetOutput());
smoothing->SetTimeStep(0.0625); smoothing->SetNumberOfIterations(10); smoothing->SetConductanceParameter(1.0);
const double sigma = 1.0; gradientMagnitude->SetSigma(sigma);
sigmoid->SetAlpha(-6.0); sigmoid->SetBeta(30.0); std::cout << "I start to do my Stuff " << std::endl << std::endl; CastFilterType::Pointer caster1 = CastFilterType::New(); ………. WriterTypeChar::Pointer writerfinal = WriterTypeChar::New();ImageType::Pointer localImage = reader->GetOutput();typedef itk::FastMarchingImageFilter<ImageType,ImageType > FastMarchingFilterType; FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New(); typedef itk::GeodesicActiveContourLevelSetImageFilter< ImageType,ImageType > GeodesicActiveContourFilterType; GeodesicActiveContourFilterType::Pointer geodesicActiveContour = GeodesicActiveContourFilterType::New(); const double propagationScaling = 10.0; geodesicActiveContour->SetPropagationScaling(propagationScaling); geodesicActiveContour->SetCurvatureScaling(1.0); geodesicActiveContour->SetAdvectionScaling( 1.0 ); geodesicActiveContour->SetMaximumRMSError( 0.02 );
geodesicActiveContour->SetNumberOfIterations( 120 ); geodesicActiveContour->SetInput( fastMarching->GetOutput() ); geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() ); thresholder->SetInput( geodesicActiveContour->GetOutput() ); ImageType::IndexType index1; index1[0] = 381; index1[1] = 423; index1[2] = 14; ImageType::IndexType index2; index2[0] = 260; index2[1] = 413; index2[2] = 14; typedef FastMarchingFilterType::NodeContainer NodeContainer; typedef FastMarchingFilterType::NodeType NodeType; NodeContainer::Pointer seeds = NodeContainer::New(); double initialDistance = 5.0; double seedValue = -initialDistance; NodeType node1; node1.SetValue(seedValue); node1.SetIndex(index1); seeds->Initialize(); seeds->InsertElement(0,node1); NodeType node2; node2.SetValue(seedValue); node2.SetIndex(index2); seeds->InsertElement(1,node2); fastMarching->SetTrialPoints(seeds); fastMarching->SetSpeedConstant(1.0);
fastMarching->SetOutputSize(reader->GetOutput()->GetBufferedRegion().GetSize()); std::cout << "Fast Marching started " << std::endl << std::endl; caster4->SetInput( fastMarching->GetOutput() ); writer4->SetInput( caster4->GetOutput() ); char *name4 = "/Users/ellaK/Documents/DicomRead/FFM.gipl"; writer4->SetFileName(name4); caster4->SetOutputMinimum( 0 ); caster4->SetOutputMaximum( 255 ); try{ writer4->Update(); } catch( itk::ExceptionObject & excep ){ std::cerr << "Exception caught at writer1!" << std::endl; std::cerr << excep << std::endl; }
writerfinal->SetInput(thresholder->GetOutput()); char *name6 = "/Users/ellaK/Documents/DicomRead/Segmentation.gipl"; writerfinal->SetFileName(name6);
try { writerfinal->Update(); } catch( itk::ExceptionObject & excep ) { std::cerr << "Exception caught at writerfinal!" << std::endl; std::cerr << excep << std::endl; } }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110301/af245fcf/attachment.htm>
More information about the Insight-users
mailing list