findAndGetUint64(...) Not working as expected

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
samee
Posts: 17
Joined: Thu, 2023-03-30, 15:27

findAndGetUint64(...) Not working as expected

#1 Post by samee »

Hi there,
I am working with a WSI Dicom image and I am trying to extract "Total Pixel Matrix Columns " tag's value. If I read the metadata and output it, I can see that this tag exists in the file.

Code: Select all

(0048, 0001) Imaged Volume Width                 FL: 9.72800064086914
(0048, 0002) Imaged Volume Height                FL: 18.944000244140625
(0048, 0003) Imaged Volume Depth                 FL: 9.999999747378752e-05
(0048, 0006) Total Pixel Matrix Columns          UL: 38912
(0048, 0007) Total Pixel Matrix Rows             UL: 75776
However, if I use the following piece of code, I get an error "Illegal call, perhaps wrong parameters".

Code: Select all

    auto dcm_ff = DcmFileFormat();
    dcm_ff.loadFile("/mnt/hdd8/axle/data/1.3.46.670589.45.1.1.13461215855660.1.2548.1506597645355.5.dcm");
    auto dcm_tag_key = DcmTagKey(0x0048,0x0007) ;
    std::cout << dcm_tag_key.toString() << std::endl; 
    unsigned long int height;
    auto tmp = dcm_ff.getDataset()->findAndGetUint64(dcm_tag_key, height);
    std::cout << "code = " << tmp.text() << std::endl;
    std::cout<< "height = " << height << std::endl; 
I can read the tags for US, FL, IS types using appropriate findAndGet* version of the function. However, it seems to me that only findAndGetUint64 has an issue. I am using version 3.6.7. I can provide the image file also if the devs want to take a look.

Thanks!

samee
Posts: 17
Joined: Thu, 2023-03-30, 15:27

Re: findAndGetUint64(...) Not working as expected

#2 Post by samee »

Actually, I have found the issue. The UL type maps to "unsigned int" not "unsigned long". The following code works.

Code: Select all

    unsigned int height;
    auto tmp = dcm_ff.getDataset()->findAndGetUint32(dcm_tag_key, height);

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

Re: findAndGetUint64(...) Not working as expected

#3 Post by J. Riesmeier »

UL is defined as a 32-bit unsigned integer, if this was the question. See DICOM part 5 for details.
Also the API documentation lists the VRs for which a particular findAndGetXXX() method is applicable.

By the way, I wonder why you define your own DcmTagKey and do not use the pre-defined constants, e.g. DCM_TotalPixelMatrixRows.

Post Reply

Who is online

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