Commit 3f89fb8a authored by Andrei-Claudiu Roibu's avatar Andrei-Claudiu Roibu 🖥
Browse files

added function returning a list of joined files

parent ee7d936a
......@@ -196,7 +196,33 @@ def create_folder(path):
if not os.path.exists(path):
os.mkdir(path)
def load_file_paths(data_directory, targets_directory, data_list):
"""File Loader
This function returns a list of combined file paths for the input data and labelled output data.
Args:
data_directory (str): Path to input data directory
targets_directory (str): Path to labelled data (Y-equivalent)
data_list (str): Path to a .txt file containing the input files for consideration
Returns:
file_paths (list): List containing the input data and target labelled output data
Raises:
None
"""
if data_list:
with open(data_list) as data_list_file:
volumes_to_be_used = data_list_file.read().splitlines()
else:
volumes_to_be_used = [files for files in os.listdir(data_directory)]
# mri/orig.mgz - TODO this needs to be changed in accordance with the actual file names - to be defined later!
file_paths = [[os.path.join(data_directory, volume, 'mri/orig.mgz'), os.join.path(targets_directory, volume, 'label.mgz')] for volume in volumes_to_be_used]
return file_paths
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment