| 39 | } |
| 40 | |
| 41 | int main(int argc, char* argv[]) |
| 42 | { |
| 43 | int returnValue = EXIT_SUCCESS; |
| 44 | |
| 45 | mitkCommandLineParser parser; |
| 46 | InitializeCommandLineParser(parser); |
| 47 | |
| 48 | auto args = parser.parseArguments(argc, argv); |
| 49 | |
| 50 | if (args.empty()) |
| 51 | { |
| 52 | std::cout << parser.helpText(); |
| 53 | return EXIT_FAILURE; |
| 54 | } |
| 55 | |
| 56 | nlohmann::json diagnosticsResult; |
| 57 | |
| 58 | try |
| 59 | { |
| 60 | int missingSlicesDetected = 0; |
| 61 | |
| 62 | auto inputFilename = us::any_cast<std::string>(args["input"]); |
| 63 | auto outputFilename = args.count("output")==0 ? std::string() : us::any_cast<std::string>(args["output"]); |
| 64 | bool onlyOwnSeries = args.count("only-own-series"); |
| 65 | bool check3D = args.count("check-3d"); |
| 66 | bool check3DPlusT = args.count("check-3d+t"); |
| 67 | |
| 68 | if (!check3D && !check3DPlusT) |
| 69 | { //if no check option is selected all are activated by default. |
| 70 | check3D = true; |
| 71 | check3DPlusT = true; |
| 72 | } |
| 73 | |
| 74 | diagnosticsResult["input"] = inputFilename; |
| 75 | diagnosticsResult["only-own-series"] = onlyOwnSeries; |
| 76 | diagnosticsResult["check-3d"] = check3D; |
| 77 | diagnosticsResult["check-3d+t"] = check3DPlusT; |
| 78 | |
| 79 | mitk::StringList relevantFiles = mitk::GetDICOMFilesInSameDirectory(inputFilename); |
| 80 | |
| 81 | if (relevantFiles.empty()) |
| 82 | { |
| 83 | mitkThrow() << "DICOM Volume Diagnostics found no relevant files in specified location. No data is loaded. Location: " << inputFilename; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | bool pathIsDirectory = fs::is_directory(inputFilename); |
| 88 | |
| 89 | if (!pathIsDirectory && onlyOwnSeries) |
| 90 | { |
| 91 | relevantFiles = mitk::FilterDICOMFilesForSameSeries(inputFilename, relevantFiles); |
| 92 | } |
| 93 | |
| 94 | diagnosticsResult["analyzed_files"] = relevantFiles; |
| 95 | |
| 96 | auto selector = mitk::DICOMFileReaderSelector::New(); |
| 97 | |
| 98 | if (check3D) selector->LoadBuiltIn3DConfigs(); |
nothing calls this directly
no test coverage detected