ai-assisted-annotation-client icon indicating copy to clipboard operation
ai-assisted-annotation-client copied to clipboard

Slicer 3D - Auto-segmentation stuffs output

Open danieledsc opened this issue 4 years ago • 5 comments

Is it possible to receive a float32 volume instead of a segmentation mask as the output of an auto-segmentation custom model?

danieledsc avatar Apr 15 '21 13:04 danieledsc

I am not sure if I get your question.

Essentially, you want to get a "2D/3D numpy array" in float32 format, instead of a NIFTI file for the segmentation mask?

YuanTingHsieh avatar May 05 '21 18:05 YuanTingHsieh

Yes, yes I would like to receive an object of type vtkMRMLScalarVolumeNode instead of vtkMRMLSegmentationNode, Thanks

danieledsc avatar Jun 07 '21 14:06 danieledsc

How do you plan to use this float volume? As a fractional segmentation (increased bit depth is for smoother boundary) or a probability map (values specify a continuous color overlay)?

You can store fractional labelmap (8-bit signed value for each segment) in a segmentation node, so you can still keep using segmentation nodes (and have nice 2D/3D visualization and other useful segmentation features). If getting a fractional volume from the client is implemented then I can help with hooking that up with the segmentation.

If the result is a probability map then it is essentially image filtering and so Segment Editor may not be the best place to launch it from.

lassoan avatar Jun 07 '21 21:06 lassoan

I would like to create a fractional segmentation based on the probability map. I could make a CURL call directly to the AIAA server, retrieve the vtkMRMLScalarVolumeNode and pass it to the segmentation editor using the code . However, selecting the output type directly from the segmentation tool may be useful.

danieledsc avatar Jun 08 '21 07:06 danieledsc

You can edit the Slicer plugin (it is just a Python script) to create fractional labelmap from the received volume node. Something like this should work:

fractionalLabelmap = ... # vtkOrientedImageData retrieved from vtkMRMLScalarVolumeNode
segmentationNode = ...
newSegment = slicer.vtkSegment()
newSegment.SetName("mysegment")
newSegment.SetColor(1,0,0)
newSegment.AddRepresentation(slicer.vtkSegmentationConverter.GetSegmentationFractionalLabelmapRepresentationName(), fractionalLabelmap)
segmentationNode.GetSegmentation().AddSegment(newSegment)

lassoan avatar Jun 24 '21 02:06 lassoan

Closing this issue. Please use MONAILabel instead... feel free to raise any issue or start discussion over MONAILabel repo

SachidanandAlle avatar Nov 02 '22 05:11 SachidanandAlle

MONAI Label repo: https://github.com/Project-MONAI/MONAILabel

diazandr3s avatar Nov 03 '22 10:11 diazandr3s