From within R:
From GitHub:
An API key is required to access data from TCIA. To obtain and correctly store your API key:
Request a key from TCIA by following the instructions here.
Create a text file in your home directory (~/
) called .Renviron
.
Create the contents of the .Renviron
file like this, making sure the last line in the file is empty. Otherwise, R will silently fail to load the file.
TCIA_API_KEY=xxx-xxx-xxx-xxx
Restart R. .Renviron
is only processed at the beginning of an R session.
Note: a collection or body part can be specified to narrow down results.
Note: a collection or modality can be specified to narrow down results.
Note: if no collection is passed, patients for all collections are returned.
Note: other ways to narrow down results include
The variables in studies$patient_studies
correspond to the fields of a PatientStudy object as described in the API documentation.
Note: other ways to narrow down results include a collection or a study instance UID.
studies_tcga_brca <- get_studies_in_collection(collection = "TCGA-BRCA")
head(studies_tcga_brca$studies)
Note: a patient ID can be provided to further narrow down results.
im <- save_single_image(series_instance_uid = "1.3.6.1.4.1.14519.5.2.1.3344.4002.298037359751562809791703106256",
sop_instance_uid = "1.3.6.1.4.1.14519.5.2.1.3344.4002.113224119964450170072494597907")
im$out_file
Note: a file name can be provided to override the original file name.
See package documentation for further details: