From 6e475daafa1fb5c6f2120cc9699f505d65e95336 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Wed, 9 Oct 2024 14:46:14 +0300 Subject: [PATCH 01/18] parallelization ready --- NiChart_DLMUSE/__main__.py | 19 +- NiChart_DLMUSE/utils.py | 43 ++ .../temp_working_dir/s2_dlicv/dataset.json | 11 + .../temp_working_dir/s2_dlicv/plans.json | 434 ++++++++++++++++++ .../s2_dlicv/predict_from_raw_data_args.json | 11 + .../s2_dlicv/renamed_image/renaming.json | 10 + 6 files changed, 527 insertions(+), 1 deletion(-) create mode 100644 output/split_0/temp_working_dir/s2_dlicv/dataset.json create mode 100644 output/split_0/temp_working_dir/s2_dlicv/plans.json create mode 100644 output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json create mode 100644 output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 093b294..3243c01 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -7,8 +7,11 @@ import argparse import os +import multiprocessing +import threading from .dlmuse_pipeline import run_pipeline +from .utils import split_data, remove_subfolders # VERSION = pkg_resources.require("NiChart_DLMUSE")[0].version VERSION = 1.0 @@ -110,8 +113,22 @@ def main() -> None: os.system("DLMUSE --clear_cache") # Run pipeline - run_pipeline(in_data, out_dir, device) + no_threads = 4 # for now + subfolders = split_data(in_data, no_threads) + threads = [] + for i in range(len(subfolders)): + curr_out_dir = out_dir + f"split_{i}" + curr_thread = threading.Thread(target=run_pipeline, args=(subfolders[i], curr_out_dir, device)) + curr_thread.start() + threads.append(curr_thread) + + for t in threads: + t.join() + + remove_subfolders(in_data) + + # run_pipeline(in_data, out_dir, device) if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index be618f4..6c07906 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -126,3 +126,46 @@ def make_img_list(in_data: str) -> pd.DataFrame: # Return out dataframe return df_out + +def dir_size(in_dir: str) -> int: + """ + Returns the number of images the user passed + """ + size = 0 + for path in os.listdir(in_dir): + if os.path.isfile(os.path.join(in_dir, path)): + size += 1 + + return size + + +def split_data(in_dir: str, N: int) -> list: + """ + Splits the input data directory into subfolders of size N + """ + assert(N > 0) + data_size = dir_size(in_dir) + no_files_in_folders = data_size / N if (data_size % N == 0) else (data_size / N) + 1 + assert(no_files_in_folders > 0) + subfolders = [] + + current_folder = 1 + current_file = 0 + os.system(f"mkdir {in_dir}/split_{current_folder}") + for img in os.listdir(in_dir): + if current_file >= no_files_in_folders: + subfolders.append(f"{in_dir}/split_{current_folder}") + current_folder += 1 + os.system(f"mkdir {in_dir}/split_{current_folder}") + current_file = 0 + + file = os.path.join(in_dir, img) + if os.path.isfile(file): + os.system(f"cp {file} {in_dir}/split_{current_folder}") + current_file += 1 + + return subfolders + + +def remove_subfolders(in_dir: str) -> None: + os.system(f"rm -r {in_dir}/split_*") diff --git a/output/split_0/temp_working_dir/s2_dlicv/dataset.json b/output/split_0/temp_working_dir/s2_dlicv/dataset.json new file mode 100644 index 0000000..c39f8d0 --- /dev/null +++ b/output/split_0/temp_working_dir/s2_dlicv/dataset.json @@ -0,0 +1,11 @@ +{ + "channel_names": { + "0": "MRI" + }, + "file_ending": ".nii.gz", + "labels": { + "background": 0, + "class1": 1 + }, + "numTraining": 1806 +} \ No newline at end of file diff --git a/output/split_0/temp_working_dir/s2_dlicv/plans.json b/output/split_0/temp_working_dir/s2_dlicv/plans.json new file mode 100644 index 0000000..0849bf1 --- /dev/null +++ b/output/split_0/temp_working_dir/s2_dlicv/plans.json @@ -0,0 +1,434 @@ +{ + "dataset_name": "Dataset901_Task901_dlicv", + "plans_name": "nnUNetPlans", + "original_median_spacing_after_transp": [ + 1.0, + 1.0, + 1.0 + ], + "original_median_shape_after_transp": [ + 255, + 255, + 176 + ], + "image_reader_writer": "SimpleITKIO", + "transpose_forward": [ + 0, + 1, + 2 + ], + "transpose_backward": [ + 0, + 1, + 2 + ], + "configurations": { + "2d": { + "data_identifier": "nnUNetPlans_2d", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 66, + "patch_size": [ + 256, + 192 + ], + "median_image_size_in_voxels": [ + 240.0, + 179.0 + ], + "spacing": [ + 1.0, + 1.0 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ] + ], + "unet_max_num_features": 512, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": true + }, + "3d_lowres": { + "data_identifier": "nnUNetPlans_3d_lowres", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 2, + "patch_size": [ + 160, + 128, + 112 + ], + "median_image_size_in_voxels": [ + 235, + 226, + 169 + ], + "spacing": [ + 1.0609, + 1.0609, + 1.0609 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5, + 4 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1, + 1 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 1 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ] + ], + "unet_max_num_features": 320, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": false, + "next_stage": "3d_cascade_fullres" + }, + "3d_fullres": { + "data_identifier": "nnUNetPlans_3d_fullres", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 2, + "patch_size": [ + 160, + 128, + 112 + ], + "median_image_size_in_voxels": [ + 249.0, + 240.0, + 179.0 + ], + "spacing": [ + 1.0, + 1.0, + 1.0 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5, + 4 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1, + 1 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 1 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ] + ], + "unet_max_num_features": 320, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": true + }, + "3d_cascade_fullres": { + "inherits_from": "3d_fullres", + "previous_stage": "3d_lowres" + } + }, + "experiment_planner_used": "ExperimentPlanner", + "label_manager": "LabelManager", + "foreground_intensity_properties_per_channel": { + "0": { + "max": 8952.697265625, + "mean": 528.2257080078125, + "median": 317.0, + "min": -24.0, + "percentile_00_5": 20.0, + "percentile_99_5": 3972.0, + "std": 636.9642333984375 + } + } +} \ No newline at end of file diff --git a/output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json b/output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json new file mode 100644 index 0000000..e17a9a9 --- /dev/null +++ b/output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json @@ -0,0 +1,11 @@ +{ + "folder_with_segs_from_prev_stage": null, + "list_of_lists_or_source_folder": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_0/temp_working_dir/s2_dlicv/renamed_image", + "num_parts": 1, + "num_processes_preprocessing": 2, + "num_processes_segmentation_export": 2, + "output_folder_or_list_of_truncated_output_files": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_0/temp_working_dir/s2_dlicv", + "overwrite": true, + "part_id": 0, + "save_probabilities": false +} \ No newline at end of file diff --git a/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json b/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json new file mode 100644 index 0000000..018a8a9 --- /dev/null +++ b/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json @@ -0,0 +1,10 @@ +{ + "IXI114-Guys-0737-T1_LPS.nii.gz": "case_ 000_0000.nii.gz", + "IXI100-Guys-0747-T1_LPS.nii.gz": "case_ 001_0000.nii.gz", + "IXI107-Guys-0761-T1_LPS.nii.gz": "case_ 002_0000.nii.gz", + "IXI101-Guys-0749-T1_LPS.nii.gz": "case_ 003_0000.nii.gz", + "IXI126-HH-1437-T1_LPS.nii.gz": "case_ 004_0000.nii.gz", + "IXI106-Guys-0760-T1_LPS.nii.gz": "case_ 005_0000.nii.gz", + "IXI105-HH-1471-T1_LPS.nii.gz": "case_ 006_0000.nii.gz", + "IXI104-HH-1450-T1_LPS.nii.gz": "case_ 007_0000.nii.gz" +} \ No newline at end of file From 0820179a643c463179e3e881e63edb74cae98fae Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Wed, 9 Oct 2024 14:56:46 +0300 Subject: [PATCH 02/18] Fixed pre-commit --- NiChart_DLMUSE/__main__.py | 10 ++++++---- NiChart_DLMUSE/utils.py | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 3243c01..a92c551 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -7,11 +7,10 @@ import argparse import os -import multiprocessing import threading from .dlmuse_pipeline import run_pipeline -from .utils import split_data, remove_subfolders +from .utils import remove_subfolders, split_data # VERSION = pkg_resources.require("NiChart_DLMUSE")[0].version VERSION = 1.0 @@ -113,13 +112,15 @@ def main() -> None: os.system("DLMUSE --clear_cache") # Run pipeline - no_threads = 4 # for now + no_threads = 4 # for now subfolders = split_data(in_data, no_threads) threads = [] for i in range(len(subfolders)): curr_out_dir = out_dir + f"split_{i}" - curr_thread = threading.Thread(target=run_pipeline, args=(subfolders[i], curr_out_dir, device)) + curr_thread = threading.Thread( + target=run_pipeline, args=(subfolders[i], curr_out_dir, device) + ) curr_thread.start() threads.append(curr_thread) @@ -130,5 +131,6 @@ def main() -> None: # run_pipeline(in_data, out_dir, device) + if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 6c07906..550ffcc 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -127,9 +127,10 @@ def make_img_list(in_data: str) -> pd.DataFrame: # Return out dataframe return df_out + def dir_size(in_dir: str) -> int: """ - Returns the number of images the user passed + Returns the number of images the user passed """ size = 0 for path in os.listdir(in_dir): @@ -141,12 +142,12 @@ def dir_size(in_dir: str) -> int: def split_data(in_dir: str, N: int) -> list: """ - Splits the input data directory into subfolders of size N + Splits the input data directory into subfolders of size N """ - assert(N > 0) + assert N > 0 data_size = dir_size(in_dir) no_files_in_folders = data_size / N if (data_size % N == 0) else (data_size / N) + 1 - assert(no_files_in_folders > 0) + assert no_files_in_folders > 0 subfolders = [] current_folder = 1 From 00a26100f4243cf29449ae611511176b43198d12 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Wed, 9 Oct 2024 23:49:17 +0300 Subject: [PATCH 03/18] Add cores param --- NiChart_DLMUSE/__main__.py | 11 +- .../temp_working_dir/s2_dlicv/dataset.json | 11 + .../temp_working_dir/s2_dlicv/plans.json | 434 ++++++++++++++++++ .../s2_dlicv/predict_from_raw_data_args.json | 11 + .../s2_dlicv/renamed_image/renaming.json | 10 + 5 files changed, 476 insertions(+), 1 deletion(-) create mode 100644 output/split_2/temp_working_dir/s2_dlicv/dataset.json create mode 100644 output/split_2/temp_working_dir/s2_dlicv/plans.json create mode 100644 output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json create mode 100644 output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index a92c551..5c55b06 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -75,6 +75,15 @@ def main() -> None: required=True, ) + parser.add_argument( + "-c", + "--cores", + type=str, + help="Number of cores", + default=4, + required=False, + ) + # VERSION argument help = "Show the version and exit" parser.add_argument( @@ -112,7 +121,7 @@ def main() -> None: os.system("DLMUSE --clear_cache") # Run pipeline - no_threads = 4 # for now + no_threads = args.cores # for now subfolders = split_data(in_data, no_threads) threads = [] diff --git a/output/split_2/temp_working_dir/s2_dlicv/dataset.json b/output/split_2/temp_working_dir/s2_dlicv/dataset.json new file mode 100644 index 0000000..c39f8d0 --- /dev/null +++ b/output/split_2/temp_working_dir/s2_dlicv/dataset.json @@ -0,0 +1,11 @@ +{ + "channel_names": { + "0": "MRI" + }, + "file_ending": ".nii.gz", + "labels": { + "background": 0, + "class1": 1 + }, + "numTraining": 1806 +} \ No newline at end of file diff --git a/output/split_2/temp_working_dir/s2_dlicv/plans.json b/output/split_2/temp_working_dir/s2_dlicv/plans.json new file mode 100644 index 0000000..0849bf1 --- /dev/null +++ b/output/split_2/temp_working_dir/s2_dlicv/plans.json @@ -0,0 +1,434 @@ +{ + "dataset_name": "Dataset901_Task901_dlicv", + "plans_name": "nnUNetPlans", + "original_median_spacing_after_transp": [ + 1.0, + 1.0, + 1.0 + ], + "original_median_shape_after_transp": [ + 255, + 255, + 176 + ], + "image_reader_writer": "SimpleITKIO", + "transpose_forward": [ + 0, + 1, + 2 + ], + "transpose_backward": [ + 0, + 1, + 2 + ], + "configurations": { + "2d": { + "data_identifier": "nnUNetPlans_2d", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 66, + "patch_size": [ + 256, + 192 + ], + "median_image_size_in_voxels": [ + 240.0, + 179.0 + ], + "spacing": [ + 1.0, + 1.0 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ], + [ + 2, + 2 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ], + [ + 3, + 3 + ] + ], + "unet_max_num_features": 512, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": true + }, + "3d_lowres": { + "data_identifier": "nnUNetPlans_3d_lowres", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 2, + "patch_size": [ + 160, + 128, + 112 + ], + "median_image_size_in_voxels": [ + 235, + 226, + 169 + ], + "spacing": [ + 1.0609, + 1.0609, + 1.0609 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5, + 4 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1, + 1 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 1 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ] + ], + "unet_max_num_features": 320, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": false, + "next_stage": "3d_cascade_fullres" + }, + "3d_fullres": { + "data_identifier": "nnUNetPlans_3d_fullres", + "preprocessor_name": "DefaultPreprocessor", + "batch_size": 2, + "patch_size": [ + 160, + 128, + 112 + ], + "median_image_size_in_voxels": [ + 249.0, + 240.0, + 179.0 + ], + "spacing": [ + 1.0, + 1.0, + 1.0 + ], + "normalization_schemes": [ + "ZScoreNormalization" + ], + "use_mask_for_norm": [ + false + ], + "UNet_class_name": "PlainConvUNet", + "UNet_base_num_features": 32, + "n_conv_per_stage_encoder": [ + 2, + 2, + 2, + 2, + 2, + 2 + ], + "n_conv_per_stage_decoder": [ + 2, + 2, + 2, + 2, + 2 + ], + "num_pool_per_axis": [ + 5, + 5, + 4 + ], + "pool_op_kernel_sizes": [ + [ + 1, + 1, + 1 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 2 + ], + [ + 2, + 2, + 1 + ] + ], + "conv_kernel_sizes": [ + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ], + [ + 3, + 3, + 3 + ] + ], + "unet_max_num_features": 320, + "resampling_fn_data": "resample_data_or_seg_to_shape", + "resampling_fn_seg": "resample_data_or_seg_to_shape", + "resampling_fn_data_kwargs": { + "is_seg": false, + "order": 3, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_seg_kwargs": { + "is_seg": true, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "resampling_fn_probabilities": "resample_data_or_seg_to_shape", + "resampling_fn_probabilities_kwargs": { + "is_seg": false, + "order": 1, + "order_z": 0, + "force_separate_z": null + }, + "batch_dice": true + }, + "3d_cascade_fullres": { + "inherits_from": "3d_fullres", + "previous_stage": "3d_lowres" + } + }, + "experiment_planner_used": "ExperimentPlanner", + "label_manager": "LabelManager", + "foreground_intensity_properties_per_channel": { + "0": { + "max": 8952.697265625, + "mean": 528.2257080078125, + "median": 317.0, + "min": -24.0, + "percentile_00_5": 20.0, + "percentile_99_5": 3972.0, + "std": 636.9642333984375 + } + } +} \ No newline at end of file diff --git a/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json b/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json new file mode 100644 index 0000000..4ff49a6 --- /dev/null +++ b/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json @@ -0,0 +1,11 @@ +{ + "folder_with_segs_from_prev_stage": null, + "list_of_lists_or_source_folder": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_2/temp_working_dir/s2_dlicv/renamed_image", + "num_parts": 1, + "num_processes_preprocessing": 2, + "num_processes_segmentation_export": 2, + "output_folder_or_list_of_truncated_output_files": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_2/temp_working_dir/s2_dlicv", + "overwrite": true, + "part_id": 0, + "save_probabilities": false +} \ No newline at end of file diff --git a/output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json b/output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json new file mode 100644 index 0000000..bc0f610 --- /dev/null +++ b/output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json @@ -0,0 +1,10 @@ +{ + "IXI112-Guys-0735-T1_LPS.nii.gz": "case_ 000_0000.nii.gz", + "IXI118-Guys-0764-T1_LPS.nii.gz": "case_ 001_0000.nii.gz", + "IXI115-Guys-0738-T1_LPS.nii.gz": "case_ 002_0000.nii.gz", + "IXI110-Guys-0733-T1_LPS.nii.gz": "case_ 003_0000.nii.gz", + "IXI117-Guys-0763-T1_LPS.nii.gz": "case_ 004_0000.nii.gz", + "IXI121-Guys-0772-T1_LPS.nii.gz": "case_ 005_0000.nii.gz", + "IXI123-Guys-0774-T1_LPS.nii.gz": "case_ 006_0000.nii.gz", + "IXI113-Guys-0776-T1_LPS.nii.gz": "case_ 007_0000.nii.gz" +} \ No newline at end of file From 71b773f0fef72e6aca13b1c64c63e2e1a8d4cab2 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Wed, 9 Oct 2024 23:52:39 +0300 Subject: [PATCH 04/18] Format to fix pre-commit --- NiChart_DLMUSE/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 5c55b06..647e02c 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -121,7 +121,7 @@ def main() -> None: os.system("DLMUSE --clear_cache") # Run pipeline - no_threads = args.cores # for now + no_threads = args.cores # for now subfolders = split_data(in_data, no_threads) threads = [] From a0619a4463d652d773c84859ac4a888a64ff58ed Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:08:09 +0300 Subject: [PATCH 05/18] merge all the subfolders in one --- NiChart_DLMUSE/__main__.py | 6 ++---- NiChart_DLMUSE/utils.py | 22 ++++++++++++++++++++++ dataset.zip | 3 +++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 dataset.zip diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 647e02c..06c1f7e 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -10,7 +10,7 @@ import threading from .dlmuse_pipeline import run_pipeline -from .utils import remove_subfolders, split_data +from .utils import remove_subfolders, split_data, merge_output_data # VERSION = pkg_resources.require("NiChart_DLMUSE")[0].version VERSION = 1.0 @@ -137,9 +137,7 @@ def main() -> None: t.join() remove_subfolders(in_data) - - # run_pipeline(in_data, out_dir, device) - + merge_output_data(out_dir) if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 550ffcc..990821f 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -170,3 +170,25 @@ def split_data(in_dir: str, N: int) -> list: def remove_subfolders(in_dir: str) -> None: os.system(f"rm -r {in_dir}/split_*") + +def merge_output_data(in_dir: str) -> None: + os.system(f"mkdir {in_dir}/results") + os.system(f"mkdir {in_dir}/results/s1_reorient_lps") + os.system(f"mkdir {in_dir}/results/s2_dlicv") + os.system(f"mkdir {in_dir}/results/s3_masked") + os.system(f"mkdir {in_dir}/results/s4_dlmuse") + os.system(f"mkdir {in_dir}/results/s5_relabeled") + os.system(f"mkdir {in_dir}/results/s6_combined") + + for dir in os.listdir(in_dir): + os.system(f"mv {in_dir}/{dir}/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") + os.system(f"mv {in_dir}/{dir}/s2_dlicv/* {in_dir}/results/s2_dlicv/") + os.system(f"mv {in_dir}/{dir}/s3_masked/* {in_dir}/results/s3_masked/") + os.system(f"mv {in_dir}/{dir}/s4_dlmuse/* {in_dir}/results/s4_dlmuse/") + os.system(f"mv {in_dir}/{dir}/s5_relabeled/* {in_dir}/results/s5_relabeled/") + os.system(f"mv {in_dir}/{dir}/s6_combined/* {in_dir}/results/s6_combined/") + + os.system(f"mv {in_dir}/*.nii.gz {in_dir}/results/") + + for dir in os.listdir(in_dir): + os.system(f"rm -r {dir}") diff --git a/dataset.zip b/dataset.zip new file mode 100644 index 0000000..03a8bc9 --- /dev/null +++ b/dataset.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d312983d0dc1ccd437c7edf4390bfbcffd884bc803f201a0fcd2b97318cea718 +size 191469436 From f03f06febc69d0aeb585edfdb141a5a3ad58495f Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:11:15 +0300 Subject: [PATCH 06/18] remove dataset.zip --- dataset.zip | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 dataset.zip diff --git a/dataset.zip b/dataset.zip deleted file mode 100644 index 03a8bc9..0000000 --- a/dataset.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d312983d0dc1ccd437c7edf4390bfbcffd884bc803f201a0fcd2b97318cea718 -size 191469436 From a808ee4cd3823af3d97b381eb75e2faa04ff3296 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:29:36 +0300 Subject: [PATCH 07/18] fixed I/O dir issue --- NiChart_DLMUSE/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 06c1f7e..f340707 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -126,6 +126,12 @@ def main() -> None: threads = [] for i in range(len(subfolders)): + + if out_dir[len(out_dir) - 1] != '/': + # This is because sometimes users don't enter the dir + # like this: "output/" but like this "output" + out_dir += '/' + curr_out_dir = out_dir + f"split_{i}" curr_thread = threading.Thread( target=run_pipeline, args=(subfolders[i], curr_out_dir, device) From 80d9624808a6b9474567e852fe002fc283b968f4 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:39:04 +0300 Subject: [PATCH 08/18] Fix non needed / in merging --- NiChart_DLMUSE/utils.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 990821f..5511369 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -172,23 +172,23 @@ def remove_subfolders(in_dir: str) -> None: os.system(f"rm -r {in_dir}/split_*") def merge_output_data(in_dir: str) -> None: - os.system(f"mkdir {in_dir}/results") - os.system(f"mkdir {in_dir}/results/s1_reorient_lps") - os.system(f"mkdir {in_dir}/results/s2_dlicv") - os.system(f"mkdir {in_dir}/results/s3_masked") - os.system(f"mkdir {in_dir}/results/s4_dlmuse") - os.system(f"mkdir {in_dir}/results/s5_relabeled") - os.system(f"mkdir {in_dir}/results/s6_combined") + os.system(f"mkdir {in_dir}results") + os.system(f"mkdir {in_dir}results/s1_reorient_lps") + os.system(f"mkdir {in_dir}results/s2_dlicv") + os.system(f"mkdir {in_dir}results/s3_masked") + os.system(f"mkdir {in_dir}results/s4_dlmuse") + os.system(f"mkdir {in_dir}results/s5_relabeled") + os.system(f"mkdir {in_dir}results/s6_combined") for dir in os.listdir(in_dir): - os.system(f"mv {in_dir}/{dir}/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") - os.system(f"mv {in_dir}/{dir}/s2_dlicv/* {in_dir}/results/s2_dlicv/") - os.system(f"mv {in_dir}/{dir}/s3_masked/* {in_dir}/results/s3_masked/") - os.system(f"mv {in_dir}/{dir}/s4_dlmuse/* {in_dir}/results/s4_dlmuse/") - os.system(f"mv {in_dir}/{dir}/s5_relabeled/* {in_dir}/results/s5_relabeled/") - os.system(f"mv {in_dir}/{dir}/s6_combined/* {in_dir}/results/s6_combined/") - - os.system(f"mv {in_dir}/*.nii.gz {in_dir}/results/") + os.system(f"mv {in_dir}{dir}/s1_reorient_lps/* {in_dir}results/s1_reorient_lps/") + os.system(f"mv {in_dir}{dir}/s2_dlicv/* {in_dir}results/s2_dlicv/") + os.system(f"mv {in_dir}{dir}/s3_masked/* {in_dir}results/s3_masked/") + os.system(f"mv {in_dir}{dir}/s4_dlmuse/* {in_dir}results/s4_dlmuse/") + os.system(f"mv {in_dir}{dir}/s5_relabeled/* {in_dir}results/s5_relabeled/") + os.system(f"mv {in_dir}{dir}/s6_combined/* {in_dir}results/s6_combined/") + + os.system(f"mv {in_dir}*.nii.gz {in_dir}results/") for dir in os.listdir(in_dir): os.system(f"rm -r {dir}") From b6cdb905246374a3304fcf16a3469bf2630b7a7e Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:56:32 +0300 Subject: [PATCH 09/18] Trying to fix dir problems again --- NiChart_DLMUSE/__main__.py | 30 +- NiChart_DLMUSE/utils.py | 17 +- .../s2_dlicv/dataset.json | 0 .../s2_dlicv/plans.json | 0 .../s2_dlicv/predict_from_raw_data_args.json | 0 .../s2_dlicv/renamed_image/renaming.json | 0 .../temp_working_dir/s2_dlicv/dataset.json | 11 - .../temp_working_dir/s2_dlicv/plans.json | 434 ------------------ .../s2_dlicv/predict_from_raw_data_args.json | 11 - 9 files changed, 20 insertions(+), 483 deletions(-) rename output/{split_0/temp_working_dir => results}/s2_dlicv/dataset.json (100%) rename output/{split_0/temp_working_dir => results}/s2_dlicv/plans.json (100%) rename output/{split_0/temp_working_dir => results}/s2_dlicv/predict_from_raw_data_args.json (100%) rename output/{split_2/temp_working_dir => results}/s2_dlicv/renamed_image/renaming.json (100%) delete mode 100644 output/split_2/temp_working_dir/s2_dlicv/dataset.json delete mode 100644 output/split_2/temp_working_dir/s2_dlicv/plans.json delete mode 100644 output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index f340707..a070ebc 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -124,26 +124,20 @@ def main() -> None: no_threads = args.cores # for now subfolders = split_data(in_data, no_threads) - threads = [] - for i in range(len(subfolders)): + ##threads = [] + ##for i in range(len(subfolders)): + ## curr_out_dir = out_dir + f"split_{i}" + ## curr_thread = threading.Thread( + ## target=run_pipeline, args=(subfolders[i], curr_out_dir, device) + ## ) + ## curr_thread.start() + ## threads.append(curr_thread) + + ##for t in threads: + ## t.join() - if out_dir[len(out_dir) - 1] != '/': - # This is because sometimes users don't enter the dir - # like this: "output/" but like this "output" - out_dir += '/' - - curr_out_dir = out_dir + f"split_{i}" - curr_thread = threading.Thread( - target=run_pipeline, args=(subfolders[i], curr_out_dir, device) - ) - curr_thread.start() - threads.append(curr_thread) - - for t in threads: - t.join() - - remove_subfolders(in_data) merge_output_data(out_dir) + remove_subfolders(in_data) if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 5511369..100a543 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -169,7 +169,7 @@ def split_data(in_dir: str, N: int) -> list: def remove_subfolders(in_dir: str) -> None: - os.system(f"rm -r {in_dir}/split_*") + os.system(f"rm -r {in_dir}split_*") def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}results") @@ -181,14 +181,13 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}results/s6_combined") for dir in os.listdir(in_dir): - os.system(f"mv {in_dir}{dir}/s1_reorient_lps/* {in_dir}results/s1_reorient_lps/") - os.system(f"mv {in_dir}{dir}/s2_dlicv/* {in_dir}results/s2_dlicv/") - os.system(f"mv {in_dir}{dir}/s3_masked/* {in_dir}results/s3_masked/") - os.system(f"mv {in_dir}{dir}/s4_dlmuse/* {in_dir}results/s4_dlmuse/") - os.system(f"mv {in_dir}{dir}/s5_relabeled/* {in_dir}results/s5_relabeled/") - os.system(f"mv {in_dir}{dir}/s6_combined/* {in_dir}results/s6_combined/") - - os.system(f"mv {in_dir}*.nii.gz {in_dir}results/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}results/s1_reorient_lps/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s2_dlicv/* {in_dir}results/s2_dlicv/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s3_masked/* {in_dir}results/s3_masked/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s4_dlmuse/* {in_dir}results/s4_dlmuse/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s5_relabeled/* {in_dir}results/s5_relabeled/") + os.system(f"mv {in_dir}{dir}/temp_working_dir/s6_combined/* {in_dir}results/s6_combined/") + os.system(f"mv {in_dir}*.nii.gz {in_dir}results/") for dir in os.listdir(in_dir): os.system(f"rm -r {dir}") diff --git a/output/split_0/temp_working_dir/s2_dlicv/dataset.json b/output/results/s2_dlicv/dataset.json similarity index 100% rename from output/split_0/temp_working_dir/s2_dlicv/dataset.json rename to output/results/s2_dlicv/dataset.json diff --git a/output/split_0/temp_working_dir/s2_dlicv/plans.json b/output/results/s2_dlicv/plans.json similarity index 100% rename from output/split_0/temp_working_dir/s2_dlicv/plans.json rename to output/results/s2_dlicv/plans.json diff --git a/output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json b/output/results/s2_dlicv/predict_from_raw_data_args.json similarity index 100% rename from output/split_0/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json rename to output/results/s2_dlicv/predict_from_raw_data_args.json diff --git a/output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json b/output/results/s2_dlicv/renamed_image/renaming.json similarity index 100% rename from output/split_2/temp_working_dir/s2_dlicv/renamed_image/renaming.json rename to output/results/s2_dlicv/renamed_image/renaming.json diff --git a/output/split_2/temp_working_dir/s2_dlicv/dataset.json b/output/split_2/temp_working_dir/s2_dlicv/dataset.json deleted file mode 100644 index c39f8d0..0000000 --- a/output/split_2/temp_working_dir/s2_dlicv/dataset.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "channel_names": { - "0": "MRI" - }, - "file_ending": ".nii.gz", - "labels": { - "background": 0, - "class1": 1 - }, - "numTraining": 1806 -} \ No newline at end of file diff --git a/output/split_2/temp_working_dir/s2_dlicv/plans.json b/output/split_2/temp_working_dir/s2_dlicv/plans.json deleted file mode 100644 index 0849bf1..0000000 --- a/output/split_2/temp_working_dir/s2_dlicv/plans.json +++ /dev/null @@ -1,434 +0,0 @@ -{ - "dataset_name": "Dataset901_Task901_dlicv", - "plans_name": "nnUNetPlans", - "original_median_spacing_after_transp": [ - 1.0, - 1.0, - 1.0 - ], - "original_median_shape_after_transp": [ - 255, - 255, - 176 - ], - "image_reader_writer": "SimpleITKIO", - "transpose_forward": [ - 0, - 1, - 2 - ], - "transpose_backward": [ - 0, - 1, - 2 - ], - "configurations": { - "2d": { - "data_identifier": "nnUNetPlans_2d", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 66, - "patch_size": [ - 256, - 192 - ], - "median_image_size_in_voxels": [ - 240.0, - 179.0 - ], - "spacing": [ - 1.0, - 1.0 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ] - ], - "unet_max_num_features": 512, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": true - }, - "3d_lowres": { - "data_identifier": "nnUNetPlans_3d_lowres", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 2, - "patch_size": [ - 160, - 128, - 112 - ], - "median_image_size_in_voxels": [ - 235, - 226, - 169 - ], - "spacing": [ - 1.0609, - 1.0609, - 1.0609 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5, - 4 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1, - 1 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 1 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ] - ], - "unet_max_num_features": 320, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": false, - "next_stage": "3d_cascade_fullres" - }, - "3d_fullres": { - "data_identifier": "nnUNetPlans_3d_fullres", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 2, - "patch_size": [ - 160, - 128, - 112 - ], - "median_image_size_in_voxels": [ - 249.0, - 240.0, - 179.0 - ], - "spacing": [ - 1.0, - 1.0, - 1.0 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5, - 4 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1, - 1 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 1 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ] - ], - "unet_max_num_features": 320, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": true - }, - "3d_cascade_fullres": { - "inherits_from": "3d_fullres", - "previous_stage": "3d_lowres" - } - }, - "experiment_planner_used": "ExperimentPlanner", - "label_manager": "LabelManager", - "foreground_intensity_properties_per_channel": { - "0": { - "max": 8952.697265625, - "mean": 528.2257080078125, - "median": 317.0, - "min": -24.0, - "percentile_00_5": 20.0, - "percentile_99_5": 3972.0, - "std": 636.9642333984375 - } - } -} \ No newline at end of file diff --git a/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json b/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json deleted file mode 100644 index 4ff49a6..0000000 --- a/output/split_2/temp_working_dir/s2_dlicv/predict_from_raw_data_args.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folder_with_segs_from_prev_stage": null, - "list_of_lists_or_source_folder": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_2/temp_working_dir/s2_dlicv/renamed_image", - "num_parts": 1, - "num_processes_preprocessing": 2, - "num_processes_segmentation_export": 2, - "output_folder_or_list_of_truncated_output_files": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_2/temp_working_dir/s2_dlicv", - "overwrite": true, - "part_id": 0, - "save_probabilities": false -} \ No newline at end of file From 73ae387c5c4aed91b6c3bef799d3e40e5e08365a Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 17:59:14 +0300 Subject: [PATCH 10/18] Enable threading again --- NiChart_DLMUSE/__main__.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index a070ebc..8c22107 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -124,17 +124,17 @@ def main() -> None: no_threads = args.cores # for now subfolders = split_data(in_data, no_threads) - ##threads = [] - ##for i in range(len(subfolders)): - ## curr_out_dir = out_dir + f"split_{i}" - ## curr_thread = threading.Thread( - ## target=run_pipeline, args=(subfolders[i], curr_out_dir, device) - ## ) - ## curr_thread.start() - ## threads.append(curr_thread) - - ##for t in threads: - ## t.join() + threads = [] + for i in range(len(subfolders)): + curr_out_dir = out_dir + f"split_{i}" + curr_thread = threading.Thread( + target=run_pipeline, args=(subfolders[i], curr_out_dir, device) + ) + curr_thread.start() + threads.append(curr_thread) + + for t in threads: + t.join() merge_output_data(out_dir) remove_subfolders(in_data) From 5181135a4feb016490c6a48d9d774ef67c5cbf66 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:00:11 +0300 Subject: [PATCH 11/18] Readd / as i think it doesnt mess up anything --- NiChart_DLMUSE/__main__.py | 2 +- NiChart_DLMUSE/utils.py | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 8c22107..963e46e 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -126,7 +126,7 @@ def main() -> None: threads = [] for i in range(len(subfolders)): - curr_out_dir = out_dir + f"split_{i}" + curr_out_dir = out_dir + f"/split_{i}" curr_thread = threading.Thread( target=run_pipeline, args=(subfolders[i], curr_out_dir, device) ) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 100a543..bf87ad5 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -172,22 +172,22 @@ def remove_subfolders(in_dir: str) -> None: os.system(f"rm -r {in_dir}split_*") def merge_output_data(in_dir: str) -> None: - os.system(f"mkdir {in_dir}results") - os.system(f"mkdir {in_dir}results/s1_reorient_lps") - os.system(f"mkdir {in_dir}results/s2_dlicv") - os.system(f"mkdir {in_dir}results/s3_masked") - os.system(f"mkdir {in_dir}results/s4_dlmuse") - os.system(f"mkdir {in_dir}results/s5_relabeled") - os.system(f"mkdir {in_dir}results/s6_combined") + os.system(f"mkdir {in_dir}/results") + os.system(f"mkdir {in_dir}/results/s1_reorient_lps") + os.system(f"mkdir {in_dir}/results/s2_dlicv") + os.system(f"mkdir {in_dir}/results/s3_masked") + os.system(f"mkdir {in_dir}/results/s4_dlmuse") + os.system(f"mkdir {in_dir}/results/s5_relabeled") + os.system(f"mkdir {in_dir}/results/s6_combined") for dir in os.listdir(in_dir): - os.system(f"mv {in_dir}{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}results/s1_reorient_lps/") - os.system(f"mv {in_dir}{dir}/temp_working_dir/s2_dlicv/* {in_dir}results/s2_dlicv/") - os.system(f"mv {in_dir}{dir}/temp_working_dir/s3_masked/* {in_dir}results/s3_masked/") - os.system(f"mv {in_dir}{dir}/temp_working_dir/s4_dlmuse/* {in_dir}results/s4_dlmuse/") - os.system(f"mv {in_dir}{dir}/temp_working_dir/s5_relabeled/* {in_dir}results/s5_relabeled/") - os.system(f"mv {in_dir}{dir}/temp_working_dir/s6_combined/* {in_dir}results/s6_combined/") - os.system(f"mv {in_dir}*.nii.gz {in_dir}results/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s2_dlicv/* {in_dir}/results/s2_dlicv/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s3_masked/* {in_dir}/results/s3_masked/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s4_dlmuse/* {in_dir}/results/s4_dlmuse/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s5_relabeled/* {in_dir}/results/s5_relabeled/") + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s6_combined/* {in_dir}/results/s6_combined/") + os.system(f"mv {in_dir}/*.nii.gz {in_dir}/results/") for dir in os.listdir(in_dir): os.system(f"rm -r {dir}") From e0005317989f86324f1edb26d2c75f8f58101ed6 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:09:00 +0300 Subject: [PATCH 12/18] some debugging again --- NiChart_DLMUSE/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index bf87ad5..0ceca11 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -181,13 +181,16 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}/results/s6_combined") for dir in os.listdir(in_dir): + if(in_dir == 'results/'): + continue + os.system(f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") os.system(f"mv {in_dir}/{dir}/temp_working_dir/s2_dlicv/* {in_dir}/results/s2_dlicv/") os.system(f"mv {in_dir}/{dir}/temp_working_dir/s3_masked/* {in_dir}/results/s3_masked/") os.system(f"mv {in_dir}/{dir}/temp_working_dir/s4_dlmuse/* {in_dir}/results/s4_dlmuse/") os.system(f"mv {in_dir}/{dir}/temp_working_dir/s5_relabeled/* {in_dir}/results/s5_relabeled/") os.system(f"mv {in_dir}/{dir}/temp_working_dir/s6_combined/* {in_dir}/results/s6_combined/") - os.system(f"mv {in_dir}/*.nii.gz {in_dir}/results/") + os.system(f"mv {in_dir}/{dir}/*.nii.gz {in_dir}/results/") for dir in os.listdir(in_dir): os.system(f"rm -r {dir}") From 4996d6425d598829d03d3c01ba28bc6cf69b3e9a Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:09:38 +0300 Subject: [PATCH 13/18] forgot in_dir folder --- NiChart_DLMUSE/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 0ceca11..15a547c 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -193,4 +193,4 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mv {in_dir}/{dir}/*.nii.gz {in_dir}/results/") for dir in os.listdir(in_dir): - os.system(f"rm -r {dir}") + os.system(f"rm -r {in_dir}/{dir}") From 52bdce6f45cd30eedfde70150db8ed55ce72d88b Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:24:23 +0300 Subject: [PATCH 14/18] don't remove everything in the end --- NiChart_DLMUSE/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 15a547c..e623d4f 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -181,7 +181,7 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}/results/s6_combined") for dir in os.listdir(in_dir): - if(in_dir == 'results/'): + if(in_dir == 'results'): continue os.system(f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") @@ -192,5 +192,4 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mv {in_dir}/{dir}/temp_working_dir/s6_combined/* {in_dir}/results/s6_combined/") os.system(f"mv {in_dir}/{dir}/*.nii.gz {in_dir}/results/") - for dir in os.listdir(in_dir): - os.system(f"rm -r {in_dir}/{dir}") + os.system(f"rm -r {in_dir}/split_*") From deba7933a7360b595ec80ab07b16eb33c6f9c6d6 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:33:50 +0300 Subject: [PATCH 15/18] fix small mistake --- NiChart_DLMUSE/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index e623d4f..3cae199 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -181,7 +181,7 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}/results/s6_combined") for dir in os.listdir(in_dir): - if(in_dir == 'results'): + if(dir == 'results'): continue os.system(f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") From e7736071828060936cb309b1aedfaaec1d18cfa8 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 18:42:27 +0300 Subject: [PATCH 16/18] pre-commit pass now --- NiChart_DLMUSE/__main__.py | 3 ++- NiChart_DLMUSE/utils.py | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 963e46e..5cf2b9d 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -10,7 +10,7 @@ import threading from .dlmuse_pipeline import run_pipeline -from .utils import remove_subfolders, split_data, merge_output_data +from .utils import merge_output_data, remove_subfolders, split_data # VERSION = pkg_resources.require("NiChart_DLMUSE")[0].version VERSION = 1.0 @@ -139,5 +139,6 @@ def main() -> None: merge_output_data(out_dir) remove_subfolders(in_data) + if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 3cae199..4637a95 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -171,6 +171,7 @@ def split_data(in_dir: str, N: int) -> list: def remove_subfolders(in_dir: str) -> None: os.system(f"rm -r {in_dir}split_*") + def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}/results") os.system(f"mkdir {in_dir}/results/s1_reorient_lps") @@ -181,15 +182,27 @@ def merge_output_data(in_dir: str) -> None: os.system(f"mkdir {in_dir}/results/s6_combined") for dir in os.listdir(in_dir): - if(dir == 'results'): + if dir == "results": continue - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/") - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s2_dlicv/* {in_dir}/results/s2_dlicv/") - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s3_masked/* {in_dir}/results/s3_masked/") - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s4_dlmuse/* {in_dir}/results/s4_dlmuse/") - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s5_relabeled/* {in_dir}/results/s5_relabeled/") - os.system(f"mv {in_dir}/{dir}/temp_working_dir/s6_combined/* {in_dir}/results/s6_combined/") + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s1_reorient_lps/* {in_dir}/results/s1_reorient_lps/" + ) + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s2_dlicv/* {in_dir}/results/s2_dlicv/" + ) + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s3_masked/* {in_dir}/results/s3_masked/" + ) + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s4_dlmuse/* {in_dir}/results/s4_dlmuse/" + ) + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s5_relabeled/* {in_dir}/results/s5_relabeled/" + ) + os.system( + f"mv {in_dir}/{dir}/temp_working_dir/s6_combined/* {in_dir}/results/s6_combined/" + ) os.system(f"mv {in_dir}/{dir}/*.nii.gz {in_dir}/results/") os.system(f"rm -r {in_dir}/split_*") From bf751d66297bcd0a1b75ec96fd84ddae0ce4b534 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 19:35:11 +0300 Subject: [PATCH 17/18] fixing small mistake(not breaking anything) --- NiChart_DLMUSE/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 4637a95..aed178b 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -169,7 +169,7 @@ def split_data(in_dir: str, N: int) -> list: def remove_subfolders(in_dir: str) -> None: - os.system(f"rm -r {in_dir}split_*") + os.system(f"rm -r {in_dir}/split_*") def merge_output_data(in_dir: str) -> None: From aab59e5b5567ab419924f498a03a63c0337c3dbb Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Fri, 11 Oct 2024 20:11:36 +0300 Subject: [PATCH 18/18] removed local output folder --- output/results/s2_dlicv/dataset.json | 11 - output/results/s2_dlicv/plans.json | 434 ------------------ .../s2_dlicv/predict_from_raw_data_args.json | 11 - .../s2_dlicv/renamed_image/renaming.json | 10 - .../s2_dlicv/renamed_image/renaming.json | 10 - 5 files changed, 476 deletions(-) delete mode 100644 output/results/s2_dlicv/dataset.json delete mode 100644 output/results/s2_dlicv/plans.json delete mode 100644 output/results/s2_dlicv/predict_from_raw_data_args.json delete mode 100644 output/results/s2_dlicv/renamed_image/renaming.json delete mode 100644 output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json diff --git a/output/results/s2_dlicv/dataset.json b/output/results/s2_dlicv/dataset.json deleted file mode 100644 index c39f8d0..0000000 --- a/output/results/s2_dlicv/dataset.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "channel_names": { - "0": "MRI" - }, - "file_ending": ".nii.gz", - "labels": { - "background": 0, - "class1": 1 - }, - "numTraining": 1806 -} \ No newline at end of file diff --git a/output/results/s2_dlicv/plans.json b/output/results/s2_dlicv/plans.json deleted file mode 100644 index 0849bf1..0000000 --- a/output/results/s2_dlicv/plans.json +++ /dev/null @@ -1,434 +0,0 @@ -{ - "dataset_name": "Dataset901_Task901_dlicv", - "plans_name": "nnUNetPlans", - "original_median_spacing_after_transp": [ - 1.0, - 1.0, - 1.0 - ], - "original_median_shape_after_transp": [ - 255, - 255, - 176 - ], - "image_reader_writer": "SimpleITKIO", - "transpose_forward": [ - 0, - 1, - 2 - ], - "transpose_backward": [ - 0, - 1, - 2 - ], - "configurations": { - "2d": { - "data_identifier": "nnUNetPlans_2d", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 66, - "patch_size": [ - 256, - 192 - ], - "median_image_size_in_voxels": [ - 240.0, - 179.0 - ], - "spacing": [ - 1.0, - 1.0 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ], - [ - 3, - 3 - ] - ], - "unet_max_num_features": 512, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": true - }, - "3d_lowres": { - "data_identifier": "nnUNetPlans_3d_lowres", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 2, - "patch_size": [ - 160, - 128, - 112 - ], - "median_image_size_in_voxels": [ - 235, - 226, - 169 - ], - "spacing": [ - 1.0609, - 1.0609, - 1.0609 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5, - 4 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1, - 1 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 1 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ] - ], - "unet_max_num_features": 320, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": false, - "next_stage": "3d_cascade_fullres" - }, - "3d_fullres": { - "data_identifier": "nnUNetPlans_3d_fullres", - "preprocessor_name": "DefaultPreprocessor", - "batch_size": 2, - "patch_size": [ - 160, - 128, - 112 - ], - "median_image_size_in_voxels": [ - 249.0, - 240.0, - 179.0 - ], - "spacing": [ - 1.0, - 1.0, - 1.0 - ], - "normalization_schemes": [ - "ZScoreNormalization" - ], - "use_mask_for_norm": [ - false - ], - "UNet_class_name": "PlainConvUNet", - "UNet_base_num_features": 32, - "n_conv_per_stage_encoder": [ - 2, - 2, - 2, - 2, - 2, - 2 - ], - "n_conv_per_stage_decoder": [ - 2, - 2, - 2, - 2, - 2 - ], - "num_pool_per_axis": [ - 5, - 5, - 4 - ], - "pool_op_kernel_sizes": [ - [ - 1, - 1, - 1 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 2 - ], - [ - 2, - 2, - 1 - ] - ], - "conv_kernel_sizes": [ - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ], - [ - 3, - 3, - 3 - ] - ], - "unet_max_num_features": 320, - "resampling_fn_data": "resample_data_or_seg_to_shape", - "resampling_fn_seg": "resample_data_or_seg_to_shape", - "resampling_fn_data_kwargs": { - "is_seg": false, - "order": 3, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_seg_kwargs": { - "is_seg": true, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "resampling_fn_probabilities": "resample_data_or_seg_to_shape", - "resampling_fn_probabilities_kwargs": { - "is_seg": false, - "order": 1, - "order_z": 0, - "force_separate_z": null - }, - "batch_dice": true - }, - "3d_cascade_fullres": { - "inherits_from": "3d_fullres", - "previous_stage": "3d_lowres" - } - }, - "experiment_planner_used": "ExperimentPlanner", - "label_manager": "LabelManager", - "foreground_intensity_properties_per_channel": { - "0": { - "max": 8952.697265625, - "mean": 528.2257080078125, - "median": 317.0, - "min": -24.0, - "percentile_00_5": 20.0, - "percentile_99_5": 3972.0, - "std": 636.9642333984375 - } - } -} \ No newline at end of file diff --git a/output/results/s2_dlicv/predict_from_raw_data_args.json b/output/results/s2_dlicv/predict_from_raw_data_args.json deleted file mode 100644 index e17a9a9..0000000 --- a/output/results/s2_dlicv/predict_from_raw_data_args.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folder_with_segs_from_prev_stage": null, - "list_of_lists_or_source_folder": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_0/temp_working_dir/s2_dlicv/renamed_image", - "num_parts": 1, - "num_processes_preprocessing": 2, - "num_processes_segmentation_export": 2, - "output_folder_or_list_of_truncated_output_files": "/Users/spirosmag/Documents/NiChart_DLMUSE/output/split_0/temp_working_dir/s2_dlicv", - "overwrite": true, - "part_id": 0, - "save_probabilities": false -} \ No newline at end of file diff --git a/output/results/s2_dlicv/renamed_image/renaming.json b/output/results/s2_dlicv/renamed_image/renaming.json deleted file mode 100644 index bc0f610..0000000 --- a/output/results/s2_dlicv/renamed_image/renaming.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "IXI112-Guys-0735-T1_LPS.nii.gz": "case_ 000_0000.nii.gz", - "IXI118-Guys-0764-T1_LPS.nii.gz": "case_ 001_0000.nii.gz", - "IXI115-Guys-0738-T1_LPS.nii.gz": "case_ 002_0000.nii.gz", - "IXI110-Guys-0733-T1_LPS.nii.gz": "case_ 003_0000.nii.gz", - "IXI117-Guys-0763-T1_LPS.nii.gz": "case_ 004_0000.nii.gz", - "IXI121-Guys-0772-T1_LPS.nii.gz": "case_ 005_0000.nii.gz", - "IXI123-Guys-0774-T1_LPS.nii.gz": "case_ 006_0000.nii.gz", - "IXI113-Guys-0776-T1_LPS.nii.gz": "case_ 007_0000.nii.gz" -} \ No newline at end of file diff --git a/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json b/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json deleted file mode 100644 index 018a8a9..0000000 --- a/output/split_0/temp_working_dir/s2_dlicv/renamed_image/renaming.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "IXI114-Guys-0737-T1_LPS.nii.gz": "case_ 000_0000.nii.gz", - "IXI100-Guys-0747-T1_LPS.nii.gz": "case_ 001_0000.nii.gz", - "IXI107-Guys-0761-T1_LPS.nii.gz": "case_ 002_0000.nii.gz", - "IXI101-Guys-0749-T1_LPS.nii.gz": "case_ 003_0000.nii.gz", - "IXI126-HH-1437-T1_LPS.nii.gz": "case_ 004_0000.nii.gz", - "IXI106-Guys-0760-T1_LPS.nii.gz": "case_ 005_0000.nii.gz", - "IXI105-HH-1471-T1_LPS.nii.gz": "case_ 006_0000.nii.gz", - "IXI104-HH-1450-T1_LPS.nii.gz": "case_ 007_0000.nii.gz" -} \ No newline at end of file