# Error: in arrayFromVolume nshape = tuple(reversed(volumeNode.GetImageData().GetDimensions())) AttributeError: 'NoneType' object has no attribute 'GetDimensions'

**URL:** <https://discourse.slicer.org/t/error-in-arrayfromvolume-nshape-tuple-reversed-volumenode-getimagedata-getdimensions-attributeerror-nonetype-object-has-no-attribute-getdimensions/24908>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [August 24, 2022, 2:50pm UTC](https://discourse.slicer.org/t/error-in-arrayfromvolume-nshape-tuple-reversed-volumenode-getimagedata-getdimensions-attributeerror-nonetype-object-has-no-attribute-getdimensions/24908 "2022-08-24T14:50:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leeyrics](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leeyrics/32/16329_2.png) [@leeyrics](https://discourse.slicer.org/u/leeyrics)\
**Post date:** [August 24, 2022, 2:50pm UTC](https://discourse.slicer.org/t/error-in-arrayfromvolume-nshape-tuple-reversed-volumenode-getimagedata-getdimensions-attributeerror-nonetype-object-has-no-attribute-getdimensions/24908/1 "2022-08-24T14:50:16Z")

</div>

Hello everyone and expert

slicer 4.11.20210226

I wanna get the coordinates and HU data from my segment. i wrote a script to use python. but there is a problem. it occurs an Error: _Traceback (most recent call last):_

- File “”, line 1, in \*
- File “D:\3D\Slicer 4.11.20210226\bin\Python\slicer\util.py”, line 1439, in arrayFromVolume\*
- nshape = tuple(reversed(volumeNode.GetImageData().GetDimensions()))\*  
_AttributeError: ‘NoneType’ object has no attribute ‘GetDimensions’_

i found out all the forum and didnt get an answer about it. could u help me? Thanks a lot in advance!

my script:

```auto
segmentationNode =slicer.mrmlScene.GetNodeByID("kortikalis")
masterVolumeNode = slicer.util.getNode("8: Schulter li. 3.0 sag - imageType DERIVED-PRIMARY-AXIAL-CT_SOM5 SPO")

labelmapVolumeNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLLabelMapVolumeNode")

slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode,labelmapVolumeNode,masterVolumeNode)

volumeArray = slicer.util.arrayFromVolume(masterVolumeNode)

labelArray = slicer.util.arrayFromVolume(labelmapVolumeNode)

labelValue = slicer.mrmlScene.GetNodeByID('LabelMapVolume')

segmentVoxels = volumeArray[labelArray==labelValue]

import numpy as np

coordinates = np.where(labelArray==labelValue)

hu = volumeArray[coordinates]

coordinateWithHU = np.zeros([len(coordinates[0]),4])

coordinateWithHU[:,0:3] = np.array(coordinates).T

coordinateWithHU[:,3] = hu

slicer.util.pip_install('pandas')

import pandas as pd

pd.DataFrame(coordinateWithHU).to_csv("c:/tmp/coordshu.csv")

```

😀

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 19, 2022, 7:39am UTC](https://discourse.slicer.org/t/error-in-arrayfromvolume-nshape-tuple-reversed-volumenode-getimagedata-getdimensions-attributeerror-nonetype-object-has-no-attribute-getdimensions/24908/3 "2022-09-19T07:39:11Z")

</div>

The error indicates that the chosen volume is empty (no image data is set). Probably you did not select the correct volume.

Please use the latest Slicer Stable Release. Lots of improvements and fixes have been implemented in the past 1.5 years - maybe one of them will help finding the root cause of the issue more easily.
