int
main(int argc, char ** argv)
{
if (argc < 6)
{
std::cerr << "Missing arguments" << std::endl;
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " featureImage outputImage";
std::cerr << " startx starty seedValue" << std::endl;
return EXIT_FAILURE;
}
unsigned int nb_iteration = 500;
double rms = 0.;
double epsilon = 1.;
double curvature_weight = 0.;
double area_weight = 0.;
double reinitialization_weight = 0.;
double volume_weight = 0.;
double volume = 0.;
double l1 = 1.;
double l2 = 1.;
using ScalarPixelType = float;
using SharedDataHelperType =
using LevelSetFunctionType =
domainFunction->SetEpsilon(epsilon);
using NodeContainer = FastMarchingFilterType::NodeContainer;
using NodeType = FastMarchingFilterType::NodeType;
seedPosition[0] = std::stoi(argv[3]);
seedPosition[1] = std::stoi(argv[4]);
const double initialDistance = std::stod(argv[5]);
NodeType node;
const double seedValue = -initialDistance;
node.SetValue(seedValue);
node.SetIndex(seedPosition);
seeds->Initialize();
seeds->InsertElement(0, node);
fastMarching->SetTrialPoints(seeds);
fastMarching->SetSpeedConstant(1.0);
fastMarching->SetOutputSize(featureImage->GetBufferedRegion().GetSize());
fastMarching->Update();
InternalImageType,
InternalImageType,
LevelSetFunctionType,
SharedDataHelperType>;
levelSetFilter->SetFunctionCount(1);
levelSetFilter->SetFeatureImage(featureImage);
levelSetFilter->SetLevelSet(0, fastMarching->GetOutput());
levelSetFilter->SetNumberOfIterations(nb_iteration);
levelSetFilter->SetMaximumRMSError(rms);
levelSetFilter->SetUseImageSpacing(1);
levelSetFilter->SetInPlace(false);
levelSetFilter->GetDifferenceFunction(0)->SetDomainFunction(domainFunction);
levelSetFilter->GetDifferenceFunction(0)->SetCurvatureWeight(curvature_weight);
levelSetFilter->GetDifferenceFunction(0)->SetAreaWeight(area_weight);
levelSetFilter->GetDifferenceFunction(0)->SetReinitializationSmoothingWeight(reinitialization_weight);
levelSetFilter->GetDifferenceFunction(0)->SetVolumeMatchingWeight(volume_weight);
levelSetFilter->GetDifferenceFunction(0)->SetVolume(volume);
levelSetFilter->GetDifferenceFunction(0)->SetLambda1(l1);
levelSetFilter->GetDifferenceFunction(0)->SetLambda2(l2);
levelSetFilter->Update();
try
{
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return -1;
}
return EXIT_SUCCESS;
}