|
a |
|
b/RadETL/R/personId_ImageTable.R |
|
|
1 |
#' 'personId' |
|
|
2 |
#' |
|
|
3 |
#' personId function will read PatientID metadata of all DICOM files read by DICOMHeaderList function |
|
|
4 |
#' |
|
|
5 |
#' |
|
|
6 |
#' @param DICOMList you can put it like this and then run the function : DICOMList<-DICOMHeaderList(DICOMFolderPath) |
|
|
7 |
#' @import digest |
|
|
8 |
#' @import dplyr |
|
|
9 |
#' @importFrom magrittr "%>%" |
|
|
10 |
#' |
|
|
11 |
#' |
|
|
12 |
#' @return A list containing anonymized PatientID of DICOM |
|
|
13 |
#' @examples |
|
|
14 |
#' DICOMList<-DICOMHeaderList(DICOMFolderPath) |
|
|
15 |
#' personId(DICOMList) |
|
|
16 |
#' @export |
|
|
17 |
|
|
|
18 |
personId<-function(DICOMList){ |
|
|
19 |
personId<-lapply(DICOMList, function(x){ |
|
|
20 |
personId<-as.character(x[[1]] %>% filter(name=='PatientID') %>% select(value)) |
|
|
21 |
if(personId=="character(0)" | personId=="" | personId=="integer(0)"){ |
|
|
22 |
personId='NA' |
|
|
23 |
} |
|
|
24 |
return(personId)}) |
|
|
25 |
personId<-as.data.frame(do.call(rbind, personId)) |
|
|
26 |
colnames(personId)<-'personId' |
|
|
27 |
return(personId) |
|
|
28 |
} |