Reputation: 555
I'm trying to use this dataset here
https://mri.radiology.uiowa.edu/VHDicom/VHMCT1mm/VHMCT1mm_Head.tar.gz
to test out the oro.dicom
package in R.
I try out the code
dcmImages <- readDICOM("C:\\Users\\Host\\Documents\\SCANS\\Head", verbose = TRUE,
recursive = TRUE)
then I try out the extractHeader
function like this
extractHeader(dcmImages$hdr, string="InstitutionName")
and I get a bunch of NA
's. However, I can clearly see when I run this
dcmImages$hdr
I can see in the console that institution name is listed as the National Library of Medicine. What is causing the discrepancy?
Update: Eventually the answer below started working but previously it wasn't and I'm not sure why. I'm on Windows 10 OS and I updated R from 3.5.3 to 3.6 and then it started working but this error that says signed = FALSE' is only valid for integers of sizes 1 and 2'
persists when running the readDICOM
function. However, I now have output from the headers instead of NA
s
Upvotes: 1
Views: 452
Reputation: 30474
Try:
library(oro.dicom)
dcmImages <- readDICOM("/<my path>/Head", verbose = TRUE, recursive = TRUE)
extractHeader(dcmImages$hdr, string="InstitutionName", numeric=FALSE)
(The default for numeric is TRUE, and values are converted to numbers when TRUE.)
R> extractHeader(dcmImages$hdr, string="InstitutionName", numeric=FALSE)
[1] "National Library of Medicine" "National Library of Medicine" "National Library of Medicine"
[4] "National Library of Medicine" "National Library of Medicine" "National Library of Medicine"
[7] "National Library of Medicine" "National Library of Medicine" "National Library of Medicine"
[10] "National Library of Medicine" "National Library of Medicine" "National Library of Medicine"
Upvotes: 1