Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ Post-processing
:members:
:special-members: __call__

`Prob NMS`
""""""""""
`ProbNMS`
"""""""""
.. autoclass:: ProbNMS
:members:

Expand All @@ -563,6 +563,12 @@ Spatial
:members:
:special-members: __call__

`ResampleToMatch`
"""""""""""""""""
.. autoclass:: ResampleToMatch
:members:
:special-members: __call__

`Spacing`
"""""""""
.. image:: https://github.com/Project-MONAI/DocImages/raw/main/transforms/Spacing.png
Expand Down Expand Up @@ -827,7 +833,6 @@ Utility
:members:
:special-members: __call__


`Transpose`
"""""""""""
.. autoclass:: Transpose
Expand All @@ -852,6 +857,7 @@ Utility
:members:
:special-members: __call__


`Lambda`
""""""""
.. autoclass:: Lambda
Expand Down Expand Up @@ -1401,6 +1407,12 @@ Post-processing (Dict)
:members:
:special-members: __call__

`ProbNMSd`
""""""""""
.. autoclass:: ProbNMSd
:members:
:special-members: __call__

Spatial (Dict)
^^^^^^^^^^^^^^

Expand All @@ -1410,6 +1422,12 @@ Spatial (Dict)
:members:
:special-members: __call__

`ResampleToMatchd`
""""""""""""""""""
.. autoclass:: ResampleToMatchd
:members:
:special-members: __call__

`Spacingd`
""""""""""
.. image:: https://github.com/Project-MONAI/DocImages/raw/main/transforms/Spacingd.png
Expand Down Expand Up @@ -1656,6 +1674,12 @@ Utility (Dict)
:members:
:special-members: __call__

`ToPILd`
""""""""
.. autoclass:: ToPILd
:members:
:special-members: __call__

`DeleteItemsd`
""""""""""""""
.. autoclass:: DeleteItemsd
Expand All @@ -1668,6 +1692,12 @@ Utility (Dict)
:members:
:special-members: __call__

`Transposed`
""""""""""""
.. autoclass:: Transposed
:members:
:special-members: __call__

`SqueezeDimd`
"""""""""""""
.. autoclass:: SqueezeDimd
Expand Down Expand Up @@ -1710,6 +1740,12 @@ Utility (Dict)
:members:
:special-members: __call__

`RemoveRepeatedChanneld`
""""""""""""""""""""""""
.. autoclass:: RemoveRepeatedChanneld
:members:
:special-members: __call__

`LabelToMaskd`
""""""""""""""
.. autoclass:: LabelToMaskd
Expand Down
10 changes: 7 additions & 3 deletions tests/test_integration_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from monai.data import DataLoader
from monai.utils import set_determinism
from tests.utils import DistTestCase, TimedCall, skip_if_no_cuda, skip_if_quick
from tests.utils import DistTestCase, SkipIfBeforePyTorchVersion, TimedCall, skip_if_no_cuda, skip_if_quick


def run_loading_test(num_workers=50, device="cuda:0" if torch.cuda.is_available() else "cpu", pw=False):
Expand All @@ -38,15 +38,19 @@ def run_loading_test(num_workers=50, device="cuda:0" if torch.cuda.is_available(

@skip_if_quick
@skip_if_no_cuda
@SkipIfBeforePyTorchVersion((1, 9))
class IntegrationLoading(DistTestCase):
def tearDown(self):
set_determinism(seed=None)

@TimedCall(seconds=5000, skip_timing=not torch.cuda.is_available(), daemon=False)
def test_timing(self):
for pw, expected in zip((False, True), ((6966, 7714), (6966, 4112))):
expected = None
for pw in (False, True):
result = run_loading_test(pw=pw)
np.testing.assert_allclose(result, expected)
if expected is None:
expected = result[0]
np.testing.assert_allclose(result[0], expected) # test for deterministic first epoch in two settings


if __name__ == "__main__":
Expand Down
17 changes: 14 additions & 3 deletions tests/test_module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import glob
import inspect
import os
import pathlib
import unittest

import monai
Expand All @@ -37,19 +38,29 @@ def test_public_api(self):
def test_transform_api(self):
"""monai subclasses of MapTransforms must have alias names ending with 'd', 'D', 'Dict'"""
to_exclude = {"MapTransform"} # except for these transforms
to_exclude_docs = {"Decollate", "Ensemble", "Invert", "SaveClassification", "RandTorchVision"}
to_exclude_docs.update({"DeleteItems", "SelectItems", "CopyItems", "ConcatItems"})
xforms = {
name: obj
for name, obj in monai.transforms.__dict__.items()
if inspect.isclass(obj) and issubclass(obj, monai.transforms.MapTransform)
}
names = sorted(x for x in xforms if x not in to_exclude)
remained = set(names)
doc_file = os.path.join(pathlib.Path(__file__).parent.parent, "docs", "source", "transforms.rst")
contents = pathlib.Path(doc_file).read_text() if os.path.exists(doc_file) else None
for n in names:
if not n.endswith("d"):
continue
basename = n[:-1] # Transformd basename is Transform
for postfix in ("D", "d", "Dict"):
remained.remove(f"{basename}{postfix}")
with self.subTest(n=n):
basename = n[:-1] # Transformd basename is Transform
for docname in (f"{basename}", f"{basename}d"):
if docname in to_exclude_docs:
continue
if (contents is not None) and f"`{docname}`" not in f"{contents}":
self.assertTrue(False, f"please add `{docname}` to docs/source/transforms.rst")
for postfix in ("D", "d", "Dict"):
remained.remove(f"{basename}{postfix}")
self.assertFalse(remained)


Expand Down