What could be the reason that the dicom file of this usual x-ray is getting plotted in a messed up manner:
The algorithm used is as follows:
The original image matrix is 3d:
int [1:2014, 1:2014, 1:3] 110 51 99 113 52 101 111 53 102 110 ...
This rgb is converted to gray scale by formula:
gray = 0.3*mat[,,1] + 0.59*mat[,,2] + 0.11*mat[,,3] ;
And then it is plotted after specifying colors as:
grey(0:64/64)
Where could be the error?
I am using oro.dicom package in R with function:
jj = readDICOMFile(fname, endian = "little", flipud = TRUE, DICM = TRUE, skipSequence = FALSE, pixelData = TRUE, warn = -1, debug = FALSE)
and it returns a the matrix jj$img whose structure is:
int [1:2014, 1:2014, 1:3] 110 51....
I then convert it to gray and plot it. If it was rgba, the matrix would have been 2014*2014*4 rather than *3. The header of dicom image mentions "PhotometricInterpretation" as "RGB". The header also mentions rows and columns as 2014 each. Could it be related to bit problem: leadtools.com/sdk/medical/dicom-spec17.htm
Edit: Bits allocated is 8, bits stored is 8 and highBit is 7.
Following is the link of sample dicom image which has similar image matrix and give similar error: http://www.barre.nom.fr/medical/samples/files/US-RGB-8-esopecho.gz
See Question&Answers more detail:
os