NVIDIA / ai-assisted-annotation-client

Client side integration example source code and libraries for AI-Assisted Annotation SDK
Other
307 stars 64 forks source link

Slicer 3D - Auto-segmentation stuffs output #86

Closed danieledsc closed 1 year ago

danieledsc commented 3 years ago

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

YuanTingHsieh commented 3 years ago

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?

danieledsc commented 3 years ago

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

lassoan commented 3 years ago

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.

danieledsc commented 3 years ago

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.

lassoan commented 3 years ago

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)
SachidanandAlle commented 1 year ago

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

diazandr3s commented 1 year ago

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