Trouble getting the real spacing of a DICOM serie using vtkImageData

Operating system: Mac
Slicer version: 4.6.2

Hi everyone !

I’m currently working on my loadable module and I would need to get the real spacing of a DICOM serie using vtkImageData. I explain:

the user loads a DICOM serie (using DICOM module) and selects the corresponding node in my module,
then I do:

vtkMRMLScalarVolumeNode* volumeNode = vtkMRMLScalarVolumeNode::SafeDownCast(d->volumeSelector->currentNode());
vtkImageData* image = volumeNode->GetImageData();
double spacing[3];
image->GetSpacing(spacing);

And I get spacing=[1,1,1]
But, when the DICOM serie is loaded, I can see in the “Volumes” module that the spacing is different (something like [1.5 1.5 4]).

How can I get the real spacing of the DICOM serie in my code (and not [1 1 1] ) ?

Thank you for your help,

Regards,
Sandra.

volumeNode->GetSpacing(spacing);

Unfortunately, VTK cannot store axis directions, therefore IJK to RAS transformation (origin, spacing, axis directions) has to be stored outside vtkImageData, in the volume node. In vtkImageData, origin must be kept at (0,0,0), spacing must be kept at (1,1,1).

“volumeNode->GetSpacing(spacing);” : that will do for what I need, thank you for these information and for your help :slight_smile: