|
a |
|
b/RadETL/R/device_OccurrenceTable.R |
|
|
1 |
#' 'device' |
|
|
2 |
#' |
|
|
3 |
#' device function indicates manufacturer of device which took a shoot |
|
|
4 |
#' |
|
|
5 |
#' |
|
|
6 |
#' @param DICOMList you can put it like this and then run the function : DICOMList<-DICOMHeaderList(DICOMFolderPath) |
|
|
7 |
#' @import dplyr |
|
|
8 |
#' @importFrom magrittr "%>%" |
|
|
9 |
#' |
|
|
10 |
#' |
|
|
11 |
#' @return A dataframe indicating manufacturer of device which took a shoot |
|
|
12 |
#' @examples |
|
|
13 |
#' DICOMList<-DICOMHeaderList(DICOMFolderPath) |
|
|
14 |
#' device(DICOMList) |
|
|
15 |
#' @export |
|
|
16 |
|
|
|
17 |
#device |
|
|
18 |
device<-function(DICOMList){ |
|
|
19 |
device<-lapply(DICOMList, function(x){ |
|
|
20 |
device<-as.character(x[[1]] %>% filter(name=='Manufacturer') %>% select(value)) |
|
|
21 |
if(device=="character(0)" | device=="" |device=="integer(0)"){ |
|
|
22 |
device='NA' |
|
|
23 |
} |
|
|
24 |
return(device) |
|
|
25 |
}) |
|
|
26 |
device<-as.data.frame(do.call(rbind, device)) |
|
|
27 |
colnames(device)<-'device' |
|
|
28 |
device<-cbind(device, radiologyOccurrenceId(DICOMList)) |
|
|
29 |
device<-as.data.frame(device %>% group_by(radiologyOccurrenceId) %>% distinct(device)) |
|
|
30 |
device<-split(device, device$radiologyOccurrenceId) |
|
|
31 |
device<-sapply(device, function(x){ |
|
|
32 |
paste0(x$device, collapse=', ')}) |
|
|
33 |
device<-data.frame(radiologyOccurrenceId=names(device), manufacturer=device, row.names = NULL) |
|
|
34 |
return(device) |
|
|
35 |
} |