MCPcopy Create free account
hub / github.com/MITK/MITK / main

Function main

Modules/MatchPointRegistration/cmdapps/MatchImage.cpp:401–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401int main(int argc, char* argv[])
402{
403 std::cout << "MitkMatchImage - Generic light weight image registration tool based on MatchPoint." << std::endl;
404
405 Settings settings;
406 mitkCommandLineParser parser;
407 SetupParser(parser);
408
409 const std::map<std::string, us::Any>& parsedArgs = parser.parseArguments(argc, argv);
410 if (!ConfigureApplicationSettings(parsedArgs, settings))
411 {
412 MITK_ERROR << "Command line arguments are invalid. To see the correct usage please call with -h or --help to show the help information.";
413 return EXIT_FAILURE;
414 };
415
416 // Show a help message
417 if (parsedArgs.count("help") || parsedArgs.count("h"))
418 {
419 std::cout << parser.helpText();
420 return EXIT_SUCCESS;
421 }
422
423 std::cout << std::endl << "*******************************************" << std::endl;
424 std::cout << "Moving file: " << settings.movingFileName << std::endl;
425 std::cout << "Target file: " << settings.targetFileName << std::endl;
426 std::cout << "Output file: " << settings.outFileName << std::endl;
427 std::cout << "Algorithm location: " << settings.algFileName << std::endl;
428
429 try
430 {
431 auto algorithm = loadAlgorithm(settings);
432
433 auto command = ::itk::CStyleCommand::New();
434 command->SetCallback(OnMapAlgorithmEvent);
435 algorithm->AddObserver(::map::events::AlgorithmEvent(), command);
436
437 auto metaPropInterface = dynamic_cast<map::algorithm::facet::MetaPropertyAlgorithmInterface*>(algorithm.GetPointer());
438
439 if (!settings.parameters.empty())
440 {
441 if (nullptr == metaPropInterface)
442 {
443 MITK_WARN << "loaded algorithm does not support custom parameterization. Passed user parameters are ignored.";
444 }
445 else
446 {
447 nlohmann::json paramMap;
448
449 std::string parseError = "";
450 try
451 {
452 paramMap = nlohmann::json::parse(settings.parameters);
453 }
454 catch (const std::exception& e)
455 {
456 parseError = e.what();
457 }
458 if (!parseError.empty())

Callers

nothing calls this directly

Calls 15

SetupParserFunction · 0.85
loadAlgorithmFunction · 0.85
WrapIntoMetaPropertyFunction · 0.85
loadMaskImageFunction · 0.85
parseArgumentsMethod · 0.80
countMethod · 0.80
helpTextMethod · 0.80
AddObserverMethod · 0.80
GetPointerMethod · 0.80
whatMethod · 0.80
IsNotNullMethod · 0.80

Tested by

no test coverage detected