from tciaexplorer import TciaExplorer
import os
import json
import requests
import sys
from zipfile import ZipFile

dicom_path = 'DATA/DOI'

api_key = os.getenv("TCIA_API_KEY")

tcia = TciaExplorer(api_key=api_key) #set api_key

patients = ["CT-Training-LC001", "CT-Training-LC002", "CT-Training-LC003"]
#patients = ["CT-Training-LC001", "CT-Training-LC002", "CT-Training-LC003",
#            "CT-Training-LC008", "CT-Training-LC009", "CT-Training-BE001",
#            "CT-Training-BE002", "CT-Training-BE006", "CT-Training-BE007",
#            "CT-Training-BE010",]

for patient in patients:
    ###################Fetch study###############
    print(patient)
    try:
        patientStudy  = json.loads(tcia.get_patient_study(patientID=patient).text)
    except requests.exceptions.RequestException as e:
        print(e)
        sys.exit(1)

    for study in patientStudy:
        ##########Fetch series#############
        print("Fetching series for the studyInstanceUID: "+ study['StudyInstanceUID'])
Example #2
0
from tciaexplorer import TciaExplorer
import os
import json
import requests
import sys

api_key = os.getenv("TCIA_API_KEY")

tcia = TciaExplorer(api_key=api_key) #set api_key

def processInput(inhash, req):
    key = str(raw_input("Enter the Sno or "+str(req)+": "))
    if key in inhash:
        out = inhash[key]
        return out
    else:
        print("Invalid "+str(req))
        print("Try again")
        processInput(inhash, req)

def buildHash(attribute, data):
    _hash = {}
    print("Sno. \t"+attribute)
    i=1
    for row in data:
        print(str(i) + "\t"+str(row[attribute]))
        _hash[str(i)] = row[attribute]
        _hash[row[attribute]] = row[attribute]
        i+=1
    return _hash
Example #3
0
from tciaexplorer import TciaExplorer
import os
import json
import requests
import sys

tcia = TciaExplorer() 

def processInput(inhash, req):
    key = str(input("Enter the Sno or "+str(req)+": "))
    if key in inhash:
        out = inhash[key]
        return out
    else:
        print("Invalid "+str(req))
        print("Try again")
        processInput(inhash, req)

def buildHash(attribute, data):
    _hash = {}
    print("Sno. \t"+attribute)
    i=1
    for row in data:
        print(str(i) + "\t"+str(row[attribute]))
        _hash[str(i)] = row[attribute]
        _hash[row[attribute]] = row[attribute]
        i+=1
    return _hash

######Fetch collections############
try:
Example #4
0
 def setUp(self):
     self.explorer = TciaExplorer()
Example #5
0
from tciaexplorer import TciaExplorer
import os
import json
import requests
import sys
from zipfile import ZipFile

dicom_path = 'DATA/DOI'

api_key = os.getenv("TCIA_API_KEY")

tcia = TciaExplorer(api_key=api_key)  #set api_key

patients = ["CT-Training-LC001", "CT-Training-LC002", "CT-Training-LC003"]
#patients = ["CT-Training-LC001", "CT-Training-LC002", "CT-Training-LC003",
#            "CT-Training-LC008", "CT-Training-LC009", "CT-Training-BE001",
#            "CT-Training-BE002", "CT-Training-BE006", "CT-Training-BE007",
#            "CT-Training-BE010",]

for patient in patients:
    ###################Fetch study###############
    print(patient)
    try:
        patientStudy = json.loads(
            tcia.get_patient_study(patientID=patient).text)
    except requests.exceptions.RequestException as e:
        print(e)
        sys.exit(1)

    for study in patientStudy:
        ##########Fetch series#############