Problem obtaining SpacingBetweenSlices and SliceThickness

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
josedas
Posts: 2
Joined: Fri, 2018-02-23, 14:13

Problem obtaining SpacingBetweenSlices and SliceThickness

#1 Post by josedas »

I am trying to obtain the values named in the subject to calculate the volume of a heart from a set of slices.
I always obtain 0 in both values, and i know it is not correct, because I have opened the dicom secuence using an external tool and I have checked the correct values.

I think the problem is in the type this information is saved.
This is the code I have:

DcmDataset *data=dfile.getDataset();
Uint16 grosor, distancia;
data->findAndGetUint16(DCM_SpacingBetweenSlices, distancia);
data->findAndGetUint16(DCM_SliceThickness, grosor);

Can anybody help me?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Problem obtaining SpacingBetweenSlices and SliceThicknes

#2 Post by J. Riesmeier »

What do the findAndGetUint16() calls return, i.e. what is the status? I don't think that SpacingBetweenSlices and SliceThickness are actually stored as Unsigned Short (US) values, so calling findAndGetUint16() is not appropriate as you can read in the API documentation. However, findAndGetFloat64() should work for Decimal String (DS).

josedas
Posts: 2
Joined: Fri, 2018-02-23, 14:13

Re: Problem obtaining SpacingBetweenSlices and SliceThicknes

#3 Post by josedas »

Thank you, now I've tried to use Float64 as type of the variables and findAndGetFloat64 as function and it works.

The problem is solved, thank you so much.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest