further simplifying the API
"metadata": {},
"outputs": [],
"source": [
- "import pathlib\n",
- "import random"
+ "import pathlib"
]
},
{
"# organised by 'training', 'validation', and 'testing' in here:\n",
"data_path_root = pathlib.Path.home().joinpath('.data/dicom-ct-and-structures')\n",
"\n",
+ "# Of note, the DICOM file directory structure need not have any further\n",
+ "# organisation beyond being placed somewhere within one of the three\n",
+ "# 'training', 'validation', or 'testing'. They can be organised into\n",
+ "# directories by patient but that is not a requirement."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# The following names_map is used to standardise the structure names\n",
"names_map = filtering.load_names_mapping('name_mappings.json')"
]
},
"structures_to_learn = [\n",
" 'lens_left', 'lens_right', 'eye_left', 'eye_right', 'patient']\n",
"\n",
- "# Only use a study set if all of the following are defined on that study set\n",
- "study_set_must_have_all_of = structures_to_learn\n",
- "\n",
- "# Only use a slice if one of the following contours exists on it\n",
- "slice_at_least_one_of = [\n",
- " 'lens_left', 'lens_right', 'eye_left', 'eye_right']\n",
- "slice_must_have = ['patient']\n",
- "slice_cannot_have = []\n",
- "\n",
+ "# Use the following to filter the slices used for training, validation, and testing\n",
"filters = {\n",
- " \"study_set_must_have_all_of\": study_set_must_have_all_of,\n",
- " \"slice_at_least_one_of\": slice_at_least_one_of,\n",
- " \"slice_must_have\": slice_must_have,\n",
- " \"slice_cannot_have\": slice_cannot_have\n",
+ " \"study_set_must_have_all_of\": structures_to_learn,\n",
+ " \"slice_at_least_one_of\": ['lens_left', 'lens_right', 'eye_left', 'eye_right'],\n",
+ " \"slice_must_have\": ['patient'],\n",
+ " \"slice_cannot_have\": []\n",
"}"
]
},
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "for ct_uid, x_grid, y_grid, input_array, output_array in datasets['training'].take(15):\n",
+ " print(ct_uid)"
+ ]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
- "for ct_uid, x_grid, y_grid, input_array, output_array in dataset.take(15):\n",
+ "for ct_uid, x_grid, y_grid, input_array, output_array in datasets['validation'].take(15):\n",
" print(ct_uid)"
]
},
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "for ct_uid, x_grid, y_grid, input_array, output_array in datasets['testing'].take(15):\n",
+ " print(ct_uid)"
+ ]
}
],
"metadata": {
