Skip to content

Commit 7dfa0b9

Browse files
authored
Remove deprecated args and class for v1.3 (#7019)
Fixes #7018. ### Description - Remove `compute_meaniou` - Remove `AsChannelFirst`, `AddChannel` and `SplitChannel` - Remove `create_multigpu_supervised_trainer` and `create_multigpu_supervised_evaluator` - deprecated `data_src_cfg_filename` in `AlgoEnsembleBuilder` - deprecated `runner_id` in `run` - deprecated `epoch_interval` and `iteration_interval` in `TensorBoardStatsHandler` - deprecated `get_validation_stats` in `Evaluator` - deprecated `get_train_stats` in `Trainer` - update the default value of `name` to `StatsHandler` in `StatsHandler` - update the default value of `random_size` to `False` in `RandSpatialCrop`, `RandScaleCrop`, `RandSpatialCropSamples` - update the default value of `image_only` to `True` in `LoadImage` and `SaveImage` - update `MetaTenor` related deprecation ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: KumoLiu <yunl@nvidia.com>
1 parent 0d1337e commit 7dfa0b9

54 files changed

Lines changed: 74 additions & 903 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/source/engines.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
Engines
66
=======
77

8-
Multi-GPU data parallel
9-
-----------------------
10-
11-
.. automodule:: monai.engines.multi_gpu_supervised_trainer
12-
:members:
13-
148
Workflows
159
---------
1610

docs/source/metrics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Metrics
6161

6262
`Mean IoU`
6363
----------
64-
.. autofunction:: compute_meaniou
64+
.. autofunction:: compute_iou
6565

6666
.. autoclass:: MeanIoU
6767
:members:

docs/source/transforms.rst

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -996,24 +996,12 @@ Utility
996996
:members:
997997
:special-members: __call__
998998

999-
`AsChannelFirst`
1000-
""""""""""""""""
1001-
.. autoclass:: AsChannelFirst
1002-
:members:
1003-
:special-members: __call__
1004-
1005999
`AsChannelLast`
10061000
"""""""""""""""
10071001
.. autoclass:: AsChannelLast
10081002
:members:
10091003
:special-members: __call__
10101004

1011-
`AddChannel`
1012-
""""""""""""
1013-
.. autoclass:: AddChannel
1014-
:members:
1015-
:special-members: __call__
1016-
10171005
`EnsureChannelFirst`
10181006
""""""""""""""""""""
10191007
.. autoclass:: EnsureChannelFirst
@@ -1032,12 +1020,6 @@ Utility
10321020
:members:
10331021
:special-members: __call__
10341022

1035-
`SplitChannel`
1036-
""""""""""""""
1037-
.. autoclass:: SplitChannel
1038-
:members:
1039-
:special-members: __call__
1040-
10411023
`CastToType`
10421024
""""""""""""
10431025
.. autoclass:: CastToType
@@ -1983,24 +1965,12 @@ Utility (Dict)
19831965
:members:
19841966
:special-members: __call__
19851967

1986-
`AsChannelFirstd`
1987-
"""""""""""""""""
1988-
.. autoclass:: AsChannelFirstd
1989-
:members:
1990-
:special-members: __call__
1991-
19921968
`AsChannelLastd`
19931969
""""""""""""""""
19941970
.. autoclass:: AsChannelLastd
19951971
:members:
19961972
:special-members: __call__
19971973

1998-
`AddChanneld`
1999-
"""""""""""""
2000-
.. autoclass:: AddChanneld
2001-
:members:
2002-
:special-members: __call__
2003-
20041974
`EnsureChannelFirstd`
20051975
"""""""""""""""""""""
20061976
.. autoclass:: EnsureChannelFirstd
@@ -2019,12 +1989,6 @@ Utility (Dict)
20191989
:members:
20201990
:special-members: __call__
20211991

2022-
`SplitChanneld`
2023-
"""""""""""""""
2024-
.. autoclass:: SplitChanneld
2025-
:members:
2026-
:special-members: __call__
2027-
20281992
`CastToTyped`
20291993
"""""""""""""
20301994
.. autoclass:: CastToTyped

monai/apps/auto3dseg/ensemble_builder.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from monai.bundle import ConfigParser
3737
from monai.data import partition_dataset
3838
from monai.transforms import MeanEnsemble, SaveImage, VoteEnsemble
39-
from monai.utils import RankFilter, deprecated_arg
39+
from monai.utils import RankFilter
4040
from monai.utils.enums import AlgoKeys
4141
from monai.utils.misc import check_kwargs_exist_in_class_init, prob2class
4242
from monai.utils.module import look_up_option, optional_import
@@ -332,13 +332,6 @@ class AlgoEnsembleBuilder:
332332
333333
"""
334334

335-
@deprecated_arg(
336-
"data_src_cfg_filename",
337-
since="1.2",
338-
removed="1.3",
339-
new_name="data_src_cfg_name",
340-
msg_suffix="please use `data_src_cfg_name` instead.",
341-
)
342335
def __init__(self, history: Sequence[dict[str, Any]], data_src_cfg_name: str | None = None):
343336
self.infer_algos: list[dict[AlgoKeys, Any]] = []
344337
self.ensemble: AlgoEnsemble

monai/apps/deepgrow/transforms.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ def __call__(self, data):
441441

442442
if np.all(np.less(current_size, self.spatial_size)):
443443
cropper = SpatialCrop(roi_center=center, roi_size=self.spatial_size)
444-
box_start = np.array([s.start for s in cropper.slices])
445-
box_end = np.array([s.stop for s in cropper.slices])
444+
box_start = np.array([s.start for s in cropper.slices]) # type: ignore[assignment]
445+
box_end = np.array([s.stop for s in cropper.slices]) # type: ignore[assignment]
446446
else:
447447
cropper = SpatialCrop(roi_start=box_start, roi_end=box_end)
448448

@@ -492,9 +492,6 @@ class AddGuidanceFromPointsd(Transform):
492492
For example, to handle key `image`, read/write affine matrices from the
493493
metadata `image_meta_dict` dictionary's `affine` field.
494494
495-
.. deprecated:: 0.6.0
496-
``dimensions`` is deprecated, use ``spatial_dims`` instead.
497-
498495
"""
499496

500497
def __init__(

monai/bundle/scripts.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ def get_bundle_info(
704704
return bundle_info[version] # type: ignore[no-any-return]
705705

706706

707-
@deprecated_arg("runner_id", since="1.1", removed="1.3", new_name="run_id", msg_suffix="please use `run_id` instead.")
708707
def run(
709708
run_id: str | None = None,
710709
init_id: str | None = None,
@@ -766,7 +765,7 @@ def run(
766765
will patch the target config content with `tracking handlers` and the top-level items of `configs`.
767766
for detailed usage examples, please check the tutorial:
768767
https://github.com/Project-MONAI/tutorials/blob/main/experiment_management/bundle_integrate_mlflow.ipynb.
769-
args_file: a JSON or YAML file to provide default values for `runner_id`, `meta_file`,
768+
args_file: a JSON or YAML file to provide default values for `run_id`, `meta_file`,
770769
`config_file`, `logging`, and override pairs. so that the command line inputs can be simplified.
771770
override: id-value pairs to override or add the corresponding config content.
772771
e.g. ``--net#input_chns 42``, ``--net %/data/other.json#net_arg``.

monai/data/dataset.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,9 +1482,6 @@ class CSVDataset(Dataset):
14821482
kwargs_read_csv: dictionary args to pass to pandas `read_csv` function.
14831483
kwargs: additional arguments for `pandas.merge()` API to join tables.
14841484
1485-
.. deprecated:: 0.8.0
1486-
``filename`` is deprecated, use ``src`` instead.
1487-
14881485
"""
14891486

14901487
def __init__(

monai/data/grid_dataset.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ class GridPatchDataset(IterableDataset):
185185
transform: a callable data transform operates on the patches.
186186
with_coordinates: whether to yield the coordinates of each patch, default to `True`.
187187
188-
.. deprecated:: 0.8.0
189-
``dataset`` is deprecated, use ``data`` instead.
190-
191188
"""
192189

193190
def __init__(
@@ -253,9 +250,6 @@ class PatchDataset(Dataset):
253250
254251
>>> torch.Size([2, 1, 3, 3])
255252
256-
.. deprecated:: 0.8.0
257-
``dataset`` is deprecated, use ``data`` instead.
258-
259253
"""
260254

261255
def __init__(

monai/data/image_reader.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
import numpy as np
2424
from torch.utils.data._utils.collate import np_str_obj_array_pattern
2525

26-
from monai.config import DtypeLike, KeysCollection, PathLike
26+
from monai.config import KeysCollection, PathLike
2727
from monai.data.utils import (
2828
affine_to_spacing,
2929
correct_nifti_header_if_necessary,
3030
is_no_channel,
3131
is_supported_format,
3232
orientation_ras_lps,
3333
)
34-
from monai.utils import MetaKeys, SpaceKeys, TraceKeys, deprecated_arg, ensure_tuple, optional_import, require_pkg
34+
from monai.utils import MetaKeys, SpaceKeys, TraceKeys, ensure_tuple, optional_import, require_pkg
3535

3636
if TYPE_CHECKING:
3737
import itk
@@ -861,20 +861,17 @@ class NibabelReader(ImageReader):
861861
862862
"""
863863

864-
@deprecated_arg("dtype", since="1.0", msg_suffix="please modify dtype of the returned by ``get_data`` instead.")
865864
def __init__(
866865
self,
867866
channel_dim: str | int | None = None,
868867
as_closest_canonical: bool = False,
869868
squeeze_non_spatial_dims: bool = False,
870-
dtype: DtypeLike = np.float32,
871869
**kwargs,
872870
):
873871
super().__init__()
874872
self.channel_dim = float("nan") if channel_dim == "no_channel" else channel_dim
875873
self.as_closest_canonical = as_closest_canonical
876874
self.squeeze_non_spatial_dims = squeeze_non_spatial_dims
877-
self.dtype = dtype # deprecated
878875
self.kwargs = kwargs
879876

880877
def verify_suffix(self, filename: Sequence[PathLike] | PathLike) -> bool:

monai/data/iterable_dataset.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ class CSVIterableDataset(IterableDataset):
195195
kwargs_read_csv: dictionary args to pass to pandas `read_csv` function. Default to ``{"chunksize": chunksize}``.
196196
kwargs: additional arguments for `pandas.merge()` API to join tables.
197197
198-
.. deprecated:: 0.8.0
199-
``filename`` is deprecated, use ``src`` instead.
200-
201198
"""
202199

203200
def __init__(
@@ -223,8 +220,6 @@ def __init__(
223220
self.shuffle = shuffle
224221
self.seed = seed
225222
self.kwargs_read_csv = kwargs_read_csv or {"chunksize": chunksize}
226-
# in case treating deprecated arg `filename` as kwargs, remove it from `kwargs`
227-
kwargs.pop("filename", None)
228223
self.kwargs = kwargs
229224

230225
self.iters: list[Iterable] = self.reset()

0 commit comments

Comments
 (0)