I want to get these datas to the script for GUI development.
Is there any command to get these datas?
pieper
(Steve Pieper (Isomics, Inc.))
June 11, 2019, 8:57pm
2
Yes - you can access the LabelStatisticsLogic and you can calculate these values. (Note that in newer Slicer we suggest using Segment Statistics, which is similar).
class LabelStatisticsLogic(ScriptedLoadableModuleLogic):
"""Implement the logic to calculate label statistics.
Nodes are passed in as arguments.
Results are stored as 'statistics' instance variable.
Uses ScriptedLoadableModuleLogic base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
def __init__(self, grayscaleNode, labelNode, colorNode=None, nodeBaseName=None, fileName=None):
#import numpy
self.keys = ("Index", "Count", "Volume mm^3", "Volume cc", "Min", "Max", "Mean", "Median", "StdDev")
cubicMMPerVoxel = reduce(lambda x,y: x*y, labelNode.GetSpacing())
ccPerCubicMM = 0.001
# TODO: progress and status updates
# this->InvokeEvent(vtkLabelStatisticsLogic::StartLabelStats, (void*)"start label stats")
self.labelNode = labelNode
self.colorNode = colorNode
This file has been truncated. show original
1 Like