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

Function main

Modules/Segmentation/cmdapps/ConvertToMultiLabelSegmentation.cpp:229–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229int 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;

Callers

nothing calls this directly

Calls 15

LoadFunction · 0.85
IsUnsupportedDataTypeFunction · 0.85
FindLargestImageFunction · 0.85
parseArgumentsMethod · 0.80
countMethod · 0.80
helpTextMethod · 0.80
whatMethod · 0.80
isImageMethod · 0.80
GetPointerMethod · 0.80
GetAllLabelValuesMethod · 0.80
frontMethod · 0.80

Tested by

no test coverage detected