Dear all,
I want to calculate the pixel data size and compare with the getLength() api of DcmPixelData object.
I am calculating as follows.
TotalPixelDataSize = FrameCount * SamplesPerPixel * rows * Col
TotalLength = getLength() from DcmPixelData element.
Could this getLegth() value equal to TotalPixelDataSize?
OR
How can I calculate the getLength() value from the dicom headers for the pixelDataSize?
Thanks and regards
Angad
How to calculate the pixel data size of dicom image
Moderator: Moderator Team
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Hi,
Thanks for the reply.
The background is that,
I have some dicom files (Corrupted) where pixel data size is not there completely.
So when I try to read them my viewer, it crashes.
I thought that by calculating and comparing this way, I can avoid reading such files if they are not equal.
This worked for some of my corrupted dicom cases, but as you said, there could be many more scenarios where correct dicom file could be treated as corrupted.
BTW, I am using findAndGetxxxArray api and count returned by the getLength() inside the above api ( as I can see in the DCMTK 3.5.4 source code).
Bottom line :
How can I avoid reading corrupted dicom files pixel data?
What is the unit of getLength() ?
Is it bytes or no of pixels it read.
Thanks for the reply.
The background is that,
I have some dicom files (Corrupted) where pixel data size is not there completely.
So when I try to read them my viewer, it crashes.
I thought that by calculating and comparing this way, I can avoid reading such files if they are not equal.
This worked for some of my corrupted dicom cases, but as you said, there could be many more scenarios where correct dicom file could be treated as corrupted.
BTW, I am using findAndGetxxxArray api and count returned by the getLength() inside the above api ( as I can see in the DCMTK 3.5.4 source code).
Bottom line :
How can I avoid reading corrupted dicom files pixel data?
What is the unit of getLength() ?
Is it bytes or no of pixels it read.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
The method getLength() returns the length (in bytes) of the stored value, which might be padded to an even length (according to the requirements of the DICOM standard).
I now understand your use case, and in fact we've implemented something similar in the dcmimgle/dcmimage class library. So, why are you not using the DicomImage class?
I now understand your use case, and in fact we've implemented something similar in the dcmimgle/dcmimage class library. So, why are you not using the DicomImage class?
Who is online
Users browsing this forum: Bing [Bot] and 1 guest