Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #198

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Task_1/fets_challenge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Instructions for challenge organizer (Participants, ignore this)

During testing phase:
- first generate a csv file for the testing set per the "create_test_csv.py" script
- use "generate_predictions.py" to run inference using the generated csv (final_test.csv)
26 changes: 26 additions & 0 deletions Task_1/fets_challenge/create_test_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import csv

# This script generates a CSV file named 'final_test.csv' in the current directory.
# The CSV file has two columns: 'Partition_ID' and 'Subject_ID'.
# 'Partition_ID' is set to -1 for all rows.
# 'Subject_ID' is populated with the names of folders in the specified directory.
# This is intended to replicate the format of 'validation.csv' in the FeTS Challenge repository.
# The generated CSV file can be used to list all test samples in your data path.

# Specify the directory containing the test data folders
data_dir = "/home/locolinux2/datasets/RSNA_ASNR_MICCAI_BraTS2021_TestingData"

dir_list = [d for d in os.listdir(data_dir) if os.path.isdir(os.path.join(data_dir, d))]

output_csv = '/home/locolinux2/.local/workspace/final_test.csv'
Comment on lines +12 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to make these as parameters and have that as input, otherwise it will break for anyone not having this exact directory/file-system structure.


# Write the CSV file
with open(output_csv, mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['Partition_ID', 'Subject_ID'])

for directory in dir_list:
writer.writerow(['-1', directory])

print(f'CSV file "{output_csv}" has been created with the folder names.')