我正尝试在此处使用此数据集
https://mri.radiology.uiowa.edu/VHDicom/VHMCT1mm/VHMCT1mm_Head.tar.gz
测试R中的oro.dicom
软件包。
我尝试代码
dcmImages <- readDICOM("C:\\Users\\Host\\Documents\\SCANS\\Head", verbose = TRUE,
recursive = TRUE)
然后我尝试使用extractHeader
这样的功能
extractHeader(dcmImages$hdr, string="InstitutionName")
,我得到了一堆NA
。但是,我可以清楚地看到何时运行此
dcmImages$hdr
我可以在控制台中看到机构名称被列为国家医学图书馆。是什么原因导致差异?
更新:最终,下面的答案开始起作用,但以前却没有,我不确定为什么。我在Windows 10操作系统上,我将R从3.5.3更新到3.6,然后它开始工作,但是运行signed = FALSE' is only valid for integers of sizes 1 and 2'
函数时,此错误表示readDICOM
仍然存在。但是,我现在从标题而不是NA
s
答案 0 :(得分:1)
尝试:
library(oro.dicom)
dcmImages <- readDICOM("/<my path>/Head", verbose = TRUE, recursive = TRUE)
extractHeader(dcmImages$hdr, string="InstitutionName", numeric=FALSE)
(数字的默认值为TRUE,当值为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"