Switch to unified view

a b/RadETL/R/imageId_ImageTable.R
1
#' 'imageId'
2
#'
3
#' imageId function will read SOPInstanceUID 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 SOPInstanceUID of DICOM
13
#' @examples
14
#' DICOMList<-DICOMHeaderList(DICOMFolderPath)
15
#' imageId(DICOMList)
16
#' @export
17
18
19
imageId<-function(DICOMList){
20
    imageId<-lapply(DICOMList, function(x){
21
        imageId<-as.character(x[[1]] %>% dplyr::filter(name=='SOPInstanceUID') %>% dplyr::select(value))
22
        if(imageId=="character(0)" | imageId=="" | imageId=="integer(0)"){
23
            imageId='NA'
24
        }
25
        return(imageId)
26
    })
27
    imageId<-as.data.frame(do.call(rbind, imageId))
28
    colnames(imageId)<-'imageId'
29
    return(imageId)
30
}