diff --git a/.github/workflows/weekly-preview.yml b/.github/workflows/weekly-preview.yml index a8eed74d9a..96a6e3b574 100644 --- a/.github/workflows/weekly-preview.yml +++ b/.github/workflows/weekly-preview.yml @@ -33,7 +33,7 @@ jobs: export YEAR_WEEK=$(date +'%y%U') echo "Year week for tag is ${YEAR_WEEK}" if ! [[ $YEAR_WEEK =~ ^[0-9]{4}$ ]] ; then echo "Wrong 'year week' format. Should be 4 digits."; exit 1 ; fi - git tag "1.2.dev${YEAR_WEEK}" + git tag "1.3.dev${YEAR_WEEK}" git log -1 git tag --list python setup.py sdist bdist_wheel diff --git a/.gitignore b/.gitignore index 2fd28bbfc7..b74875a74d 100644 --- a/.gitignore +++ b/.gitignore @@ -68,7 +68,8 @@ instance/ .scrapy # Sphinx documentation -docs/_build/ +docs/build/ +docs/source/_gen _build/ # PyBuilder diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c6c555168..a4dc5cf0ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ## [Unreleased] -## [1.2.0] - 2023-06-06 +## [1.2.0] - 2023-06-08 ### Added * Various Auto3DSeg enhancements and integration tests including multi-node multi-GPU optimization, major usability improvements * TensorRT and ONNX support for `monai.bundle` API and the relevant models @@ -110,6 +110,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). * `resample=True`; `resample=False` will be the new default in `SaveImage` * `random_size=True`; `random_size=False` will be the new default for the random cropping transforms * `image_only=False`; `image_only=True` will be the new default in `LoadImage` +* `AddChannel` and `AsChannelFirst` in favor of `EnsureChannelFirst` ### Removed * Deprecated APIs since v0.9, including WSIReader from `monai.apps`, `NiftiSaver` and `PNGSaver` from `monai.data` * Support for PyTorch 1.8 diff --git a/CITATION.cff b/CITATION.cff index dafb8578fe..d28f403fae 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -6,8 +6,8 @@ title: "MONAI: Medical Open Network for AI" abstract: "AI Toolkit for Healthcare Imaging" authors: - name: "MONAI Consortium" -date-released: 2022-12-19 -version: "1.1.0" +date-released: 2023-06-08 +version: "1.2.0" identifiers: - description: "This DOI represents all versions of MONAI, and will always resolve to the latest one." type: doi diff --git a/README.md b/README.md index d769bf66b1..25e22ed343 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Its ambitions are: - compositional & portable APIs for ease of integration in existing workflows; - domain-specific implementations for networks, losses, evaluation metrics and more; - customizable design for varying user expertise; -- multi-GPU data parallelism support. +- multi-GPU multi-node data parallelism support. ## Installation diff --git a/docs/Makefile b/docs/Makefile index 5afe804955..5dcb45d6df 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -25,3 +25,4 @@ help: clean: rm -rf build/ + rm -rf source/_gen diff --git a/docs/source/apps.rst b/docs/source/apps.rst index e543859b7c..7fa7b9e9ff 100644 --- a/docs/source/apps.rst +++ b/docs/source/apps.rst @@ -248,7 +248,7 @@ FastMRIReader ~~~~~~~~~~~~~ .. autofunction:: monai.apps.reconstruction.complex_utils.complex_conj -`auto3dseg` +`Auto3DSeg` ----------- .. automodule:: monai.apps.auto3dseg :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index 2762027a79..d04ff6acac 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -86,6 +86,7 @@ def generate_apidocs(*args): "sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.autosectionlabel", + "sphinx.ext.autosummary", "sphinx_autodoc_typehints", ] @@ -114,7 +115,7 @@ def generate_apidocs(*args): {"name": "Twitter", "url": "https://twitter.com/projectmonai", "icon": "fab fa-twitter-square"}, ], "collapse_navigation": True, - "navigation_depth": 3, + "navigation_depth": 1, "show_toc_level": 1, "footer_start": ["copyright"], "navbar_align": "content", diff --git a/docs/source/index.rst b/docs/source/index.rst index 2af6c6f6f9..1fde0b0ef3 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -27,7 +27,7 @@ Features - compositional & portable APIs for ease of integration in existing workflows; - domain-specific implementations for networks, losses, evaluation metrics and more; - customizable design for varying user expertise; -- multi-GPU data parallelism support. +- multi-GPU multi-node data parallelism support. Getting started diff --git a/docs/source/transforms.rst b/docs/source/transforms.rst index fe17fa4efe..7081f2ac95 100644 --- a/docs/source/transforms.rst +++ b/docs/source/transforms.rst @@ -2233,3 +2233,10 @@ Utilities .. automodule:: monai.transforms.utils_pytorch_numpy_unification :members: + +By Categories +------------- +.. toctree:: + :maxdepth: 1 + + transforms_idx diff --git a/docs/source/transforms_idx.rst b/docs/source/transforms_idx.rst new file mode 100644 index 0000000000..f4d02a483f --- /dev/null +++ b/docs/source/transforms_idx.rst @@ -0,0 +1,104 @@ +.. _transforms_idx: + +.. currentmodule:: monai.transforms + +Crop and pad +^^^^^^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + croppad.array + croppad.dictionary + croppad.batch + +Spatial +^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + spatial.array + spatial.dictionary + + +Intensity +^^^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + intensity.array + intensity.dictionary + +IO +^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + io.array + io.dictionary + +Lazy +^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + lazy.array + lazy.dictionary + lazy.utils + +MetaTensor utilities +^^^^^^^^^^^^^^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + meta_utility.dictionary + +Post-processing +^^^^^^^^^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + post.array + post.dictionary + +Signal +^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + signal.array + +Smooth field +^^^^^^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + smooth_field.array + smooth_field.dictionary + +Utility +^^^^^^^ + +.. autosummary:: + :toctree: _gen + :nosignatures: + + utility.array + utility.dictionary diff --git a/monai/apps/auto3dseg/bundle_gen.py b/monai/apps/auto3dseg/bundle_gen.py index 9a5cc8db90..e949bcdac5 100644 --- a/monai/apps/auto3dseg/bundle_gen.py +++ b/monai/apps/auto3dseg/bundle_gen.py @@ -537,7 +537,7 @@ def generate( parameters for each bundleAlgo based on gpus. Custom parameters are obtained through dummy training to simulate the actual model training process and hyperparameter optimization (HPO) experiments. - gpu_customization_specs (optinal): the dictionary to enable users overwrite the HPO settings. user can + gpu_customization_specs: the dictionary to enable users overwrite the HPO settings. user can overwrite part of variables as follows or all of them. The structure is as follows. allow_skip: a switch to determine if some Algo in the default templates can be skipped based on the analysis on the dataset from Auto3DSeg DataAnalyzer. diff --git a/monai/apps/auto3dseg/ensemble_builder.py b/monai/apps/auto3dseg/ensemble_builder.py index fa68342e0b..28644f8357 100644 --- a/monai/apps/auto3dseg/ensemble_builder.py +++ b/monai/apps/auto3dseg/ensemble_builder.py @@ -161,7 +161,7 @@ def __call__(self, pred_param: dict | None = None) -> list: only make prediction on the infer_files[file_slices]. - ``"mode"``: ensemble mode. Currently "mean" and "vote" (majority voting) schemes are supported. - ``"image_save_func"``: a dictionary used to instantiate the ``SaveImage`` transform. When specified, - the ensemble prediction will save the prediciton files, instead of keeping the files in the memory. + the ensemble prediction will save the prediction files, instead of keeping the files in the memory. Example: `{"_target_": "SaveImage", "output_dir": "./"}` - ``"sigmoid"``: use the sigmoid function (e.g. x > 0.5) to convert the prediction probability map to the label class prediction, otherwise argmax(x) is used. @@ -552,7 +552,7 @@ def set_num_fold(self, num_fold: int = 5) -> None: self.num_fold = num_fold def ensemble(self): - if self.mgpu: # torch.cuda.device_count() is not used because env is not set by autorruner + if self.mgpu: # torch.cuda.device_count() is not used because env is not set by autorunner # init multiprocessing and update infer_files dist.init_process_group(backend="nccl", init_method="env://") self.world_size = dist.get_world_size() diff --git a/monai/apps/pathology/handlers/utils.py b/monai/apps/pathology/handlers/utils.py index 4c11f2e859..1517e64324 100644 --- a/monai/apps/pathology/handlers/utils.py +++ b/monai/apps/pathology/handlers/utils.py @@ -23,7 +23,7 @@ def from_engine_hovernet(keys: KeysCollection, nested_key: str) -> Callable[[Any Since the output of HoVerNet is a dictionary, this function is to extend `monai.handlers.from_engine` to work with HoVerNet. - If data is a list of nestes dictionaries after decollating, extract nested value with expected keys and + If data is a list of nested dictionaries after decollating, extract nested value with expected keys and construct lists respectively, for example, if data is `[{"A": {"C": 1, "D": 2}, "B": {"C": 2, "D": 2}}, {"A": {"C": 3, "D": 2}, "B": {"C": 4, "D": 2}}]`, from_engine_hovernet(["A", "B"], "C"): `([1, 3], [2, 4])`. diff --git a/monai/data/dataset.py b/monai/data/dataset.py index bd3bea230f..912576bdcc 100644 --- a/monai/data/dataset.py +++ b/monai/data/dataset.py @@ -566,7 +566,7 @@ def __init__( hash_transform: a callable to compute hash from the transform information when caching. This may reduce errors due to transforms changing during experiments. Default to None (no hash). Other options are `pickle_hashing` and `json_hashing` functions from `monai.data.utils`. - reset_ops_id: whether to set `TraceKeys.ID` to ``Tracekys.NONE``, defaults to ``True``. + reset_ops_id: whether to set `TraceKeys.ID` to ``Tracekeys.NONE``, defaults to ``True``. When this is enabled, the traced transform instance IDs will be removed from the cached MetaTensors. This is useful for skipping the transform instance checks when inverting applied operations using the cached content and with re-created transform instances. diff --git a/monai/transforms/croppad/array.py b/monai/transforms/croppad/array.py index 740ea9d8f5..7c8d7b6a19 100644 --- a/monai/transforms/croppad/array.py +++ b/monai/transforms/croppad/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for crop and pad operations -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for crop and pad operations. """ from __future__ import annotations diff --git a/monai/transforms/croppad/batch.py b/monai/transforms/croppad/batch.py index bd8e7bf50f..e180a06161 100644 --- a/monai/transforms/croppad/batch.py +++ b/monai/transforms/croppad/batch.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for crop and pad operations acting on batches of data -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for crop and pad operations acting on batches of data. """ from __future__ import annotations diff --git a/monai/transforms/croppad/functional.py b/monai/transforms/croppad/functional.py index 783635e467..a8286fb90c 100644 --- a/monai/transforms/croppad/functional.py +++ b/monai/transforms/croppad/functional.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "functional" transforms for spatial operations -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "functional" transforms for spatial operations. """ from __future__ import annotations diff --git a/monai/transforms/intensity/array.py b/monai/transforms/intensity/array.py index 588913f579..f61e022c5c 100644 --- a/monai/transforms/intensity/array.py +++ b/monai/transforms/intensity/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for intensity adjustment -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for intensity adjustment. """ from __future__ import annotations diff --git a/monai/transforms/io/array.py b/monai/transforms/io/array.py index 325283c945..bf39116783 100644 --- a/monai/transforms/io/array.py +++ b/monai/transforms/io/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for IO functions -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for IO functions. """ from __future__ import annotations diff --git a/monai/transforms/post/array.py b/monai/transforms/post/array.py index 8e0c642d8b..df2e807a4b 100644 --- a/monai/transforms/post/array.py +++ b/monai/transforms/post/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for the model output tensors -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for the model output tensors. """ from __future__ import annotations diff --git a/monai/transforms/signal/array.py b/monai/transforms/signal/array.py index 59b267c151..1a7b87a774 100644 --- a/monai/transforms/signal/array.py +++ b/monai/transforms/signal/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of transforms for signal operations -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of transforms for signal operations. """ from __future__ import annotations diff --git a/monai/transforms/spatial/array.py b/monai/transforms/spatial/array.py index 4bbecb3f50..ec38dfaffe 100644 --- a/monai/transforms/spatial/array.py +++ b/monai/transforms/spatial/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for spatial operations -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for spatial operations. """ from __future__ import annotations diff --git a/monai/transforms/spatial/functional.py b/monai/transforms/spatial/functional.py index 9d77a83389..add4e7f5ea 100644 --- a/monai/transforms/spatial/functional.py +++ b/monai/transforms/spatial/functional.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "functional" transforms for spatial operations -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "functional" transforms for spatial operations. """ from __future__ import annotations diff --git a/monai/transforms/utility/array.py b/monai/transforms/utility/array.py index 272fd120ec..6c917a9f0a 100644 --- a/monai/transforms/utility/array.py +++ b/monai/transforms/utility/array.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -A collection of "vanilla" transforms for utility functions -https://github.com/Project-MONAI/MONAI/wiki/MONAI_Design +A collection of "vanilla" transforms for utility functions. """ from __future__ import annotations diff --git a/monai/transforms/utils.py b/monai/transforms/utils.py index 75cd577cb6..c01f44635b 100644 --- a/monai/transforms/utils.py +++ b/monai/transforms/utils.py @@ -1666,7 +1666,7 @@ def print_table_column(name, torch, numpy, color=Colors.none): print_color(f"Number transforms allowing both torch and numpy: {n_t_or_np}", Colors.green) print_color(f"Number of TorchTransform: {n_t}", Colors.green) print_color(f"Number of NumpyTransform: {n_np}", Colors.yellow) - print_color(f"Number of uncategorised: {n_uncategorized}", Colors.red) + print_color(f"Number of uncategorized: {n_uncategorized}", Colors.red) def convert_pad_mode(dst: NdarrayOrTensor, mode: str | None): diff --git a/tests/test_integration_workflows_gan.py b/tests/test_integration_workflows_gan.py index c82087f9ba..6896241d35 100644 --- a/tests/test_integration_workflows_gan.py +++ b/tests/test_integration_workflows_gan.py @@ -41,7 +41,7 @@ def run_training_test(root_dir, device="cuda:0"): train_transforms = Compose( [ LoadImaged(keys=["reals"]), - EnsureChannelFirstd(keys=["reals"]), + EnsureChannelFirstd(keys=["reals"], channel_dim=-1), ScaleIntensityd(keys=["reals"]), RandFlipd(keys=["reals"], prob=0.5), ]