Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #40. Edited meshing module 2-8 pages. #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions docs/modules/ROOT/pages/meshing/module-2-surface-from-image.adoc
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
= Surface extraction

The goal here is to extract and create a 3D model of the surface of the blood vessels, using a level set method.
The level sets are initialiazed using either the isosurface of a given intensity value (*isosurface* method) or a given intensity range (*threshold* method).
The goal of this module is to extract and create a 3D model of the surface of the blood
vessels, using a level set method.
The level sets are initialized using either the isosurface of a given intensity
value (*isosurface* method) or a given intensity range (*threshold* method).
A marching cube algorithm then extracts the surface.

== Surface subdivision

The resulting surface can be subdivided using 3 methods:

*linear*:: (original points are preserved and linear subdivisions are created in between),
*linear*:: (original points are preserved and linear subdivisions are created in
between),
*butterfly*:: (original points are preserved and new points are added)
*loop*:: (original points are displaced and new points are added).

NOTE: The difference between the last two is the smoothness they tend to bend the surface to: C^1 for *butterfly*, C^2 for *loop*.
NOTE: The difference between the last two is the smoothness they tend to bend
the surface to: C^1 for *butterfly*, C^2 for *loop*.

The executable we use is named `meshing_surfacefromimage`.

Expand All @@ -26,12 +30,33 @@ The executable we use is named `meshing_surfacefromimage`.
- `--input.image.filename`: (string) Input image
- `--output.path`: (string) Output file
- `--config-file`: (string) Configuration file
- `--force-rebuild=1` :(int) 0 to avoid computing if target file already exists, 1 to overwrite it
- `--pre-process.resize-from-reference-image.path`: (string) Reference image to resize.
- `--method=threshold` (string) method to use for level set initialization among: threshold or isosurface- `--image-fusion.operator=max` (string) method operator among : max, min, multiply, substract- `--threshold.lower` (double) lower bound for the threshold limit- `--threshold.higher` (double) higher bound for the threshold limit- `--apply-connectivity.largest-region=1` (bool) 1 to keep the *n* largest connected regions, 0 to keep everything- `--apply-connectivity.number=1` (int) Number *n* used above.
- `--post-process.subdivide-surface` (bool) 1 to enable surface subdivision, 0 to disable it
- `--post-process.smooth-surface` (bool) 1 to enable surface smoothing, 0 to disable it
- `--subdivide-surface.method=butterfly` (string) Name of the surface subdivision method to use, among: linear, butterfly, loop- `--subdivide-surface.subdivisions=1` (int) Number of subdivisions- `--smooth-surface.method=taubin` (string) Name of the surface smoothing method to use, among : taubin, laplace- `--smooth-surface.iterations=30` (int) Number of iterations- `--smooth-surface.taubin.passband=0.1` (double) Low-pass filter threshold for the Taubin method- `--smooth-surface.laplace.relaxation=0.01` (double) Relaxation factor for the Laplace method
- `--force-rebuild=1` :(int) 0 to avoid computing if target file already exists,
1 to overwrite it
- `--pre-process.resize-from-reference-image.path`: (string) Reference image to
resize.
- `--method=threshold` (string) method to use for level set initialization
among: threshold or isosurface.
- `--image-fusion.operator=max` (string) method operator among : max, min,
multiply, substract.
- `--threshold.lower` (double) lower bound for the threshold limit.
- `--threshold.higher` (double) higher bound for the threshold limit.
- `--apply-connectivity.largest-region=1` (bool) 1 to keep the *n* largest
connected regions, 0 to keep everything.
- `--apply-connectivity.number=1` (int) Number *n* used above.
- `--post-process.subdivide-surface` (bool) 1 to enable surface subdivision,
0 to disable it
- `--post-process.smooth-surface` (bool) 1 to enable surface smoothing, 0 to
disable it
- `--subdivide-surface.method=butterfly` (string) Name of the surface
subdivision method to use, among: linear, butterfly, loop.
- `--subdivide-surface.subdivisions=1` (int) Number of subdivisions.
- `--smooth-surface.method=taubin` (string) Name of the surface smoothing
method to use, among : taubin, laplace.
- `--smooth-surface.iterations=30` (int) Number of iterations.
- `--smooth-surface.taubin.passband=0.1` (double) Low-pass filter threshold for
the Taubin method.
- `--smooth-surface.laplace.relaxation=0.01` (double) Relaxation factor for the
Laplace method


== Troubleshooting
Expand All @@ -42,4 +67,4 @@ Please report any problem you may encounter.



link:Meshing_Module_Description.adoc[Go back to The Meshing Module]
xref:Meshing_Module_Description.adoc[Go back to The Meshing Module]
142 changes: 96 additions & 46 deletions docs/modules/ROOT/pages/meshing/module-3-centerlines-gui-tool.adoc
Original file line number Diff line number Diff line change
@@ -1,97 +1,147 @@
= The Center line Editing Graphical Tool

The Centerline Editing Graphical Tool's (CEGT) purpose is to assist the user in centerlines creation and edition.
At this time (november 2016), it essentially remains a manual task, and a critical step in the pipeline (see the Center lines definition section in link:Meshing_Module_Description.adoc[the Meshing Module Description page].)
The Centerline Editing Graphical Tool's (CEGT) purpose is to assist the user in
centerlines creation and edition.
At this time (November 2016), it essentially remains a manual task, and a
critical step in the pipeline (see the Center lines definition section in
xref:Meshing_Module_Description.adoc[the Meshing Module Description page].)

== Overview

Although the CEGT is started using command line (and outputs useful messages there too), all operations are performed in its GUI (graphical user interface.)
Although the CEGT is started using command line (and outputs useful messages
there too), all operations are performed in its GUI (graphical user interface.)

The user is presented with the initial blood vessels mesh generated in the previous step.
The user is presented with the initial blood vessels mesh generated in the
previous step.

The goal is to define center lines for each vein/artery.
To define a center line, the user has to define key points along the desired center line, and pair them along the way, in order to create a polygonal chain through the blood vessel.
To define a center line, the user has to define key points along the desired
center line, and pair them along the way, in order to create a polygonal chain
through the blood vessel.

During this process, the user also adjusts the radius of the inscribed sphere for each key point.
During this process, the user also adjusts the radius of the inscribed sphere
for each key point.

When all the center lines keypoints are well defined, the next pipeline module generates the center lines and carries on automatically.
When all the center lines keypoints are well defined, the next pipeline module
generates the center lines and carries on automatically.

== Starting command line

The CEGT is located in `$INSTALL/Modules/Meshing/bin/meshing_centerlinesmanagergui`.
An optional but helping first step is to export all environment variables using the appropriate supplied bash script located at `$INSTALL/bin/setupAngioTKEnvironment.sh.`
The CEGT is located in
`$INSTALL/Modules/Meshing/bin/meshing_centerlinesmanagergui`.
An optional but helping first step is to export all environment variables
using the appropriate supplied bash script located at
`$INSTALL/bin/setupAngioTKEnvironment.sh.`

Here again,`INSTALL` refers to the path where AngioTK was installed (see link:Building.adoc[the building page])
Here again,`INSTALL` refers to the path where AngioTK was installed
(see xref:Building.adoc[the building page])

Simply run this command or put it in your `.bashrc` (which is more convenient for repeated use).
Run the following command or add it to `$HOME/.bashrc`

`source $INSTALL/bin/setupAngioTKEnvironment.sh`
[source, sh]
----
source $INSTALL/bin/setupAngioTKEnvironment.sh
----

Now, the exectutable `meshing_centerlinesmanagergui` can be launched directly.

The arguments to provide are:

- `--input.surface.path` (mandatory) specifies the surface file to work on.
- `--input.point-pair.path` (optional) specifies the point pairs file (typically: previously saved work)
- `--input.point-pair.path` (optional) specifies the point pairs file
(typically: previously saved work)

Thus, the typical command shoud be:
Thus, the typical command reads:

`meshing_centerlinesmanagergui --input.surface.path model.stl --input.point-pair.path pointpair.data`
[source, sh]
----
meshing_centerlinesmanagergui \
--input.surface.path model.stl \
--input.point-pair.path pointpair.data
----

for example, using the provided Phantom example:

`meshing_centerlinesmanagergui --input.surface.path Phantom/angiotk/surfacefromimage/model.stl --input.point-pair.path pointpair.data`
[source, sh]
----
meshing_centerlinesmanagergui \
--input.surface.path Phantom/angiotk/surfacefromimage/model.stl \
--input.point-pair.path pointpair.data
----

IMPORTANT: when no point-pair file is specified, saving your progress will result is creation of two files: `<home>/feel/meshing_centerlinesmanagergui/np_1/<model-name>_pointpair.data`
IMPORTANT: Saving your progress will result in the creation of two files:
`<home>/feel/meshing_centerlinesmanagergui/np_1/<model-name>_pointpair.data`
`<home>/feel/meshing_centerlinesmanagergui/np_1/<model-name>_pointset.data`
*This means that your original file will NOT be modified, unless you manually
replace it!*


== Recommended workflow

At this time (May 2016), center line generation is completely dependent and very sensitive to the provided pointsets.
Therefore, a cautious stepwise workflow is strongly advised, and you should frequently check you progress with the center line generator and ParaView:
At this time (May 2016), center line generation is completely dependent and very
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Center line generation is very sensitive to the provided pointset

sensitive to the provided pointsets.
Therefore, a cautious stepwise workflow is strongly advised, and you should
frequently check you progress with the center line generator and ParaView:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check your progress with the centerline generator and ParaView


- (optional) Prepare 2 different terminals, one for the CEGT, one for the center line generator.
- (optional) Prepare 2 different terminals, one for the CEGT, one for the
center line generator.

=== In the center line editing graphical tool
- Start the GUI in one terminal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that the keys appears first in the item or make a table with 3 columns: key, description and optional/required

- (optional) Press the 'h' key to display help (this should toggle an on-screen list of commands)
- (optional) Press the 'h' key to display help (this should toggle an on-screen
list of commands)
- Use click&drag to rotate the mesh around, identify a blood vessel to work on.
- Press the '2' key to switch to _point insertion mode_
* Click on the mesh near the end of the chosen blood vessel. This should create a sphere which center is the key point.
* Adjust the position and size of the sphere using the following keys: left/right, up/down, o/l and p/m (all of which are also visible in the on-screen help)
* Press 'y' to validate the sphere parameters. To further modify these, simply click back on the sphere and proceed as if it was a newly created one.
* Click on the mesh near the end of the chosen blood vessel.
This should create a sphere which center is the key point.
* Adjust the position and size of the sphere using the following keys:
left/right, up/down, o/l and p/m (all of which are also visible in the
on-screen help)
* Press 'y' to validate the sphere parameters.
To further modify these, simply click back on the sphere and proceed as if
it was a newly created one.
* To connect or disconnect two points, click on both of them and press 'd'.
- After adding/connecting a few points, you should save your work by pressing 's'. This will write two files: a point-pair file a point-set file. Now you can check center line generation.
- After adding/connecting a few points, you should save your work by pressing
's'.
This will write two files: a point-pair file a point-set file.
Now you can check center line generation.

=== In the center line generator

- Launch the center line generator with the relevant options to test your center line definition points:

`meshing_centerlines`

`--input.surface.filename=model.stl`
this is the model used in the CEGT.

==== Command line
Launch the center line generator with the relevant options to test your center
line definition points:

`--input.pointpair.filename=pointpair.data`
use this option to use a point-pair file (recommended), or the next one to use a point-set file.
[source,sh]
----
meshing_centerlines \
--input.surface.filename=model.stl \ <1>
--input.pointpair.filename=pointpair.data \ <2>
--input.pointset.filename=pointset.data \ <3>
--output.directory=<outputpath> \ <4>
----
<1> This is the 3D model used in the CEGT.
<2> Use a point-pair file (recommended),
<3> or a point-set file.
<4> Your desired output path

`--input.pointset.filename=pointset.data`
==== Troubleshooting

`--output.directory=`
your desired output path
Pay attention to the following error, during the `Computing centerlines` step:

- Pay attention to the following errors:
* During the `Computing centerlines `step:
`Warning: In /data/software/src/vmtk/vtkVmtk/ComputationalGeometry/`
`vtkvmtkSteepestDescentLineTracer.cxx, line 240`
`vtkvmtkSteepestDescentLineTracer (0x24ef850): `
`Degenerate descent detected. Target not reached.`
[source,sh]
----
Warning: In /data/software/src/vmtk/vtkVmtk/ComputationalGeometry/
vtkvmtkSteepestDescentLineTracer.cxx, line 240
vtkvmtkSteepestDescentLineTracer (0x24ef850):
Degenerate descent detected. Target not reached.
----

This means the center line is invalid and won't be used.
Try changing the positions of the input points or adding more points in between.
This means the center line is invalid and won't be used.
Try changing the positions of the input points or adding more points in between.


=== In ParaView

- Check your results by opening the produced `model_centerlines.vtk` in ParaView. Go back to the CEGT to edit your points if necessary, or to create new ones.
- Check your results by opening the produced `model_centerlines.vtk` in ParaView.
Go back to the CEGT to edit your points if necessary, or to create new ones.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
= Center lines computing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Computing center lines


We first need to compute each center line using both the extracted surface and the corresponding point pairs (which shoud have been defined in the first place, using link:Module_3_CenterlinesGUITool.adoc[the center lines editing tool])
We first need to compute each center line using both the extracted surface and
the corresponding point pairs (which have been defined using xref:Module_3_CenterlinesGUITool.adoc[the center lines editing tool]).

The executable we use is named `meshing_centerlines`.
The executable we use is named `angiotk_meshing_centerlines`.

== Supported file formats

- input: a 3 model in STereoLithography (.stl) and a text file containing point pairs (pointpair.data) or a gmsh-readable file (.geo or 1D mesh (.msh))
- input: a 3D model in STereoLithography (.stl) and a text file containing point
pairs (pointpair.data) or a gmsh-readable file (.geo or 1D mesh (.msh))
- output: a VTK file (.vtk)

== Parameters
Expand All @@ -15,7 +17,9 @@ The executable we use is named `meshing_centerlines`.
- `--input.pointpair.filename`: (string) Input point pairs text file
- `--output.directory`: (string) Output directory for the VTK file
- `--config-file`: (string) Configuration file
- `--force-rebuild=1`: (int) 0 to avoid computing if target file already exists, 1 to overwrite it
- `--delaunay-tessellation.output.directory`: (string) Output directory for the Delaunay tessellation
- `--delaunay-tessellation.force-rebuild=1`: (int) 0 to avoid computing if target file already exists, 1 to overwrite it

- `--force-rebuild=1`: (int) 0 to avoid computing if target file already exists,
1 to overwrite it
- `--delaunay-tessellation.output.directory`: (string) Output directory for the
Delaunay tessellation
- `--delaunay-tessellation.force-rebuild=1`: (int) 0 to avoid computing if
target file already exists, 1 to overwrite it
31 changes: 21 additions & 10 deletions docs/modules/ROOT/pages/meshing/module-5-centerlines-merging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,34 @@ This is done by `meshing_centerlinesmanager`
== Parameters

- `--input.surface.filename`: (string) Input surface
- `--input.centerlines.filename`: (string) Input center line (add this once for each center line file to merge)
- `--input.centerlines.filename`: (string) Input center line (add this once for
each center line file to merge)
- `--output.directory`: (string) Output directory for the VTK file
- `--config-file`: (string) Configuration file
- `--force-rebuild=1`: (int) 0 to avoid computing if target file already exists, 1 to overwrite it
- `--delaunay-tessellation.output.directory`: (string) Output directory for the Delaunay tessellation
- `--delaunay-tessellation.force-rebuild=1`: (int) 0 to avoid computing if target file already exists, 1 to overwrite it
- `--force-rebuild=1`: (int) 0 to avoid computing if target file already exists,
1 to overwrite it
- `--delaunay-tessellation.output.directory`: (string) Output directory for the
Delaunay tessellation
- `--delaunay-tessellation.force-rebuild=1`: (int) 0 to avoid computing if
target file already exists, 1 to overwrite it
- `remove-branch-ids` (vector of int) Optional, branch IDs to remove
- `--threshold-radius.min=-1`: (double) minimum radius- `--threshold-radius.max=-1`: (double) maximum radius- `--avoid-tubular-colision.apply=0`: (bool) 1 to enable tubular collisions avoidance mechanism, 0 to disable it
- `--avoid-tubular-colision.distance-min=0.4`: (double) minimum distance between tubular branches (to avoid collisions)
- `--avoid-tubular-colision.radius-min=0.4`: (double) minimum radius (to avoid collisions)
- `--smooth-resample.apply=1`: (bool) 1 to enable smoothing resampling, 0 to disable it
- `--threshold-radius.min=-1`: (double) minimum radius
- `--threshold-radius.max=-1`: (double) maximum radius
- `--avoid-tubular-colision.apply=0`: (bool) 1 to enable tubular collisions
avoidance mechanism, 0 to disable it
- `--avoid-tubular-colision.distance-min=0.4`: (double) minimum distance between
tubular branches (to avoid collisions)
- `--avoid-tubular-colision.radius-min=0.4`: (double) minimum radius (to avoid
collisions)
- `--smooth-resample.apply=1`: (bool) 1 to enable smoothing resampling, 0 to
disable it
- `--smooth-resample.geo-points-spacing=4.0`: (double) spacing between points
- `--smooth-resample.mesh-size=1.0`: (double)

== Troubleshooting

Collisions may happen depending on blood vessels radius and proximity.
Adjusting *avoid-tubular-colision.radius-min* and *avoid-tubular-colision.distance-min* should solve the problem.
Adjusting `avoid-tubular-colision.radius-min` and
`avoid-tubular-colision.distance-min` should solve the problem.

link:Meshing_Module_Description.adoc[Go back to The Meshing Module]
xref:Meshing_Module_Description.adoc[Go back to The Meshing Module]
Loading