I would like to apply both with the same segment, yes. I can do it manually, using the segmentation editor, but in the code I still can’t replicate the intensity range effect. I will post here the sequence of commands I am currently running (I have only one segmentation):
# Create segment editor to get access to effects
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
segmentEditorNode = slicer.vtkMRMLSegmentEditorNode()
slicer.mrmlScene.AddNode(segmentEditorNode)
segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)
segmentEditorWidget.setSegmentationNode(segmentationNode)
segmentEditorWidget.setMasterVolumeNode(inputVolume)
segmentEditorWidget.setCurrentSegmentID(segmentationNode.GetSegmentation().GetNthSegmentID(0))
# Set up masking parameters
segmentEditorWidget.setActiveEffectByName("Mask volume")
effect = segmentEditorWidget.activeEffect()
segmentEditorNode.SetMaskSegmentID(segmentationNode.GetSegmentation().GetNthSegmentID(0))
segmentEditorNode.SetMasterVolumeIntensityMask(True)
segmentEditorNode.SetMasterVolumeIntensityMaskRange(6900, 7000)
effect.setParameter("Operation", "FILL_OUTSIDE")
effect.setParameter("FillValue", str(inputVolume.GetImageData().GetScalarRange()[0]))
maskedVolume = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode", "Temporary masked volume")
effect.self().outputVolumeSelector.setCurrentNode(maskedVolume)
effect.self().onApply()
The FillValue parameter is working.