diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step00.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step00.dox index 769f2517fd..75f4cd5400 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step00.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step00.dox @@ -1,15 +1,15 @@ /** \page Step00Page MITK Tutorial - Step 0: Getting started To build the tutorials follow the \ref BuildInstructionsPage and make sure that MITK_BUILD_EXAMPLES is checked/set to ON. \imageMacro{configureCMake.PNG,"",16.00} -The tutorial source files can be found in the Examples\\Tutorial\\ subdirectory of the source tree. The tutorial executables are in the bin\\Release\\ or bin\\Debug\\ subdirectory (Windows) respectively the bin\\ subdirectory (Linux/Mac) of the binary tree after compilation (called StepX, corresponding to the tutorial step). +The tutorial source files can be found in the Examples\\Tutorial\\ subdirectory of the source tree. The tutorial executables are in the bin\\Release\\ or bin\\Debug\\ subdirectory (Windows) respectively the bin\\ subdirectory (Linux/Mac) of the binary tree after compilation (called MitkStepX, corresponding to the tutorial step). \ref Step01Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox index 78d4cf9aab..652617c041 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox @@ -1,22 +1,27 @@ /** \page Step01Page MITK Tutorial - Step 1: Displaying an image -\imageMacro{step1_result.png,"",6.22} +\li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd +\imageMacro{step1_result.png,"",6.22} Open your IDE. All steps can be found among the listed projects. The first program shows how to display an image in a 2D view. The picture above is a screenshot of the program. -The program has to be executed using the image file bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd. +The program has to be executed using the image file Pic3D.nrrd. -If you are using Visual Studio use the StartVS_release.bat in your bin\\ subdirectory to start it with all required paths set. To set the image file path in Visual Studio, right click on "Step1"-project and go to 'Properties -> Configuration Properties -> Debugging'. Now insert the image file path in the "Command Arguments" text field. Use this also in the following steps. +If you are using Visual Studio use the StartVS_release.bat in your bin\\ subdirectory to start it with all required paths set. +To set the image file path in Visual Studio, right click on "MitkStep1"-project and go to 'Properties -> Configuration Properties -> Debugging'. +Now insert the image file path to Pic3D.nrrd in the "Command Arguments" text field. +Then right click on the "MitkStep1"-project again and select "Set as StartUp Project". Start to run the code. Use this also in the following steps. \imageMacro{configureVisualStudioProperties.png,"",11.85} The code is divided into parts I through V. First of all a DataTree has to be created. Then data has to be read from a file which afterwards has to be put into the tree. Part IV creates a window and passes the tree to it. The last part deals with some Qt-specific initialization. \include Step1.cpp \ref Step00Page "[Previous step]" \ref Step02Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox index 31aa2e535d..bd35b8bae2 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox @@ -1,30 +1,34 @@ /** \page Step02Page MITK Tutorial - Step 2: Load one or more data sets - \image html step2_result.png - \li \ref Step2.cpp "Step2.cpp" \n + \li \ref Step2.cpp "Step2.cpp" \n Contains the code for this example. + \li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) \n +.../MITK/Modules/Segmentation/Testing/Data/lungs.vtk (surface) + + \image html step2_result.png \dontinclude Step2.cpp This program shows how to load multiple data sets. A DataNodeFactory is used to produce nodes containing the data. The picture above shows the result of the program when reading both the image file and the surface file. - In order to obtain the result the program has to be executed using the image file bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd and the surface file src/MITK/Modules/MitkExt/Testing/Data/lungs.vtk. + In order to obtain the result the program has to be executed using the image file Pic3D.nrrd and the surface file lungs.vtk. The code for this example equals the code of Step 1 except for part II and part III which are changed as follows: \skipline Part II \until exit(2) \line } \line } \ref Step01Page "[Previous step]" \ref Step03Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox index 1f10f8283c..9cb98dc0fd 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox @@ -1,48 +1,51 @@ /** \page Step03Page MITK Tutorial - Step 3: Create 3D view + \li \ref Step3.cpp "Step3.cpp" \n +Contains the code that both creates a 3D view and turns volume rendering on. + \li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) \n +.../MITK/Modules/Segmentation/Testing/Data/lungs.vtk (surface) + + As in the previous step, one or more data sets (many images, surface and other formats) may be loaded. The difference is that they are displayed in a 3D view. The QmitkRenderWindow is now used for displaying a 3D view, by setting the used mapper-slot to Standard3D. Since volume-rendering is a (rather) slow procedure, the default is that images are not displayed in the 3D view. In Step 3a the default is kept whereas in Step 3b volume rendering is turned on. -As in the previous step, to obtain the result the program has to be executed using the image file bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd and the surface file src/MITK/Modules/MitkExt/Testing/Data/lungs.vtk. - - -\li \ref Step3.cpp "Step3.cpp" \n -Contains the code that both creates a 3D view and turns volume rendering on. +As in the previous step, to obtain the result the program has to be executed using the image file Pic3D.nrrd and the surface file lungs.vtk. \section Step3aSection Step 3a - Volume rendering turned off \imageMacro{step3a_result.png,"",6.22} \dontinclude Step3.cpp Tell the renderer to create a 3D view: \skipline // Use it as a 3D view! \skipline renderWindow.GetRenderer()->SetMapperID The rest of the code remains unchanged. The picture above shows the result of the program when reading both the image and the surface file. As volume rendering is off the image is not visible. \section Step3bSection Step 3b - Volume rendering turned on \imageMacro{step3b_result.png,"",6.22} Volume Rendering is now turned on as shown in the picture above. \dontinclude Step3.cpp The property "volumerendering" has to be enabled on the node containing the image. \skipline Check \until node->SetProperty \ref Step02Page "[Previous step]" \ref Step04Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox index 3be398d420..7bd72c0dbe 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox @@ -1,66 +1,69 @@ /** \page Step04Page MITK Tutorial - Step 4: Use several views to explore data +\li \ref Step4.cpp "Step4.cpp"\n +Contains the code of step 4a + b. +\li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) \n +.../MITK/Modules/Segmentation/Testing/Data/lungs.vtk (surface) + As in Step 2 and Step 3 one or more data sets may be loaded. This now creates three views on the data. The QmitkRenderWindow is used for displaying a 3D view as in Step 3, but without volume-rendering. Furthermore two 2D views for slicing through the data are created. -The class QmitkSliceWidget is used, which is based on the class QmitkRenderWindow, but additionally provides sliders -to slice through the data. We create two instances of -QmitkSliceWidget, one for axial and one for sagittal slicing. Step 4b enhances the program in that the two slices are also shown at their correct position in 3D as well as intersection-line, each in the other 2D view. +The class QmitkSliceWidget is used, which is based on the class QmitkRenderWindow, but additionally provides sliders to slice through the data. We create two instances of +QmitkSliceWidget, one for axial and one for sagittal slicing. +Step 4b enhances the program in that the two slices are also shown at their correct position in 3D as well as intersection-line, each in the other 2D view. -As in the previous steps, to obtain the result the program has to be executed using the image file bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd and the surface file src/MITK/Modules/MitkExt/Testing/Data/lungs.vtk. +As in the previous steps, to obtain the result the program has to be executed using the image file Pic3D.nrrd and the surface file lungs.vtk. -\li \ref Step4.cpp "Step4.cpp"\n -Contains the code of step 4a + b. - \section Step4aSection Step 4a - Create axial and sagittal view \imageMacro{step4a_result.png,"",11.01} \dontinclude Step4.cpp Create a Qt horizontal box for the layout: \skipline QHBox Then create a renderwindow: \skipline QmitkRenderWindow \until SetMapperID Create a 2D view for slicing axially: \skipline view2 \until view2.SetData Then create a 2D view for slicing sagitally. \skipline view3 \until view3.SetData The toplevelWidget is now the new main widget: \skipline qtapplication \skipline toplevelWidget.show \section Step4bSection Step 4b - Display slice positions \imageMacro{step4b_result.png,"",11.01} We now want to see the position of the slice in 2D and the slice itself in 3D. Therefore it has to be added to the tree: \dontinclude Step4.cpp \skipline ds->Add(view2.GetRenderer() \skipline ds->Add(view3.GetRenderer() Slice positions are now displayed as shown in the picture. \dontinclude Step4.cpp \ref Step03Page "[Previous step]" \ref Step05Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox index 4f22b054e3..d292aa832b 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox @@ -1,38 +1,41 @@ /** \page Step05Page MITK Tutorial - Step 5: Interactively add points - + + \li \ref Step5.cpp "Step5.cpp"\n + Contains the code for this step. + \li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) \n +.../MITK/Modules/Segmentation/Testing/Data/lungs.vtk (surface) + In addition to Step 4 where 3 views were created on the data, we now want to interactively add points. A node containing a PointSet as data is added to the data tree and a PointSetDataInteractor is associated with the node, which handles the interaction. The @em interaction @em pattern is defined in a state-machine, stored in an external XML file. Thus, we need to load a state-machine. A state machine describes interaction pattern with different states (states beeing something like "a point is selected") and transitions to these states (e.g. "select a point"). These transitions are associated with actions. In this way it is possible to model complex interaction schemes. By what these transitions and actions are triggered is described in a configuration file. It maps user events to identifiers that are used in the state machine patterns. In this way the user interaction can be changed by simply loading a different configuration file for a state machine, and the user may add points now with a right click instead of left click + SHIFT, as in our case. Therefore after loading the state machine pattern the PointSetDataInteractor is also given a event configuration file. More information about interaction in MITK can be found \ref InteractionPage "here". In order to add a point the shift key has to be pressed while left clicking in a render window. You can also move points or remove them (left click while pressing ALT). - \li \ref Step5.cpp "Step5.cpp"\n - Contains the code for this step. - \image html step5_result.png \dontinclude Step5.cpp A PointSet and a node for it have to be created to be able to interactively adding points: \skipline mitk::PointSet \until interactor->SetDataNode(pointSetNode) \ref Step04Page "[Previous step]" \ref Step06Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox index 48a17fbb3b..d36da763a6 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox @@ -1,112 +1,118 @@ /** \page Step06Page MITK Tutorial - Step 6: Use an interactive region-grower -In this step the program is enhanced by the possibility to start a region-grower at interactively added points. -We will see how MITK images can be accessed as ITK images. -We now load the image file only (bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd) since the surface will be the result of the region-growing. - -\imageMacro{step6_result.png,"",13.55} - The source is now split among several files: \li \ref Step6.cpp "Step6.cpp" \li \ref Step6.h "Step6.h" \li \ref Step6RegionGrowing.txx "Step6RegionGrowing.txx" \li \ref Step6RegionGrowing1.cpp "Step6RegionGrowing1.cpp" \li \ref Step6RegionGrowing2.cpp "Step6RegionGrowing2.cpp" \li \ref Step6main.cpp "Step6main.cpp" +\li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) + + +In this step the program is enhanced by the possibility to start a region-grower at interactively added points. +We will see how MITK images can be accessed as ITK images. +We now load the image file Pic3D.nrrd only since the surface will be the result of the region-growing. + +Add points in the image by pressing SHIFT+left mouse key, then adjust the thresholds and press 'Start region growing'. + +\imageMacro{step6_result.png,"",13.55} -The class Step6 inherits from QWidget and provides methods for setting up the widgets. Step6RegionGrowing.cpp contains a method for performing the region-growing. Step6main.cpp contains main. +The class Step6 inherits from QWidget and provides methods for setting up the widgets. +Step6RegionGrowing.cpp contains a method for performing the region-growing. Step6main.cpp contains main. Like in ITK and VTK class member names start with m_ followed by the proper member name starting with a capital letter (e.g. m_Tree). Function names start with capital letters. To learn more about style conventions in MITK read \ref StyleGuideAndNotesPage "The MITK Style Guide". \dontinclude Step6.cpp The widgets are initialized as in the previous steps but with an additional QVBox for a button to start the segmentation: \skipline Create controlsParent \until hlayout->addWidget(m_LineEditThresholdMax) This creates a button to start the segmentation and its clicked() signal is connected to the method StartRegionGrowing(): \dontinclude Step6.cpp \skipline QPushButton* startButton \skipline connect(startButton \section AccessMTIKImagesAsITKImagesSection Access MITK images as ITK images ITK images are templated whereas mitk::Images are not. To use ITK filters with MITK images, we have to convert from MITK to ITK. To do so, first define an access method, which is templated as an ITK image is: \code template MyAccessMethod(itk::Image* itkImage) { ... } \endcode If you don't understand this template syntax, you should read any C++ text book. Understanding template syntax is crucial to successfully using ITK. To call this templated method with an (untemplated) mitk::Image, you can use the AccessByItk macro from mitkImageAccessByItk.h. This macro checks for the actual image type of the mitk::Image and does any neccessary conversions. Look into "Modules / Adaptor classes" for more information. \code AccessByItk(mitkImage, MyAccessMethod) \endcode \dontinclude Step6RegionGrowing.txx In this step our access method is called RegionGrowing() (defined in \ref Step6RegionGrowing.txx "Step6RegionGrowing.txx"): \skipline template \until } \until } Additionally the access function has to be instantiated for all datatypes and two/three dimensions as some compilers have memory problems without this explicit instantiation, some even need instantiations in separate files for 2D/3D: \n For 2D in \ref Step6RegionGrowing1.cpp "Step6RegionGrowing1.cpp" : \dontinclude Step6RegionGrowing1.cpp \skipline InstantiateAccessFunctionForFixedDimension_1 ... and for 3D in \ref Step6RegionGrowing2.cpp "Step6RegionGrowing2.cpp": \dontinclude Step6RegionGrowing2.cpp \skipline InstantiateAccessFunctionForFixedDimension_1 \dontinclude Step6.cpp The method StartRegionGrowing() finally calls our access method RegionGrowing(): \skipline Step6::StartRegionGrowing \until } \section ConvertingITKMITKSection Converting ITK images to MITK images and vice versa In some cases it is useful to simply convert between ITK and MITK images. The direction ITK to MITK is easy, since mitk::Image can handle most data types. The direction MITK to ITK is more critical, since ITK images have to be instantiated with a fixed pixel type and fixed dimension at compile time. \li \code mitk::Image mitk::ImportItkImage(itk::Image<...>) \endcode \li \code mitk::CastToItkImage(mitkImage, itk::Image<...>) \endcode \section ConnectingMITKToVTKSection Connecting MITK images to VTK Images are not converted or copied: The data array is just accessed via an encapsulating VTK object. \li \code vtkImageData* mitk::Image::GetVtkImageData(int time = 0) \endcode \section SurfacesMITKToVTKSection MITK Surfaces to VTK and vice versa Again: not a conversion, just accessing. \li \code vtkPolyData* mitk::Surface::GetVtkPolyData(int time = 0) \endcode \li \code mitk::Surface::SetVtkPolyData(vtkPolyData*, int time = 0) \endcode \ref Step05Page "[Previous step]" \ref Step07Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox index 6e9b36dcac..963460f55f 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox @@ -1,21 +1,21 @@ /** \page Step07Page MITK Tutorial - Step 7: Convert result of region growing into a surface - In this step the result of the previous step is converted into a surface by means of a VTK filter. - - \li \ref Step7.cpp "Step7.cpp"\n \li \ref Step7.h "Step7.h"\n \li \ref Step7main.cpp "Step7main.cpp"\n + \li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) + + In this step the result of the previous step is converted into a surface by means of a VTK filter. Step7 inherits from Step6. It enhances the method StartRegionGrowing() by processing the result image. - \dontinclude Step7.cpp \skipline if(m_ResultImage \until } \ref Step06Page "[Previous step]" \ref Step08Page "[Next step]" \ref TutorialPage "[Main tutorial page]" */ \ No newline at end of file diff --git a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox index 369b0f9a54..e5a7d8c13d 100644 --- a/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox +++ b/Documentation/Doxygen/DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox @@ -1,24 +1,25 @@ /** \page Step08Page MITK Tutorial - Step 8: Use QmitkStdMultiWidget as widget + \li \ref Step8.cpp "Step8.cpp"\n + \li \ref Step8.h "Step8.h"\n + \li \ref Step8main.cpp "Step8main.cpp"\n + \li Path to files used in this step: \n +.../bin/CMakeExternals/Source/MITK-Data/Pic3D.nrrd (image) + In this step a QmitkStdMultiWidget is used. It offers four views of the data. From top left to bottom left the views are initialized as axial, sagittal and coronar. The bottom right view is initialized as 3D view. \image html step8_result.png - - \li \ref Step8.cpp "Step8.cpp"\n - \li \ref Step8.h "Step8.h"\n - \li \ref Step8main.cpp "Step8main.cpp"\n - Step8 inherits from Step6. The method SetupWidgets() is changed: A QmitkStdMultiWidget is used instead of one QmitkRenderWindow and two instances of QmitkSliceWidget. \dontinclude Step8.cpp \skipline Part Ia \until EnableNavigationControllerEventListening \ref Step07Page "[Previous step]" \ref Step09Page "[Next step]" */