how to remove all frames from dicom

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
George
Posts: 32
Joined: Sun, 2023-11-12, 16:50

how to remove all frames from dicom

#1 Post by George »

Hello,

it would be nice to provide a humble piece of code that remove all frames from dicom

Best Regards
George

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

Re: how to remove all frames from dicom

#2 Post by J. Riesmeier »

Unfortunately, your question is not clear. Do you want to remove the Pixel Data element or to set its length to 0 (i.e. clear its value)? What would be the value of Rows and Columns then? What about other data elements that refer to the image frames (pixel data)?

In both cases, this would make the DICOM image invalid. If this would be ok for you, some more background information would also be helpful.

George
Posts: 32
Joined: Sun, 2023-11-12, 16:50

Re: how to remove all frames from dicom

#3 Post by George »

Hello,

I have a dicom image with size 1.2GB, I only want to use its header ( meaning to use the tags in dicom header ) so I want to narrow its size as much as possible by remove all its unwanted metadata.
meaning I wish to have only the dicom header which size is 255KB instead of the whole thing, I tried to set the number of frames to zero and pixel data to null but it did not work
What should I do?

https://forum.dcmtk.org/viewtopic.php?t=4719

Best Regards
George

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

Re: how to remove all frames from dicom

#4 Post by J. Riesmeier »

If there is no requirement that the result would still be a valid DICOM dataset/file, you could remove the Pixel Data (7fe0,0010) element by calling something like this on the main DICOM dataset:

Code: Select all

dataset->findAndDeleteElement(DCM_PixelData);
However, unless you access the Pixel Data element (7fe0,0010) somewhere in your code, DCMTK will not load large element values (like this) when calling DcmFileFormat::loadFle() (see parameter "maxReadLength").

Post Reply

Who is online

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