DCBIA-OrthoLab / Q3DCExtension

Apache License 2.0
4 stars 14 forks source link

Revisit implementation using standard Slicer annotation #35

Open jcfr opened 4 years ago

jcfr commented 4 years ago

Following the initial development of the module started in 2015, a lot changed in Slicer. There are now built-in annotations (lines, angles, plane, ... ) that may be used as building blocks.

Re-using these would reduce maintenance cost by simplifying the implementation.

To support computing the following relative measurements:

Use cases

To more effectively refine the plan outline below, it would be great to describe the measurement use cases.

Some of the use cases a described in https://github.com/DCBIA-OrthoLab/Q3DCExtension/issues/7

To be done

@bpaniagua @luciacev

Suggested approach

The sections below discuss possible approach to simplify the module.

Relative measurements

Midpoint between two fiducials

Few options:https://github.com/DCBIA-OrthoLab/Q3DCExtension/issues/7#issuecomment-155167209

Benefits:

Note: The new json format for markup currently allow to save only one annotation per json file, we should evaluate if support for saving multiple annotation per json is strictly required. (see this previous discussion at https://github.com/Slicer/Slicer/pull/4938#issuecomment-635769034)

Distance between two landmarks

Re-use the build-in line annotation. The R-L, A-P and S-I components associated with the distance would then be easily computed given a line annotation.

For example:

image

Angle between two lines

User would have two options:

image

Distance between line and a point

The logic function would be given a line annotation and a fiducial.

Saving/Loading measurements

Currently them module allows to save/load linePoint.csv, distance.csv or angle.csv. Custom read/write functions are maintained in the module.

Considering Slicer now allows for saving and loading data from csv/text/json as table:

For now, I suggest we revisit the module to leverage the saving/loading of tabular data through the tables modules.

References:

Long term

In the future, we are thinking about creating a "Relative Measurements" module (or similar name) in Slicer allowing to easily define measurement computed based on position of other simple annotation.

At that stage, there is nothing formal but considering this type of features seems to be a common need, I think it is worth having a discussion.

cc: @lassoan

JEHoctor commented 4 years ago

Note that Q3DC does not actually measure the angle between two lines. In fact, it projects two line segments (which do not necessarily intersect) onto the x-y, x-z, and y-z planes, and measures the orientation angles of these projections. I think it doesn't even take the difference.

*This is not based on a vigorous reading of the code.

lassoan commented 4 years ago

Probably we need to add a few more primitives, such as bilinear measurement (ratio, distance, angle between two line segments), ROI (similar to annotation ROI but with built-in rotation; and with box and ellipsoid option). If we have these then we can perform the most common measurement types manually, and can also use these widgets to display custom automatic measurement results.

Since relative measurement results are usually distances, angles, etc., they can be displayed using markups nodes. Markups nodes can already store measurement results. As all other MRML nodes, markups nodes can store references to other nodes. Therefore, markups nodes are well suited to store all inputs and outputs of a relative measurement. We could use independent custom modules to observe markups nodes and update relative measurement results, but I think we know enough already to do better than this. For example, @sunderlandkyl has implemented a relative measurement system before. Based on that experience and using the latest widgets, we should be able to create a flexible, extensible plugin system for this.

Saving/loading measurements: There could be several measurements for a single markup, which could be easily saved into the markups json file. One of the measurements for a markup could be "highlighted", which would be the one that is displayed in the markups module tree, would be displayed in slice/3D views, and this single measurement could be exported to a table node.

Saving/loading markups: Current markups json schema allows export of multiple markups into a single file (e.g., from a Subject hierarchy plugin, by right-clicking on a folder in the Subject hierarchy tree). Import is also easy to implement, in the markups reader plugin. Saving/loading the scene would still always save a single markup per file (it would be very hard to save multiple markups in a single file).

lassoan commented 4 years ago

Probably we should continue this discussion on the Slicer forum to give more visibility and allow others to join.