How to know the order of dcm images

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
audi
Posts: 9
Joined: Mon, 2010-11-08, 20:02

How to know the order of dcm images

#1 Post by audi »

Hi all

I'm new to the world of DICOM. I noticed that the order of the pictures (in order to set a volume), is not by the name index. I would like to load them into memory and order them in correct way so I will have the correct volume memory. How can I know the order ?

Thanks
Audi

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

for sorting slices we do not have any functionality in DCMTK. However, for the general procedure, just search the DICOM newsgroup for slice sortingand the like.

HTH and good luck,
Michael

Mario
Posts: 10
Joined: Fri, 2010-11-05, 07:22

#3 Post by Mario »

Hi,

I had the same problem yesterday: i had to load a volume stored in multiple .dcm files named like slice001-slice002-...-slice407 but, slice number was not bounded to its physical position. I solved sorting them with the DICOM tag DCM_SliceLocation.

If you need more help i can post you some code.

Bye

audi
Posts: 9
Joined: Mon, 2010-11-08, 20:02

#4 Post by audi »

Mario wrote:Hi,
I solved sorting them with the DICOM tag DCM_SliceLocation.
If you need more help i can post you some code.
Bye
Thanks Mario, I will be glad for some code to see as reference
You can send it to audi02@walla.com

audi
Posts: 9
Joined: Mon, 2010-11-08, 20:02

#5 Post by audi »

Mario, I tried to do the follow,

Code: Select all

// get slice position
double	dValue;
VECTOR      vSlicePosition;
if (fileformat.getDataset()->findAndGetFloat64(DCM_SliceLocationVector,dValue,0).good())
{
	vSlicePosition.x  = (float)dValue;
}
if (fileformat.getDataset()->findAndGetFloat64(DCM_SliceLocationVector,dValue,1).good())
{
	vSlicePosition.y  = (float)dValue;
}
if (fileformat.getDataset()->findAndGetFloat64(DCM_SliceLocationVector,dValue,2).good())
{
	vSlicePosition.z  = (float)dValue;
}

But the function findAndGetFloat64 failed and gives nothing.
:(

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

It's easy: SliceLocationVector is of type DS (Decimal String) and findAndGetFloat64() is not applicable to this VR as you can read in the documentation. Btw, the next snapshot (and upcoming) release will contain a getFloat64Vector() method, which is also applicable to Decimal Strings.

With regard to the original question, you should have a look at this.

Mario
Posts: 10
Joined: Fri, 2010-11-05, 07:22

#7 Post by Mario »

Maybe i had a differend problem but I solved using:

Code: Select all

OFString slice_location;
OFCondition status = file_format.getDataset()->findAndGetOFString( DCM_SliceLocation, slice_location );

double double_slice_location = atof( slice_location.c_str() );

I applied that to each .dcm file and then sorted them.

Bye

Per
Posts: 99
Joined: Mon, 2007-09-03, 10:53
Location: Trondheim, Norway
Contact:

#8 Post by Per »

Note that Slice Location is an optional tag (type 3). It will not be present in all DICOM series.

audi
Posts: 9
Joined: Mon, 2010-11-08, 20:02

#9 Post by audi »

Mario wrote:Maybe i had a differend problem but I solved using:

Code: Select all

OFString slice_location;
OFCondition status = file_format.getDataset()->findAndGetOFString( DCM_SliceLocation, slice_location );

double double_slice_location = atof( slice_location.c_str() );

I applied that to each .dcm file and then sorted them.

Bye
Thanks! That worked for me!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest