Project-MONAI / Project-MONAI/MONAILabel

Use existing segmentation as segmentNode

Open
#1,477 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
891
Forks
269
Avg merge
15h 41m
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.
If you have a volume node and a segmentation node already available in slicer and you go to the MONAILabel module, the existing volume node gets recognized and used as master volume, but a new segmentation node is always created.
Due to this it is not possible to start annotating a segment, close slicer and continue later on with the same segmentation or to get a quality check by a second annotator who can then submit the label.

A possible workaround is now to drag the existing segment in the new segmentation node and remove the new empty segment, but it would be nice to be able to just save everything to an .mrb and continue later.

Describe the solution you'd like
This issue can be fixed by a small update in MONAILabelWidget.createSegmentNode() that checks if a segmentation node with the correct name is already available.

def createSegmentNode(self):
      if self._volumeNode is None:
          return
      if self._segmentNode is None:
          name = "segmentation_" + self._volumeNode.GetName()
          if slicer.util.getFirstNodeByName(name):
             self._segmentNode = slicer.util.getFirstNodeByName(name)
          else:
             self._segmentNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
          self._segmentNode.SetReferenceImageGeometryParameterFromVolumeNode(self._volumeNode)
          self._segmentNode.SetName(name)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MONAILabelWidget.createSegmentNode(), the entry point named in the issue. Check the existing segmentation node lookup and verify that an available node with the expected name is reused while a missing node is still created; confirm that annotation can be saved and reopened with the same segmentation node.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.