dicominfo fails to read in all the information from a dicom file that has private fields but dicomdisp shows the information.
12 views (last 30 days)
Show older comments
There is a field that is displayed using dicomdisp:
0001962 0 (7FE0,0010) OW 2326528 bytes - PixelData
but is dropped when using dicominfo. This appears to due to private tags. I need to obtain the information in that PixalData field, and I certainly use the offset value in the front, to know where the data starts. Is there a means of having the dicomdisp directed to a file instead of being displayed?
Only the first image is displayed by dicom views, and also in Matlab, so I need to load the dicom file in a binary file, then using the dicom information, load in the images into a 3D array, in this particular case, 2 byte - 128x128 frame size and 71 slices. The issue is that I am not guaranteed that PixelData will be the same size for all the different dicom files, therefore I need to be able to read the PixelData field.
Thank you in advance
PF
3 Comments
Rik
on 26 Apr 2023
I don't have time to test myself, but you can try using this FEX submission to read the raw DICOM tags. Perhaps that will help you get the data out.
Answers (1)
Garmit Pant
on 26 Sep 2023
Hello Patrick
I understand that you are trying to read images from a dicom file. The MATLAB function ‘dicominfo’ reads the metadata but when it encounters a private metadata field, the function attempts to read and interpret the data if it can.
You can use the functions from the following File Exchange submission to read all the fields of the metadata of a dicom file:
Use the ‘ReadDicomElementList()’ function to get all the fields of the metadata. Refer to the following code snippet to read and add the field ‘PixelData’ to the structure created using ‘dicominfo’:
info = dicominfo('_Scs_resL_Ti.dicom') % Creates a struct with all the no-private fields
Elements = ReadDicomElementList('_Scs_resL_Ti_1.dicom'); % Reads all the fields of the dicomf file
a = Elements(end) % Access the field ‘PixelData’
info.('PixelData') = a.data % Create a new field ‘PixelData’ in the original struct
This will enable you to use the data in the ‘PixelData’ field.
For further understanding, refer to the following MATLAB Documentation:
- https://www.mathworks.com/help/images/ref/dicominfo.html
- https://www.mathworks.com/help/images/read-metadata-from-dicom-files.html
- https://www.mathworks.com/help/images/ref/dicomread.html
I hope this helps!
Best Regards
Garmit
0 Comments
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!