Skip to content

Commit

Permalink
add res types
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzjalen committed Mar 11, 2024
1 parent 58f401b commit 45b41fa
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,31 @@ def plan_experiment(self):
"data_identifier": "3d_fullres_no_resampling"
}

plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp'] = {
plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_highres'] = {
'inherits_from': '3d_fullres_no_resampling',
"spacing": [1.0, 1.0, 1.0],
"data_identifier": "3d_fullres_mosaic_spacing_NoRsmp"
"data_identifier": "3d_fullres_mosaic_spacing_NoRsmp_highres"
}
print('3D fullres Mosaic spacing U-Net configuration:')
print(plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp'])
print('3D fullres Mosaic HighRes spacing U-Net configuration:')
print(plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_highres'])
print()

plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_stdres'] = {
'inherits_from': '3d_fullres_no_resampling',
"spacing": [1.5, 1.5, 1.5],
"data_identifier": "3d_fullres_mosaic_spacing_NoRsmp_stdres"
}
print('3D fullres Mosaic StdRes spacing U-Net configuration:')
print(plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_stdres'])
print()

plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_lowres'] = {
'inherits_from': '3d_fullres_no_resampling',
"spacing": [3.0, 3.0, 3.0],
"data_identifier": "3d_fullres_mosaic_spacing_NoRsmp_lowres"
}
print('3D fullres Mosaic LowRes spacing U-Net configuration:')
print(plans['configurations']['3d_fullres_mosaic_spacing_NoRsmp_lowres'])
print()

plans['configurations']['3d_fullres_mosaic_arch2_NoRsmp'] = {
Expand Down Expand Up @@ -590,7 +608,7 @@ def plan_experiment(self):
print()

plans['configurations']['3d_fullres_mosaic_resenc_NoRsmp'] = {
"inherits_from": "3d_fullres_mosaic_spacing",
"inherits_from": "3d_fullres_mosaic_spacing_NoRsmp",
"UNet_class_name": "ResidualEncoderUNet",
"n_conv_per_stage_encoder": [
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def plan_experiment_entry():
help='[OPTIONAL] Name of the Experiment Planner class that should be used. Default is '
'\'ExperimentPlanner\'. Note: There is no longer a distinction between 2d and 3d planner. '
'It\'s an all in one solution now. Wuch. Such amazing.')
parser.add_argument('-gpu_memory_target', default=22, type=float, required=False,
help='[OPTIONAL] DANGER ZONE! Sets a custom GPU memory target. Default: 22 [GB]. Changing this will '
parser.add_argument('-gpu_memory_target', default=24, type=float, required=False,
help='[OPTIONAL] DANGER ZONE! Sets a custom GPU memory target. Default: 24 [GB]. Changing this will '
'affect patch and batch size and will '
'definitely affect your models performance! Only use this if you really know what you '
'are doing and NEVER use this without running the default nnU-Net first (as a baseline).')
Expand Down Expand Up @@ -131,8 +131,8 @@ def plan_and_preprocess_entry():
help='[OPTIONAL] Name of the Experiment Planner class that should be used. Default is '
'\'ExperimentPlanner\'. Note: There is no longer a distinction between 2d and 3d planner. '
'It\'s an all in one solution now. Wuch. Such amazing.')
parser.add_argument('-gpu_memory_target', default=22, type=int, required=False,
help='[OPTIONAL] DANGER ZONE! Sets a custom GPU memory target. Default: 22 [GB]. Changing this will '
parser.add_argument('-gpu_memory_target', default=24, type=int, required=False,
help='[OPTIONAL] DANGER ZONE! Sets a custom GPU memory target. Default: 24 [GB]. Changing this will '
'affect patch and batch size and will '
'definitely affect your models performance! Only use this if you really know what you '
'are doing and NEVER use this without running the default nnU-Net first (as a baseline).')
Expand Down
2 changes: 1 addition & 1 deletion scripts/del_npy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"import os\n",
"\n",
"dir = \"/media/eolika/49755d50-5426-4672-87cc-2d1a5a3747ad/nnUNet/nnUNet_preprocessed/Dataset101_mosaic_skeleton/3d_fullres_mosaic_resenc_NoRsmp\"\n",
"dir = \"/media/eolika/49755d50-5426-4672-87cc-2d1a5a3747ad/nnUNet/nnUNet_preprocessed/Dataset103_mosaic_cardiovascular/3d_fullres_mosaic_resenc_NoRsmp\"\n",
"files = os.listdir(dir)\n",
"\n",
"for file in files:\n",
Expand Down
94 changes: 28 additions & 66 deletions scripts/generate_json.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,82 +11,44 @@
"from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json\n",
"import os\n",
"\n",
"dataset = \"/media/eolika/49755d50-5426-4672-87cc-2d1a5a3747ad/nnUNet/nnUNet_raw/Dataset101_mosaic_skeleton\"\n",
"dataset = \"/media/eolika/49755d50-5426-4672-87cc-2d1a5a3747ad/nnUNet/nnUNet_raw/Dataset103_mosaic_cardiovascular\"\n",
"\n",
"generate_dataset_json(output_folder=dataset,\n",
" channel_names={0: \"CT\"},\n",
" labels={\n",
" \"background\": 0,\n",
" \"rib_left_1\": 1,\n",
" \"rib_left_2\": 2,\n",
" \"rib_left_3\": 3,\n",
" \"rib_left_4\": 4,\n",
" \"rib_left_5\": 5,\n",
" \"rib_left_6\": 6,\n",
" \"rib_left_7\": 7,\n",
" \"rib_left_8\": 8,\n",
" \"rib_left_9\": 9,\n",
" \"rib_left_10\": 10,\n",
" \"rib_left_11\": 11,\n",
" \"rib_left_12\": 12,\n",
" \"rib_right_1\": 13,\n",
" \"rib_right_2\": 14,\n",
" \"rib_right_3\": 15,\n",
" \"rib_right_4\": 16,\n",
" \"rib_right_5\": 17,\n",
" \"rib_right_6\": 18,\n",
" \"rib_right_7\": 19,\n",
" \"rib_right_8\": 20,\n",
" \"rib_right_9\": 21,\n",
" \"rib_right_10\": 22,\n",
" \"rib_right_11\": 23,\n",
" \"rib_right_12\": 24,\n",
" \"sternum\": 25,\n",
" \"costal_cartilages\": 26,\n",
" \"sacrum\": 27,\n",
" \"vertebrae_L5\": 28,\n",
" \"vertebrae_L4\": 29,\n",
" \"vertebrae_L3\": 30,\n",
" \"vertebrae_L2\": 31,\n",
" \"vertebrae_L1\": 32,\n",
" \"vertebrae_T12\": 33,\n",
" \"vertebrae_T11\": 34,\n",
" \"vertebrae_T10\": 35,\n",
" \"vertebrae_T9\": 36,\n",
" \"vertebrae_T8\": 37,\n",
" \"vertebrae_T7\": 38,\n",
" \"vertebrae_T6\": 39,\n",
" \"vertebrae_T5\": 40,\n",
" \"vertebrae_T4\": 41,\n",
" \"vertebrae_T3\": 42,\n",
" \"vertebrae_T2\": 43,\n",
" \"vertebrae_T1\": 44,\n",
" \"vertebrae_C7\": 45,\n",
" \"vertebrae_C6\": 46,\n",
" \"vertebrae_C5\": 47,\n",
" \"vertebrae_C4\": 48,\n",
" \"vertebrae_C3\": 49,\n",
" \"vertebrae_C2\": 50,\n",
" \"vertebrae_C1\": 51,\n",
" \"humerus_left\": 52,\n",
" \"humerus_right\": 53,\n",
" \"scapula_left\": 54,\n",
" \"scapula_right\": 55,\n",
" \"clavicula_left\": 56,\n",
" \"clavicula_right\": 57,\n",
" \"femur_left\": 58,\n",
" \"femur_right\": 59,\n",
" \"hip_left\": 60,\n",
" \"hip_right\": 61,\n",
" \"skull\": 62,\n",
" \"heart_myocardium\": 1,\n",
" \"heart_atrium_left\": 2,\n",
" \"heart_ventricle_left\": 3,\n",
" \"heart_atrium_right\": 4,\n",
" \"heart_ventricle_right\": 5,\n",
" \"aorta\": 6,\n",
" \"pulmonary_vein\": 7,\n",
" \"pulmonary_artery\": 8,\n",
" \"brachiocephalic_trunk\": 9,\n",
" \"subclavian_artery_right\": 10,\n",
" \"subclavian_artery_left\": 11,\n",
" \"common_carotid_artery_right\": 12,\n",
" \"common_carotid_artery_left\": 13,\n",
" \"brachiocephalic_vein_left\": 14,\n",
" \"brachiocephalic_vein_right\": 15,\n",
" \"superior_vena_cava\": 16,\n",
" \"inferior_vena_cava\": 17,\n",
" \"portal_vein_and_splenic_vein\": 18,\n",
" \"iliac_artery_left\": 19,\n",
" \"iliac_artery_right\": 20,\n",
" \"iliac_vena_left\": 21,\n",
" \"iliac_vena_right\": 22,\n",
" \"liver_vessels\": 23,\n",
" \"lung_vessels\": 24\n",
" },\n",
" num_training_cases=len(os.listdir(f'{dataset}/imagesTr')), \n",
" file_ending='.nii.gz',\n",
" dataset_name=dataset.split('/')[-1], \n",
" reference='none',\n",
" release='2.0.0',\n",
" reference='BlueMind AI Inc',\n",
" release='1.0.0',\n",
" overwrite_image_reader_writer='NibabelIOWithReorient',\n",
" description=\"skeleton\")"
" description=\"cardiovascular\")"
]
},
{
Expand Down

0 comments on commit 45b41fa

Please sign in to comment.