findAndGetUint8Array read of DCM_EncryptedContent

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jdinca
Posts: 13
Joined: Thu, 2012-10-25, 07:18

findAndGetUint8Array read of DCM_EncryptedContent

#1 Post by jdinca »

Hi,

I've been looking to store data in different DCM tags and am currently looking at using DCM_EncryptedContent to store indeed store encrypted information as a unsigned char array:
status = dataset->putAndInsertUint8Array(DCM_EncryptedContent, data, num_bytes);

I can write this data just fine (using the above), and to test I can also read it in Matlab:
info = dicominfo(dcmfile); % info.EncryptedContent then contains the data I wrote.

But, adding the following read to my DCM load routine using DCMTK (3.6.0) causes an exception in the DcmElement destructor when the DcmFileFormat goes out of scope:
if (fileformat.getDataset()->findAndGetUint8Array(DCM_EncryptedContent, data, &length).good())

The status of the read is good, and I know the file is fine (based on the Matlab read). Just commenting out the above causes the DICOM file to load fine using DCMTK, so this really isolates the issue.

When the DcmFileFormat goes out of scope is deletes all DCMElement via deleteAllElements. The exception is when it tries to delete fLoadValue (which is NULL) in: DcmElement::~DcmElement()

In looking for any known issues that could point to a 3.6.0 bug, I could not find anything. If anyone has any thoughts as to what is going on, or where I have gone wrong, I would appreciate it. I am wondering also if I should upgrade to a more recent version. Thanks,

Jonathan.

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

Re: findAndGetUint8Array read of DCM_EncryptedContent

#2 Post by J. Riesmeier »

Deleting a NULL pointer should be OK (does nothing). Maybe, you delete the "data" pointer which refers to the internally stored element value, i.e. when you retrieved the pointer with findAndGetUint8Array()?
I am wondering also if I should upgrade to a more recent version.
You should definitely upgrade since DCMTK 3.6.0 is more than 8 years old.

jdinca
Posts: 13
Joined: Thu, 2012-10-25, 07:18

Re: findAndGetUint8Array read of DCM_EncryptedContent

#3 Post by jdinca »

You are right, sorry, I stepped through all deletions and see that the exception arises because I do delete the data pointer referencing the internally stored element value.

Thanks for catching that!

Yes, 3.6.0 is old, but it's really good! But I do indeed see multiple reasons to upgrade, too.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest