Closed snorthman closed 2 years ago
When creating issues please include code snippets to reproduce the problem. I cannot see files on your local /media/
mount.
Excuse me.
client = gcapi.Client(token=args.gc_api)
files = {}
# Loop through files in the specified directory and add their names to the list
for root, directories, filenames in os.walk(args.input):
for direc in directories:
temp = []
for file in os.listdir(os.path.join(root, direc)):
temp.append(os.path.join(root, direc, file))
files[direc] = temp
print("Found", len(files.keys()), "cases for upload")
sessions = []
for i, key in enumerate(files.keys(), 1):
try:
temp_session = client.upload_cases(files=files[key], reader_study=args.slug)
sessions.append(temp_session)
print(files[key])
print("Uploaded session", i, "of", len(files.keys()))
except Exception as e:
print(f"files[key]={files[key]}")
traceback.print_exc()
sys.exit(1)
where
args.input
is /media/pelvis/data/prostate-MRI/rumc/needle
args.gc_api
is a valid API from grandchallenge
args.slug
is needle-segmentation-for-interventional-radiology
(a reader study)
Again, I cannot access things on your /media/
mount. Please provide a code snippet that I can run that reproduces this problem as I cannot.
import gcapi
import os, sys, argparse, traceback
file = os.path.abspath("path/to/file.mha")
gc_api = "api"
client = gcapi.Client(token=gc_api)
client.upload_cases(files=[file], reader_study="needle-segmentation-for-interventional-radiology")
It also breaks with arbitrary files, such as a .txt, so to reproduce a .mha file is not necessary.
+1, I just ran into the same problem following the tutorial.
Replace os.path.abspath
with pathlib.Path
.
Description
Following the tutorial on the grand challenge website trying to upload my hoard of .mha files, I get the following error
What I Did
Using ravpn.radboudumc.nl
See /media/pelvis/projects/stan/grandchallenge.py for my code