I am trying to read and see a dicom file. I installed package 'oro.dicom' and was able to read the file with:
library(oro.dicom)
abdo <- readDICOMFile("image0.dcm")
extractHeader(abdo$hdr, "Rows")
[1] 2014
extractHeader(abdo$hdr, "Columns")
[1] 2014
extractHeader(abdo$hdr, "Manufacturer", numeric=FALSE)
[1] "...IT Radiology"
However, I am not able to see the image:
image(t(abdo$img), col=grey(0:64/64), axes=FALSE, xlab="", ylab="")
Error in t.default(abdo$img) : argument is not a matrix
The structure command shows following:
str(abdo$img)
int [1:2014, 1:2014, 1:3] 110 51 99 113 52 101 111 53 102 110 ...
Following works and a graphic box is displayed but it is only an empty box without any x-ray image:
image(t(abdo$img[[1]]), col=grey(0:64/64), axes=FALSE, xlab="", ylab="")
Why is it not working and how can I correct it? Thanks for your help.
EDIT: with CR-MONO1-10-chest.dcm (http://www.barre.nom.fr/medical/samples/files/CR-MONO1-10-chest.gz) I get following error even while reading it:
abdo <- readDICOMFile("CR-MONO1-10-chest.dcm")
Error in readDICOMFile("CR-MONO1-10-chest.dcm") : DICM != DICM
With rasterImage following is the error:
rasterImage(as.raster(matrix(abdo[[1:3]])))
Error in rasterImage(as.raster(matrix(abdo[[1:3]]))) :
argument "xleft" is missing, with no default
Following is closer but still does not work:
> rasterImage(abdo$img, 100, 400, 150, 450)
Error in rgb(t(x[, , 1]), t(x[, , 2]), t(x[, , 3]), maxColorValue = max) :
color intensity -30, not in [0,1]
> rasterImage(abdo$img, 100, 400, 150, 450, interpolate=F)
Error in rgb(t(x[, , 1]), t(x[, , 2]), t(x[, , 3]), maxColorValue = max) :
color intensity -30, not in [0,1]
>