| 227 | } |
| 228 | |
| 229 | int main(int argc, char* argv[]) |
| 230 | { |
| 231 | mitkCommandLineParser parser; |
| 232 | setupParser(parser); |
| 233 | |
| 234 | const std::map<std::string, us::Any>& parsedArgs = parser.parseArguments(argc, argv); |
| 235 | |
| 236 | if (parsedArgs.count("help") || parsedArgs.count("h")) |
| 237 | { |
| 238 | std::cout << parser.helpText(); |
| 239 | return EXIT_SUCCESS; |
| 240 | } |
| 241 | |
| 242 | if (!configureApplicationSettings(parsedArgs)) |
| 243 | { |
| 244 | MITK_ERROR << "Invalid command line arguments. Use -h or --help for usage information."; |
| 245 | return EXIT_FAILURE; |
| 246 | } |
| 247 | |
| 248 | if (inputFilenames.empty()) |
| 249 | { |
| 250 | MITK_ERROR << "No input files specified."; |
| 251 | return EXIT_FAILURE; |
| 252 | } |
| 253 | |
| 254 | try |
| 255 | { |
| 256 | std::cout << "Loading input files..." << std::endl; |
| 257 | |
| 258 | // Load all input data |
| 259 | std::vector<InputData> inputs; |
| 260 | mitk::PreferenceListReaderOptionsFunctor readerFilterFunctor = |
| 261 | mitk::PreferenceListReaderOptionsFunctor({"MITK DICOM Reader v2 (autoselect)"}, {""}); |
| 262 | |
| 263 | for (const auto& filename : inputFilenames) |
| 264 | { |
| 265 | std::cout << "Loading: " << filename << std::endl; |
| 266 | |
| 267 | InputData inputData; |
| 268 | inputData.filename = filename; |
| 269 | |
| 270 | try |
| 271 | { |
| 272 | // Try to load as different data types |
| 273 | auto loadedData = mitk::IOUtil::Load(filename, &readerFilterFunctor); |
| 274 | if (loadedData.empty()) |
| 275 | { |
| 276 | MITK_ERROR << "Failed to load: " << filename; |
| 277 | return EXIT_FAILURE; |
| 278 | } |
| 279 | |
| 280 | inputData.data = loadedData[0]; |
| 281 | |
| 282 | // Check data type |
| 283 | if (IsUnsupportedDataType(inputData)) |
| 284 | { |
| 285 | MITK_ERROR << "Unsupported data type ("<< inputData.data->GetNameOfClass() << ")" |
| 286 | "for file: " << filename; |
nothing calls this directly
no test coverage detected