rbumm / SlicerLungCTAnalyzer

This is a 3D Slicer extension for segmentation and spatial reconstruction of infiltrated, collapsed, and emphysematous areas in lung CT.
Apache License 2.0
71 stars 23 forks source link

Lung CT Segmenter fails if marker are placed too fast #14

Closed rbumm closed 3 years ago

rbumm commented 3 years ago

When new lung masks are created from a CT volume and the markers are placed too fast after pressing the "Start" button, the switch from "R-3" to "L-1" marker will sometimes be not made and the program will continue with marker "R-4". This does not happen if you wait approx. 1 s between the marker placements.

rbumm commented 3 years ago

It turns out that this is caused by at least two problems:

      self.logic.updateSegmentation()

is time-consuming and not necessary during placement of initial seeds

      rightLungF = self.logic.rightLungFiducials.GetNumberOfDefinedControlPoints()

can sometimes lag behind, even after

      slicer.app.processEvents()

In these cases, GetNumberOfDefinedControlPoints misses the last set fiducial and returns a number too low.

The last commit improves placement speed, though not yet 100% safe not to place the extra unwanted markers.

lassoan commented 3 years ago

Nice work!

What do you mean by " rightLungF = self.logic.rightLungFiducials.GetNumberOfDefinedControlPoints()" can lag? The number is incremented when the point is placed, not yet when in preview state.

If placing the points is significant effort then we can probably fully automate the process by registering an atlas image (can be simply an average-looking chest image) to the patient image and use the transform to transfer control points that are specified in the atlas image. Or, AIAA segmented could be used, at least to initialize seeds.

rbumm commented 3 years ago

What do you mean by " rightLungF = self.logic.rightLungFiducials.GetNumberOfDefinedControlPoints()" can lag? The number is incremented when the point is placed, not yet when in preview state.

You place a new fiducial normally: everything ok.

You place fiducials faster, lets say three in a row on the left lung in coronal view: Eventually, the process will fail because updateGUIFromParameterNode() gets called on each of the three placements, but during the third call GetNumberOfDefinedControlPoints() (too fast?) still returns the old number (2, not 3), so the switch to "T-1" does not happen, "L-7" is generated instead.
Do you have an idea?

If placing the points is significant effort then we can probably fully automate the process by registering an atlas image (can be simply an average-looking chest image) to the patient image and use the transform to transfer control points that are specified in the atlas image. Or, AIAA segmented could be used, at least to initialize seeds.

Great. I was already thinking about using MONAILabel for that?

rbumm commented 3 years ago

Now acceptable.