Segmentation Mask/STL generation/Editing of all phases in a 4D Cardiac MRI dataset

Hi there,

I have used the Segment Registration Module to create a moving mask (whole heart and/or atrium + ventricle) of the 4D Cardiac MRI dataset. I was able to follow most of the discussion from here: Load multiple cardiac phases for segmentation/virtual reality - #2 by lassoan and the video (Create an animated 4D surface model by segmenting a single 3D frame - YouTube)

Ultimately I end up generating a segmented mask that and a transform output that mostly follows to what I want, with some areas that I would like to further tweak and edit.

I had several questions:

#1) What is the best/efficient way of going from here to create STLs for each timepoint (i.e. t1… t30), such that I can open up a moving STL on another software like Paraview?
#2) If there is something off in the transformed segmentation during one of the cardiac phases, what is the best way to edit this?
#3) How do I edit the transformed output?

Can provide more specific details if needed. Thank you!

Somewhat answering my own question, I was able to use the Python code to export the transformed segmentations into .ply from the repository (see below).

I still have questions related to whether I can adjust the warping manually (ideally without resegmenting at that particular phase, as I still want to maintain coordinates across the segementation. thanks!

# Inputs
transformSequenceNode = getNode("OutputTransforms")
segmentationNode = getNode("Segmentation")
segmentIndex = 0
outputFilePrefix = r"c:/tmp/20220312/seg"

# Ensure the segmentation contains closed surface representation
# Create temporary node that will be warped
segmentModelNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLModelNode')

for itemIndex in range(transformSequenceNode.GetNumberOfDataNodes()):
  # Get a copy of the segment that will be transformed
  segment = segmentationNode.GetSegmentation().GetNthSegment(segmentIndex)
  slicer.modules.segmentations.logic().ExportSegmentToRepresentationNode(segment, segmentModelNode)
  # Apply the transform
  transform = transformSequenceNode.GetNthDataNode(itemIndex).GetTransformToParent()
  # Write to file
  outputFileName = f"{outputFilePrefix}_{itemIndex:03}.ply"
  slicer.util.saveNode(segmentModelNode, outputFileName)

# Delete temporary node
1 Like

You can use landmark registration (for example, in Fiducial Registration Wizard module of SlicerIGT extension) to slightly shift/warp certain regions of a data set (segmentation, image, model, …), as shown in this video:

Thanks! The landmark registration appears to warp all the time points in the transform sequence (i.e. I just want to adjust time point 3 - 8, but after applying this it warps everything every after and everything before time point 8). Any way to use landmark registration to only adjust the mesh at several time points and not the rest?

Another potential solution, I sort of was able to improve this address my issue by “concatenating” two separate sequence registrations together - one transform that goes from timepoint 1->8, the other from 8->25, then hardening the transform at time point 8 and export the two of them separately; there is some slight differences between the mesh during the transition and ideally I’d like keep the same mesh for everything (hence my desire to only manually adjust the warping above). Any advice?