diff --git a/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/FirstSteps.dox b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/FirstSteps.dox index 537a0091b0..7b01d0b3e1 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/FirstSteps.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/FirstSteps.dox @@ -1,14 +1,15 @@ /** \page FirstSteps First steps in Development This section will show you how to extend MITK for your own project. */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/MiniAppCommandLineToolHowTo.dox b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox similarity index 69% rename from Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/MiniAppCommandLineToolHowTo.dox rename to Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox index 7ec6b37452..466bfcd53b 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/MiniAppCommandLineToolHowTo.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox @@ -1,94 +1,138 @@ /** \page MiniAppCommandLineToolHowToPage How to create a MiniApp command line tool \tableofcontents This page will give you an overview of creating your own command line tool that can be integrated into a MiniApp. If you don't know about MiniApps, you can read what MiniApps are at the \ref MiniAppExplainPage page. \section MinAppCommandLineToolDescription What's a MiniApp command line tool? A MiniApp command line tool allows for configuration of command line arguments and eases the access to these argument values. Additionally, a command line tool provides a XML representation of the configured arguments. This XML representation can be used for automatic user interface generation. \section MiniAppCommandLineToolSetUp Setting up a command line tool This section describes the most important code parts a command line tool consists of using the example of the \ref TensorReconstruction command line tool. First of all the main function of the command line tool is specified. This function is registered at the MiniAppManager via the macro defined in \ref MiniAppManager.h \code int TensorReconstruction(int argc, char* argv[]) { } RegisterDiffusionMiniApp(TensorReconstruction); \endcode Within the body of the main function the accepted arguments of the command line tool are specified via the addArgument method of the ctkCommandLineParser located in DiffusionImaging/MiniApps directory. The \ref TensorReconstruction command line tool requires an input file, an output file, and optionally accepts a threshold of type integer. \code ctkCommandLineParser parser; parser.setArgumentPrefix("--", "-"); parser.addArgument("input", "i", ctkCommandLineParser::InputFile, "Input file", "input raw dwi (.dwi or .fsl/.fslgz)", us::Any(), false); parser.addArgument("outFile", "o", ctkCommandLineParser::OutputFile, "Output file", "output file", us::Any(), false); parser.addArgument("b0Threshold", "t", ctkCommandLineParser::Int, "b0 threshold", "baseline image intensity threshold", 0, true); \endcode Following argument types are available for the addArgument method:\li String \li Bool \li StringList \li Int \li Float \li InputDirectory \li InputFile \li OutputDirectory \li OutputFile The distinction between InputFile/OutputFile and InputDirectory/OutputDirectory respectively ensures that the appropriate UI widget is chosen. The label string passed to the addArgument method is the label for the corresponding UI widget. After specification of allowed arguments the parser's parseArguments method is called. This method returns a mapping of long argument names and their values. \code map parsedArgs = parser.parseArguments(argc, argv); if (parsedArgs.size() == 0) return EXIT_FAILURE; \endcode The following code snippet shows how argument values can be accessed and converted: \code std::string inFileName = us::any_cast(parsedArgs["input"]); std::string outFileName = us::any_cast(parsedArgs["outFile"]); int threshold = 0; if (parsedArgs.count("b0Threshold")) threshold = us::any_cast(parsedArgs["b0Threshold"]); \endcode From now on the values of the command line arguments are used in the application logic. \section MiniAppCommandLineToolXMLRepresentation Retrieving XML argument description According to the specified command line arguments, a XML representation of the arguments is generated and emitted on the console if the MiniApp command line tool is executed with argument "--xml". In order to use the XML representation for automatic user interface generation additional information has to be provided for the parser. Please provide category, title, description and contributor as shown in code snippet below for the \ref TensorReconstruction command line tool: \code parser.setCategory("Preprocessing Tools"); parser.setTitle("Tensor Reconstruction"); parser.setDescription("Takes a .dwi, .fsl/.fslgz file as input and saves the computed reconstructed tensor to the specified file. It also allows for a threshold to be set, to exclude low b values from the reconstruction process."); parser.setContributor("MBI"); \endcode -Note that in the generated UI the parameter widgets are contained in a group box. The label of such a parameter group and a description can be set via the parser's changeParameterGroup method. +Note that in the generated UI the parameter widgets are contained in a group box. There is a default label ("Parameters") and a default description ("Groupbox containing parameters.") specified. The label of such a parameter group and the description can be set via the parser's changeParameterGroup method. The method must be called before adding the arguments. -following output will be emitted: - +Running the \ref TensorReconstruction command line tool for MITK Diffusion MiniApp with argmument "--xml" ... +\code +./MitkDiffusionMiniApps TensorReconstruction --xml +\endcode + +... will emit following XML description: + +\code + + Preprocessing Tools + Tensor Reconstruction + Takes a .dwi, .fsl/.fslgz file as input and saves the computed reconstructed tensor to the specified file. It also allows for a threshold to be set, to exclude low b values from the reconstruction process. + MBI + + + Groupbox containing parameters. + + input + + input raw dwi (.dwi or .fsl/.fslgz) + input + i + input + + + outFile + + output file + outFile + o + output + + + b0Threshold + + baseline image intensity threshold + b0Threshold + t + + + +\endcode + +The generated user interface from this XML description is depicted in the following screenshot: +\imageMacro{generated_ui_tensor_reconstruction.png, "Generated UI of TensorReconstruction command line tool", 10} + */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/images/generated_ui_tensor_reconstruction.png b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/images/generated_ui_tensor_reconstruction.png new file mode 100644 index 0000000000..7de0734e66 Binary files /dev/null and b/Documentation/Doxygen/DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/images/generated_ui_tensor_reconstruction.png differ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox index 9a040cbef4..e32a0baf93 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox @@ -1,48 +1,46 @@ /** \page TutorialPage The MITK Tutorial If you have set up and compiled MITK already and want to know more about developing with MITK you might want to read the \ref TutorialSection. If you want help setting up MITK and creating your own project using MITK you should take a look at \ref HowToNewProject. \section TutorialFirstSteps First steps in MITK If you are absolutely new to MITK you might want to read up on setting up MITK to use in your development. The following pages will help you in this task.
  • \subpage HowToNewProject "A comprehensive guide to setting up your own MITK project"
  • \ref BuildInstructionsPage "Building MITK"
  • \ref CMAKE_FAQ
\section TutorialSection Tutorial chapters This tutorial will give you an introduction to developing with MITK. We will start with configuring MITK to compile the tutorial, continue to show how to display and do basic interaction with images, and finally show how to build a plug-in and add new interactions. The source code of the examples can be found in mitk/QApplications/Tutorial/ \n Two data files are used to execute the example code. \li Pic3D.nrrd \n This file contains an image and is located in bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd. \li lungs.vtk \n This file contains a surface and is located in src/MITK/Modules/MitkExt/Testing/Data/lungs.vtk. \li \subpage Step00Page "Step 0: Getting started" \li \subpage Step01Page "Step 1: Displaying an image" \li \subpage Step02Page "Step 2: Load one or more data sets" \li \subpage Step03Page "Step 3: Create 3D view" \li \subpage Step04Page "Step 4: Use several views to explore data" \li \subpage Step05Page "Step 5: Interactively add points" \li \subpage Step06Page "Step 6: Use an interactive region-grower" \li \subpage Step07Page "Step 7: Convert result of region growing into a surface" \li \subpage Step08Page "Step 8: Use QmitkStdMultiWidget as widget" \li \subpage Step09Page "Step 9: A plug-in" \li \subpage Step10Page "Step 10: How to use Interactor and how to implement new ones" -\li \subpage MiniAppCommandLineToolHowToPage "How to create a MiniApp command line tool" - Enjoy MITK! */