I tried to get the histogram of the R, A, and S axes of the DVF of the contour thing by modifying the code that you taught me before.
However, I wrote the following code, but an error occurred.
I would like to know if there is any improvement.
labelValue = 1
Loading with imageIOName: GDCMlabelmapVolumeNode =slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLLabelMapVolumeNode”)
volumeNode = getNode(‘Displacement Field’)
labelmapVolumeNode = getNode(‘LabelMapVolume’)
segmentationNode = getNode(‘segmentation’)
segmentId = ‘box’
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, labelmapVolumeNode, volumeNode)
True
volumeArray = slicer.util.arrayFromVolume(volumeNode)
labelArray = slicer.util.arrayFromVolume(labelmapVolumeNode)
import numpy as np
histogram = np.histogram(arrayFromVolume(volumeNode), bins=100)
histogramInSegment = histogram[arrayFromSegmentBinaryLabelmap(segmentationNode, segmentId) != 0]
Traceback (most recent call last):
File “”, line 1, in
TypeError: only integer scalar arrays can be converted to a scalar index
In addition, I have two questions.
(1) What is the unit of the X-axis of DVF?
Is it in mm or cm?
(2) I would also like to know which axes A, S, and R in 3DSlicer represent respectively.