Readind data from Dicom

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
zeinsalah
Posts: 5
Joined: Mon, 2016-06-27, 12:14

Readind data from Dicom

#1 Post by zeinsalah »

Sorry if this a silly question!

I am wondering if the "loadFile()" function loads the whole data dicom file or just the header. In other words,

does a code like this

OFCondition cond = fileformat.loadFile("filename");
DcmDataset* dataset = fileformat.getDataset();
if (dataset->findAndGetUint16Array(DCM_PixelData, pData).bad())
{

}

return the pixel data of the patient as a block of memory pointed to by pData?
Or I am missing something?

Thanks,
Zein

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Readind data from Dicom

#2 Post by Jan Schlamelcher »

zeinsalah wrote:Sorry if this a silly question!
It most certainly isn't!
zeinsalah wrote:I am wondering if the "loadFile()" function loads the whole data dicom file or just the header. In other words,
No, it typically doesn't, thats what the loadAllDataIntoMemory() function is for ;-).
zeinsalah wrote:does a code like this

OFCondition cond = fileformat.loadFile("filename");
DcmDataset* dataset = fileformat.getDataset();
if (dataset->findAndGetUint16Array(DCM_PixelData, pData).bad())
{

}

return the pixel data of the patient as a block of memory pointed to by pData?
Or I am missing something?
I'm not entirely sure, but I think the findAndGetUint16Array() call will load missing data into memory if it isn't already there, so it should be fine.

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

Re: Readind data from Dicom

#3 Post by J. Riesmeier »

I'm not entirely sure, but I think the findAndGetUint16Array() call will load missing data into memory if it isn't already there, so it should be fine.
Right, it will load the Pixel Data element value field (if not yet done). Other long value fields will not be loaded.

By the way, there's a "maxReadLength" parameter for the DcmFileFormat::readFile() method, which allows for specifying the exact length (in bytes) on what's a "long" (or "short") element value.

Post Reply

Who is online

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