Centroid Voxel/Coordinates Intensity Value Measurement - Is it possible?

I bumped into an issue I can’t seem to find a solution for. I have a large number (>400) of segments for each I want to measure the intensity (essentially the anatomical location off an atlas) from the centroid voxel. I used Segment Statistics to export the Centroid coordinates and I can import those into a fiducial list.

I’m wondering what would be the best way to get the intensity data from the centroids?
A) I could import the coordinates into a fiducial list, but is there a way to get values from the fiducial’s coordinates?
B) Can I shrink the segments to a single central voxel? (this would be the simplest)
C) DO i have to generate 400+ transforms with the coordinates and use a single central voxel to get the data?

Please help!

Solution:

  1. I used LabelmapSegmentStatistics to pull the centroid for each segment in the Segmentation
  2. Then I used the centroid coordinates to generate new spherical segments with a 1mm diameter (or radius?)
  3. These can be used with Segment statistics to query core lesion locations based on anatomical atlases
#  Pull Centroids and generate 1mm spheric lesions in centroid for anatomical assessment 
# Adjust name for "Segmentation" and "Volume" as needed

import numpy as np
import SegmentStatistics
segmentationNode = slicer.util.getNode("Segmentation")
volume_node = slicer.util.getNode("Volume")
segmentation = segmentationNode.GetSegmentation()
segnum = segmentation.GetNumberOfSegments()
for i in range(segnum):
    segment = segmentation.GetNthSegment(i) 
    segmentId = segmentationNode.GetSegmentation().GetSegmentIdBySegment(segment)
    segmentName = segment.GetName()
    segStatLogic = SegmentStatistics.SegmentStatisticsLogic()
    segStatLogic.getParameterNode().SetParameter("Segmentation", segmentationNode.GetID())
    segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.centroid_ras.enabled", str(True))
    segStatLogic.computeStatistics()
    stats = segStatLogic.getStatistics()
    print(segmentName)
    centroid_ras = stats[segmentId,"LabelmapSegmentStatisticsPlugin.centroid_ras"]
    print(centroid_ras)
    tumorCentroid = vtk.vtkSphereSource()
    tumorCentroid.SetCenter(centroid_ras)
    tumorCentroid.SetRadius(1)
    tumorCentroid.Update()
    CentroidSegmentName = segmentName + "-centroid"
    segmentId = segmentationNode.AddSegmentFromClosedSurfaceRepresentation(tumorCentroid.GetOutput(), CentroidSegmentName, [1.0,0.0,0.0])
1 Like