Hive_order_data_folder script#

Order Dataset folder creating and moving the files in the corresponding patient subdirectories Folder structure :

<output_dir>/<patient_id>/<dataset_patient_files>

The suffix used to find the patient IDs is set via the –patient-suffix flag:

Filename -> [patient_ID + patient_suffix]

Example:

–patient-suffix _image.nii.gz PatientA_image.nii.gz -> [patient_ID = PatientA]

If -in-place [yes/no] is set to ‘yes’, –output-folder is not considered and the folder ordering is performed on the input folder

usage: Hive_order_data_folder [-h] -i INPUT_FOLDER -o OUTPUT_FOLDER
                              --patient-suffix PATIENT_SUFFIX
                              [--file-extension FILE_EXTENSION]
                              [--in-place IN_PLACE]
                              [--create-subject-subfolders CREATE_SUBJECT_SUBFOLDERS]
                              [--assign-parent-dir-name ASSIGN_PARENT_DIR_NAME]
                              [-v | -q]

Named Arguments#

-i, --input-folder

Input Dataset folder

-o, --output-folder

Output folder where to save the ordered Dataset

--patient-suffix

Suffix used to find the patient IDs from the filenames

--file-extension

File extension for the files in the dataset. (Default: .nii.gz)

Default: “.nii.gz”

--in-place

if set to “yes”, the output folder matches the input folder

Default: no

--create-subject-subfolders

If set to “yes”, individual subject subfolders are created, with the corresponding files stored. If set to “no”, all the files are directly saved in the main data folder.

Default: yes

--assign-parent-dir-name

If set to “yes”, the parent directory name for all the files will be appended to the filename. To be used whenthe files for the same patient are saved in different folders (“image”, “mask”), with the same name

Default: no

-v, --verbose

Enable verbose output in terminal. Add multiple times to increase verbosity.

-q, --silent

Suppress most log outputs in terminal.

Example call:

Hive_order_data_folder.py -i /path/to/inputfolder -o /path/to/outputfolder --patient-suffix _image.nii.gz
Hive_order_data_folder.py -i /path/to/inputfolder -o /path/to/outputfolder --patient-suffix _image.nii.gz
Hive_order_data_folder.py -i /path/to/inputfolder --patient-suffix _image.nii.gz --in-place yes