Created
August 17, 2017 13:00
-
-
Save kmader/37b026d7ed9498e5d62d24e75f7114b3 to your computer and use it in GitHub Desktop.
Read Dicom Headers in KNIME
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(oro.dicom) | |
knime.in$Location %>% | |
plyr::ldply(function(in_path) { | |
readDICOMFile(as.character(in_path), pixelData = F)$hdr %>% | |
group_by(name) %>% summarize_all(funs(first)) %>% # remove duplicate names | |
select(name, value) %>% spread(name, value) %>% # reformat as a table | |
head(1) | |
} | |
) -> all_header | |
cbind(knime.in, all_header) -> knime.out | |
# knime complains about duplicate columns | |
names(knime.out)<-make.unique(names(knime.out)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment