Skip to content

Commit

Permalink
BUG: Utilize reference geometry in BatchStructureSetConversion
Browse files Browse the repository at this point in the history
The reference geometry was not applied to the segmentation node when performing BatchStructureSetConversion.
Reference volume is now correctly passed by to ConvertStructureSetToLabelmap, and SetReferenceImageGeometryParameterFromVolumeNode is called on the segmentation to ensure that the ClosedSurface->Binary Labelmap conversion is performed using the reference geometry.
  • Loading branch information
Sunderlandkyl committed Aug 18, 2020
1 parent ebc1602 commit c4fe6c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion BatchProcessing/BatchStructureSetConversion.py
Expand Up @@ -98,6 +98,10 @@ def ConvertStructureSetToLabelmap(self, use_ref_image, ref_image_node_id=None):
logging.error('No reference volume found for segmentation ' + segmentationNode.GetName())
continue

# Use reference image for closed surface to binary labelmap conversion
if use_ref_image:
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(referenceVolume)

# Perform conversion
if not segmentationNode.CreateBinaryLabelmapRepresentation():
logging.error('Failed to create binary labelmap representation for segmentation ' + segmentationNode.GetName())
Expand Down Expand Up @@ -310,7 +314,7 @@ def main(argv):
def save_rtslices(output_dir, use_ref_image, ref_image_node_id=None):
# package the saving code into a subfunction
logging.info("Convert loaded structure set to labelmap volumes")
labelmaps = logic.ConvertStructureSetToLabelmap(use_ref_image, ref_image_node_id=None)
labelmaps = logic.ConvertStructureSetToLabelmap(use_ref_image, ref_image_node_id)

logging.info("Save labelmaps to directory " + output_dir)
logic.SaveLabelmaps(labelmaps, output_dir)
Expand Down

0 comments on commit c4fe6c5

Please sign in to comment.