-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
32,008 additions
and
5,586 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,931 changes: 1,931 additions & 0 deletions
1,931
.doctrees/nbsphinx/_examples/AutoSegmentation.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,314 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Configuration\n", | ||
"\n", | ||
"PyDicer provides various options which you may configure to change the behaviour of the tool." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:48.919921Z", | ||
"iopub.status.busy": "2023-12-13T06:22:48.919723Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.670045Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.669389Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"try:\n", | ||
" from pydicer import PyDicer\n", | ||
"except ImportError:\n", | ||
" !pip install pydicer\n", | ||
" from pydicer import PyDicer\n", | ||
"\n", | ||
"import logging\n", | ||
"\n", | ||
"from pydicer.utils import fetch_converted_test_data\n", | ||
"\n", | ||
"working_directory = fetch_converted_test_data(\"./testdata_lctsc\", dataset=\"LCTSC\")\n", | ||
"\n", | ||
"pydicer = PyDicer(working_directory)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Getting and Setting Options\n", | ||
"\n", | ||
"Use the `get_config` and `set_config` functions of the `config` module to get and set configuration\n", | ||
"options respectively." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.672967Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.672664Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.677340Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.676730Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Current logging verbosity: 0\n", | ||
"New logging verbosity: 10\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"logging_verbosity = pydicer.config.get_config(\"verbosity\")\n", | ||
"print(f\"Current logging verbosity: {logging_verbosity}\")\n", | ||
"\n", | ||
"# Set to logging level DEBUG\n", | ||
"pydicer.config.set_config(\"verbosity\", logging.DEBUG)\n", | ||
"\n", | ||
"logging_verbosity = pydicer.config.get_config(\"verbosity\")\n", | ||
"print(f\"New logging verbosity: {logging_verbosity}\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Options Available\n", | ||
"\n", | ||
"### Logging Verbosity\n", | ||
"\n", | ||
"Level of output for standard out. Value indicates the Python built-in log level. A value of 0\n", | ||
"(not set) will display the process bar. Logs of all levels are available in the .pydicer directory.\n", | ||
"\n", | ||
"Valid options are: `[logging.NOTSET, logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR]`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.680268Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.680027Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.683466Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.682863Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"verbosity\", logging.DEBUG)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Frame of Reference Fallback Linkage\n", | ||
"\n", | ||
"Determine whether to fallback on linking objects via their Frame of Reference if no more stable\n", | ||
"link exists.\n", | ||
"\n", | ||
"Valid options are: `True` or `False`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.686045Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.685542Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.688927Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.688295Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"for_fallback_linkage\", True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Enforce `.dcm` file extension\n", | ||
"\n", | ||
"If True only files with the .dcm or .DCM extension will be preprocessed. Otherwise any file in the\n", | ||
"DICOM directory will be preprocessed.\n", | ||
"\n", | ||
"Valid options are: `True` or `False`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.691553Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.691344Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.695216Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.694667Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"enforce_dcm_ext\", True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Interpolate Missing Slices\n", | ||
"\n", | ||
"When missing slices are detected these will be interpolated if True. Otherwise these cases will be\n", | ||
"sent to quarantine.\n", | ||
"\n", | ||
"Valid options are: `True` or `False`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.697853Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.697469Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.700946Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.700342Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"interp_missing_slices\", True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Ignore Duplicate Slices\n", | ||
"\n", | ||
"If two slices at the same location with different pixel data are found then the first slice is used\n", | ||
"if ignore_duplicate_slices is True. Otherwise an error is raised and these images are sent to\n", | ||
"quarantine.\n", | ||
"\n", | ||
"Valid options are: `True` or `False`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.703403Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.703207Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.706596Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.705970Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"ignore_duplicate_slices\", False)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Generate NRRD\n", | ||
"\n", | ||
"Whether or not to generate an additional NRRD file when converting RTSTRUCT. This allows loading\n", | ||
"easily into 3D slicer, but it takes up more disk space and takes time to generate the file.\n", | ||
"\n", | ||
"Valid options are: `True` or `False`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.709235Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.708841Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.712240Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.711693Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"generate_nrrd\", False)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### NRRD Colormap\n", | ||
"\n", | ||
"If NRRD files are to be generated, this defines the Matplotlib colormap to use when saving NRRD\n", | ||
"file of structures.\n", | ||
"\n", | ||
"Valid options are any [Matplotlib colormap](https://matplotlib.org/stable/users/explain/colors/colormaps.html)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2023-12-13T06:22:53.714796Z", | ||
"iopub.status.busy": "2023-12-13T06:22:53.714333Z", | ||
"iopub.status.idle": "2023-12-13T06:22:53.717874Z", | ||
"shell.execute_reply": "2023-12-13T06:22:53.717323Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pydicer.config.set_config(\"nrrd_colormap\", \"rainbow\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"interpreter": { | ||
"hash": "814af119db7f8f2860617be3dcd1d37c560587d11c65bd58c45b1679d3ee6ea4" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3.8.0 64-bit ('pydicer': pyenv)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.