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

Function main

Modules/Classification/CLMiniApps/CLScreenshot.cpp:117–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117int main(int argc, char* argv[])
118{
119 mitkCommandLineParser parser;
120 parser.setArgumentPrefix("--", "-");
121
122 // Required Parameter
123 parser.addArgument("image", "i", mitkCommandLineParser::Image, "Input Image", "Path to the input image files (Separated with semicolons)", us::Any(), false, false, false, mitkCommandLineParser::Input);
124 parser.addArgument("output", "o", mitkCommandLineParser::File, "Output text file", "Path to output file. The output statistic is appended to this file.", us::Any(), false, false, false, mitkCommandLineParser::Output);
125 parser.addArgument("direction", "dir", mitkCommandLineParser::String, "Int", "Allows to specify the direction for Cooc and RL. 0: All directions, 1: Only single direction (Test purpose), 2,3,4... Without dimension 0,1,2... ", us::Any());
126
127 // Miniapp Infos
128 parser.setCategory("Classification Tools");
129 parser.setTitle("Screenshot of a single image");
130 parser.setDescription("");
131 parser.setContributor("German Cancer Research Center (DKFZ)");
132
133 std::map<std::string, us::Any> parsedArgs = parser.parseArguments(argc, argv);
134
135 if (parsedArgs.size()==0)
136 {
137 return EXIT_FAILURE;
138 }
139 if ( parsedArgs.count("help") || parsedArgs.count("h"))
140 {
141 return EXIT_SUCCESS;
142 }
143
144 std::string version = "Version: 1.0";
145 MITK_INFO << version;
146
147 //int direction = 0;
148 if (parsedArgs.count("direction"))
149 {
150 MITK_INFO << "Warning: Option direction currently not supported";
151 // direction = mitk::cl::splitDouble(parsedArgs["direction"].ToString(), ';')[0];
152 }
153
154 auto listOfFiles = mitk::cl::splitString(parsedArgs["image"].ToString(), ';');
155
156 // Create a QTApplication and a Datastorage
157 // This is necessary in order to save screenshots of
158 // each image / slice.
159 QApplication qtapplication(argc, argv);
160 QmitkRegisterClasses();
161
162 SaveSliceOrImageAsPNG(listOfFiles, parsedArgs["output"].ToString());
163
164 return 0;
165}
166
167#endif

Callers

nothing calls this directly

Calls 14

splitStringFunction · 0.85
QmitkRegisterClassesFunction · 0.85
setArgumentPrefixMethod · 0.80
addArgumentMethod · 0.80
setCategoryMethod · 0.80
setContributorMethod · 0.80
parseArgumentsMethod · 0.80
countMethod · 0.80
SaveSliceOrImageAsPNGFunction · 0.70
AnyClass · 0.50
setTitleMethod · 0.45
setDescriptionMethod · 0.45

Tested by

no test coverage detected