Kindly help me out with adding my model segmentation output to a sequence browser to a specific frame . I have been trying to find a solution for along if any one have a solution let me know
Kindly help me out with adding my model segmentation output to a sequence browser to a specific frame . I have been trying to find a solution for along if any one have a solution let me know
See a complete example how you can segment each frame of a volume sequence and store the segmentation result in a segmentation sequence in TotalSegmentator.
Thanks for responding @lassoan , can you please guide me where exactly i can find, and wanted to know how can we save sequence browser segmentation, As I tested it is saving only one frame mask for DICOM 2D + time, but in NRRD type file I could see it was saving mask for the whole volume
And I want to know how can I get segmentation details for a specific frame in sequence browser (DICOM 2D + time)
segmentationSequenceNode = slicer.util.getNode(‘Sequence_1’)
segmentationNodeForFrame = segmentationSequenceNode.GetNthDataNode(refIndex)
segmentation = segmentationNodeForFrame.GetSegmentation()
segVal = segmentation.GetNumberOfSegments()
segmentId = “Segment_” + str(segVal)
segmentId = segmentationNodeForFrame.GetSegmentation().GetSegmentIdBySegmentName(segmentId)
# Get segment as numpy array
segVal = slicer.util.arrayFromSegmentInternalBinaryLabelmap(segmentationNodeForFrame, segmentId)
This was the code I used to get segmentation for a specific frame in sequence browser, Is this correct way
You need to implement DICOM export of time sequences yourself. It should not be complicated, you just need to export each time point with the appropriate timestamp, with the same series instance UID.
You can look up any DICOM metadata from the DICOM.instanceUIDs
attribute of the volume. See the script repository for a complete example.