Commit 41b5272a authored by Jean-Loup Haberbusch's avatar Jean-Loup Haberbusch
Browse files

Update Create_a_manual_segmentation_tool.md

parent 6bcc8667
Pipeline #16735 canceled with stage
......@@ -40,9 +40,11 @@ let’s add two parameters to it.
1. Contour Color: the color of the contour
2. Contour Width: the line width of the contour
<!--
The autogenerated code skeleton can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/01.zip).
And let’s use this code base to develop our tutorial.
-->
Build the CEP and add the Segmentor action to CamiTK-imp. Load an image
to CamiTK-imp and you will find the **Segmentor** action under
......@@ -87,38 +89,21 @@ The default widget created by the Action will also be added to this
QFrame. Ultimately, this QFrame will be returned by the overloaded
`getWidget( )` method of the action.
Finally, let’s remove the content of the `
apply( )` method and delete the `
process( )` method given by default.
Finally, let’s remove the content of the `apply( )` method and delete the `process( )` method given by default.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/02.zip).
-->
When you load the action and click on the provided buttons nothing
executes as we have not specified what to do when the user interacts
with those
widgets.
When you load the action and click on the provided buttons nothing executes as we have not specified what to do when the user interacts with those widgets.
## Step 03: Draw contours in a given orthogonal viewer (axial, coronal or sagittal) of CamiTK-imp
As the viewer on which the contours are drawn is going to be used
throughout the implementation, we will create an ENum for the viewers.
We will update the currently selected viewer depending on the radio
button selected in the GUI. We could listen to the `Clicked( )` signal of the radio
button and set the currently selected viewer accordingly. In order to do
this, we need to access the GUI widgets. Hence, we should set the
objects names of the three radio buttons using the
`setObjectName( )` method. Since we
are going to use the signals and slots mechanism, we have to include the
`Q_OBJECT` macro in the class header
file.
In order to draw contours on a viewer we can use the
`vtkContourWidget`[^2]. We will
create a member variable that will hold an instance of a
vtkContourWidget. The contour should be drawn on the selected slice of
As the viewer on which the contours are drawn is going to be used throughout the implementation, we will create an ENum for the viewers. We will update the currently selected viewer depending on the radio button selected in the GUI. We could listen to the `Clicked( )` signal of the radio button and set the currently selected viewer accordingly.
In order to do this, we need to access the GUI widgets. Hence, we should set the objects names of the three radio buttons using the`setObjectName( )` method. Since we are going to use the signals and slots mechanism, we have to include the `Q_OBJECT` macro in the class header file.
In order to draw contours on a viewer we can use the `vtkContourWidget`[^2]. We will create a member variable that will hold an instance of a `vtkContourWidget`. The contour should be drawn on the selected slice of
the selected viewer. In order to calculate the plane where the contour
should be drawn, we require the information of the ImageComponent on
which the contours are drawn. We will use another member variable to
......@@ -139,8 +124,10 @@ that handles the above mentioned requirements. And let’s setup this
method to be executed when the **Reset** button is clicked and also when
the selected viewer is changed.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/03.zip).
-->
Once the action is loaded, you will be able to draw contours on any of
the slices of the
......@@ -166,11 +153,12 @@ when completing the contour. Let’s implement that in a method called
it up with the `clicked( )` signal of
the Complete button.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/04.zip).
-->
Now you will be able to complete the contour
drawn.
Now you will be able to complete the contour drawn.
## Step 05: Build the segmentation image and show the region inside the contour in the orthogonal viewers
......@@ -237,8 +225,10 @@ These steps will be executed with the `clicked( )` signal of the **Accept** butt
corresponding slot `acceptCurrentContour(
)`.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/05.zip).
-->
Now when you click the **Accept** button the region inside the contour
will be highlighted and the corresponding regions of other viewers will
......@@ -258,8 +248,10 @@ method. Since repeating the same lines of code is not a good coding
practice, we will modify the `drawOverlaysOn2DViewers( )` method to handle this situation as
well.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/06.zip).
-->
Now when you change the viewer sliders the segmented regions will be
correctly updated.
......@@ -273,8 +265,10 @@ is very easy to get a surface mesh of the segmented regions using
`vtkMarchingCubes` filter[^5]. This
behavior is implemented in the `updateSegmentedMesh( )` method.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/07.zip).
-->
Now when you add a new region to the segmentation, it will immediately
be shown in the 3D
......@@ -294,8 +288,10 @@ In order to correct this mishap we need to transform all
world coordinates. The `updateSegmentedMesh(
)` method is modified accordingly.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/08.zip).
-->
Now even if you draw on an image which is subjected to an arbitrary
transformation the segmentation mesh will be correctly shown in the 3D
......@@ -322,8 +318,10 @@ to reset the contour. Instead, lets modify the already implemented
`resetCurrentContourWidget( )` method
and bring the common commands to a common method.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/09.zip).
-->
Now you can use **Paste Last** button to paste the last drawn contour on
another image.
......@@ -344,8 +342,10 @@ the action **Save**. This behavior is implemented in the
executed when `clicked( )` signal of
**Save As Image** button is emitted.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/10.zip).
-->
Now the **Reset** and **Save As Image** button are functional.
......@@ -379,8 +379,10 @@ instantiate `Segmentor` class. Let’s
encapsulate the changing button availability in a method called
`changeButtonAvailability( )`.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/11.zip).
-->
Certains buttons are enabled/disabled appropriately in order to make the
tool more robust.
......@@ -395,8 +397,10 @@ Deleting the `segmentedImage` and
Hence, users are advised to finish segmenting one image before moving on
to another.
<!--
The corresponding code skeleton of the action can be found
[here](http://prasnuts.free.fr/images/stories/site/files/CamiTK/12.zip).
-->
Now the user can change the `ImageComponent` on which the contours are drawn.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment