Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
09638a7
[DLMED] add missing import (#1376)
Nic-Ma Dec 17, 2020
1608b10
adds jpeg (#1379)
wyli Dec 17, 2020
b7ecd7b
[DLMED] add missing arg in GANTrainer (#1383)
Nic-Ma Dec 17, 2020
70be9ab
1198 efficient differentiable bilateral filter (#1375)
charliebudd Dec 18, 2020
36b8302
update contributing and normalis* -> normaliz* (#1388)
rijobro Dec 18, 2020
f20e132
[DLMED] add output_dtype (#1394)
Nic-Ma Dec 28, 2020
a4b1144
with eval_mode(net): (#1384)
rijobro Dec 29, 2020
e2c0ed2
1390 Enhance DynUNet with get_feature_maps API (#1393)
Nic-Ma Dec 30, 2020
0c2411e
adds missing desc (#1403)
wyli Dec 31, 2020
1924b43
part of #926 (#1368)
wyli Jan 4, 2021
115f146
Implement dice cross entropy loss (#1409)
yiheng-wang-nv Jan 6, 2021
a74fef9
Unify visualisation (#1381)
rijobro Jan 6, 2021
5aa5e16
1405 add bending energy loss (#1408)
kate-sann5100 Jan 6, 2021
db831ae
Fix failures from many pulls from hub.docker.com (Done) (#1406)
danielschulz Jan 6, 2021
db7bf89
fixes dockerfile (#1413)
wyli Jan 7, 2021
1f74ca2
Wildcard import (#1411)
rijobro Jan 7, 2021
53c145d
Fixes ci (#1416)
wyli Jan 7, 2021
a4ef691
Improve docker build process (#1419)
IsaacYangSLA Jan 7, 2021
1544d0c
1412 local normalized cross correlation (#1415)
kate-sann5100 Jan 10, 2021
3d5554f
1404 Fixing a few code performance issues (#1423)
de-sh Jan 11, 2021
3ac6957
[DLMED] add more clear doc-string (#1425)
Nic-Ma Jan 11, 2021
d735103
Make master installation clearer (#1426)
rijobro Jan 11, 2021
2e26a33
Refactor the comparison involving `not` (#1427)
deepsource-autofix[bot] Jan 11, 2021
27919e3
ignore versioneer -- deepsource check (#1429)
wyli Jan 11, 2021
0d59289
Remove unnecessary lambda expression (#1428)
deepsource-autofix[bot] Jan 11, 2021
fe28bba
update hashes (#1431)
wyli Jan 12, 2021
50bcaf1
Enhance Rotate90 transform with more check (#1432)
Nic-Ma Jan 12, 2021
70483b6
Update occ sens (#1430)
rijobro Jan 12, 2021
df9bc68
Remove methods with unnecessary super delegation. (#1437)
deepsource-autofix[bot] Jan 12, 2021
85f6283
Refactor unnecessary `else` / `elif` when `if` block has a `return` s…
deepsource-autofix[bot] Jan 12, 2021
a9e3654
1412 global mutual information (#1421)
kate-sann5100 Jan 12, 2021
38aa5dc
remove isort:skip (#1435)
rijobro Jan 12, 2021
d21e712
Refactor unnecessary `else` / `elif` when `if` block has a `raise` st…
deepsource-autofix[bot] Jan 12, 2021
3b20de8
Update occ sens (#1439)
rijobro Jan 13, 2021
da0f0fb
1433 Add TorchVision transform wrapper (#1436)
Nic-Ma Jan 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 27 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version = 1

test_patterns = ["tests/**"]

exclude_patterns = [
"monai/_version.py",
"versioneer.py"
]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"

[[analyzers]]
name = "test-coverage"
enabled = true

[[analyzers]]
name = "docker"
enabled = true

[[analyzers]]
name = "shell"
enabled = true
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ignore the following files/folders during docker build

__pycache__/
docs/

.coverage
.readthedocs.yml
*.md
*.toml

!README.md

3 changes: 2 additions & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ jobs:
cron-docker:
if: github.repository == 'Project-MONAI/MONAI'
container:
image: docker://projectmonai/monai:latest
image: localhost:5000/local_monai:dockerhub # use currently latest, locally available dockerhub image
options: "--gpus all"
runs-on: [self-hosted, linux, x64, common]
steps:
- name: Run tests report coverage
# The docker image process has done the compilation. BUILD_MONAI=1 may not be necessary.
run: |
cd /opt/monai
nvidia-smi
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,17 @@ jobs:
ref: master
- name: docker_build
run: |
# build and run original docker image for local registry
docker build -t localhost:5000/local_monai:latest -f Dockerfile .
docker push localhost:5000/local_monai:latest
# build once more w/ tag "latest": remove flake package as it is not needed on hub.docker.com
sed -i '/flake/d' requirements-dev.txt
docker build -t projectmonai/monai:latest -f Dockerfile .
docker login -u projectmonai -p ${{ secrets.DOCKER_PW }}
# also push as tag "dockerhub" to local registry
docker image tag projectmonai/monai:latest localhost:5000/local_monai:dockerhub
docker push localhost:5000/local_monai:dockerhub
# distribute as always w/ tag "latest" to hub.docker.com
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin
docker push projectmonai/monai:latest
docker logout

Expand Down
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ _Pull request early_

We encourage you to create pull requests early. It helps us track the contributions under development, whether they are ready to be merged or not. Change your pull request's title to begin with `[WIP]` until it is ready for formal review.

Please note that, as per PyTorch, MONAI uses American English spelling. This means classes and variables should be: normali**z**e, visuali**z**e, colo~~u~~r, etc.

### Preparing pull requests
To ensure the code quality, MONAI relies on several linting tools ([flake8 and its plugins](https://gitlab.com/pycqa/flake8), [black](https://github.com/psf/black), [isort](https://github.com/timothycrosley/isort)),
static type analysis tools ([mypy](https://github.com/python/mypy), [pytype](https://github.com/google/pytype)), as well as a set of unit/integration tests.
Expand All @@ -58,7 +60,7 @@ pip install -U -r requirements-dev.txt # install the latest tools

License information: all source code files should start with this paragraph:
```
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -71,6 +73,13 @@ License information: all source code files should start with this paragraph:

```

##### Exporting modules

If you intend for any variables/functions/classes to be available outside of the file with the edited functionality, then:

- Create or append to the `__all__` variable (in the file in which functionality has been added), and
- Add to the `__init__.py` file.

#### Unit testing
MONAI tests are located under `tests/`.

Expand Down
22 changes: 17 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -11,10 +11,11 @@

ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:20.10-py3

FROM ${PYTORCH_IMAGE} as base
FROM ${PYTORCH_IMAGE}

MAINTAINER MONAI Consortium <monai.miccai2019@gmail.com>

WORKDIR /opt/monai
ENV PATH=/opt/tools:$PATH

# install full deps
COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/
Expand All @@ -23,13 +24,24 @@ RUN cp /tmp/requirements.txt /tmp/req.bak \
&& python -m pip install --no-cache-dir --use-feature=2020-resolver -r /tmp/requirements-dev.txt

# compile ext and remove temp files
COPY . .
# TODO: remark for issue [revise the dockerfile #1276](https://github.com/Project-MONAI/MONAI/issues/1276)
# please specify exact files and folders to be copied -- else, basically always, the Docker build process cannot cache
# this or anything below it and always will build from at most here; one file change leads to no caching from here on...

COPY LICENSE setup.py setup.cfg versioneer.py runtests.sh .gitignore .gitattributes README.md MANIFEST.in ./
COPY tests ./tests
COPY monai ./monai
COPY .git ./.git
RUN BUILD_MONAI=1 FORCE_CUDA=1 python setup.py develop \
&& rm -rf build __pycache__

# NGC Client
WORKDIR /opt/tools
RUN wget -q https://ngc.nvidia.com/downloads/ngccli_cat_linux.zip && \
ARG NGC_CLI_URI="https://ngc.nvidia.com/downloads/ngccli_cat_linux.zip"
RUN wget -q ${NGC_CLI_URI} && \
unzip ngccli_cat_linux.zip && chmod u+x ngc && \
md5sum -c ngc.md5 && \
rm -rf ngccli_cat_linux.zip ngc.md5
# append /opt/tools to runtime path for NGC CLI to be accessible from all file system locations
ENV PATH=${PATH}:/opt/tools
WORKDIR /opt/monai
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ Its ambitions are:


## Installation
To install [the current release](https://pypi.org/project/monai/):

### Installing [the current release](https://pypi.org/project/monai/):
```bash
pip install monai
```

To install from the source code repository:
### Installing the master branch from the source code repository:
```bash
pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
```

Alternatively, pre-built Docker image is available via [DockerHub](https://hub.docker.com/r/projectmonai/monai):
### Using the pre-built Docker image [DockerHub](https://hub.docker.com/r/projectmonai/monai):
```bash
# with docker v19.03+
docker run --gpus all --rm -ti --ipc=host projectmonai/monai:latest
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# -- Project information -----------------------------------------------------
project = "MONAI"
copyright = "2020 MONAI Consortium"
copyright = "2020 - 2021 MONAI Consortium"
author = "MONAI Contributors"

# The full version, including alpha/beta/rc tags
Expand Down
23 changes: 23 additions & 0 deletions docs/source/losses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ Segmentation Losses
.. autoclass:: generalized_wasserstein_dice
:members:

`DiceCELoss`
~~~~~~~~~~~~
.. autoclass:: DiceCELoss
:members:

`FocalLoss`
~~~~~~~~~~~
.. autoclass:: FocalLoss
Expand All @@ -52,3 +57,21 @@ Segmentation Losses
~~~~~~~~~~~~~
.. autoclass:: TverskyLoss
:members:

Registration Losses
-------------------

`BendingEnergyLoss`
~~~~~~~~~~~~~~~~~~~
.. autoclass:: BendingEnergyLoss
:members:

`LocalNormalizedCrossCorrelationLoss`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: LocalNormalizedCrossCorrelationLoss
:members:

`GlobalMutualInformationLoss`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: GlobalMutualInformationLoss
:members:
4 changes: 0 additions & 4 deletions docs/source/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@ Metrics

.. autoclass:: SurfaceDistanceMetric
:members:

`Occlusion sensitivity`
-----------------------
.. autofunction:: compute_occlusion_sensitivity
5 changes: 5 additions & 0 deletions docs/source/networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ Layers
~~~~~~~~~~~~~~~~
.. autoclass:: GaussianFilter
:members:

`BilateralFilter`
~~~~~~~~~~~~~~~~~
.. autoclass:: BilateralFilter
:members:

`HilbertTransform`
~~~~~~~~~~~~~~~~~~
Expand Down
12 changes: 12 additions & 0 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,12 @@ Utility
:members:
:special-members: __call__

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

Dictionary Transforms
---------------------

Expand Down Expand Up @@ -969,6 +975,12 @@ Utility (Dict)
:members:
:special-members: __call__

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

Transform Adaptors
------------------
.. automodule:: monai.transforms.adaptors
Expand Down
8 changes: 7 additions & 1 deletion docs/source/visualize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ Class activation map
--------------------

.. automodule:: monai.visualize.class_activation_maps
:members:
:members:

Occlusion sensitivity
---------------------

.. automodule:: monai.visualize.occlusion_sensitivity
:members:
4 changes: 2 additions & 2 deletions monai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -22,7 +22,7 @@
__revision_id__ = version_dict.get("full-revisionid", None)
del get_versions, version_dict

__copyright__ = "(c) 2020 MONAI Consortium"
__copyright__ = "(c) 2020 - 2021 MONAI Consortium"

__basedir__ = os.path.dirname(__file__)

Expand Down
6 changes: 3 additions & 3 deletions monai/apps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -9,5 +9,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .datasets import *
from .utils import *
from .datasets import CrossValidation, DecathlonDataset, MedNISTDataset
from .utils import check_hash, download_and_extract, download_url, extractall
7 changes: 3 additions & 4 deletions monai/apps/datasets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -291,10 +291,9 @@ def get_properties(self, keys: Optional[Union[Sequence[str], str]] = None):
"""
if keys is None:
return self._properties
elif self._properties is not None:
if self._properties is not None:
return {key: self._properties[key] for key in ensure_tuple(keys)}
else:
return {}
return {}

def _generate_data_list(self, dataset_dir: str) -> List[Dict]:
section = "training" if self.section in ["training", "validation"] else "test"
Expand Down
4 changes: 2 additions & 2 deletions monai/apps/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -146,7 +146,7 @@ def download_url(url: str, filepath: str, hash_val: Optional[str] = None, hash_t
if has_tqdm:
pbar.close()
except IOError as e:
logging.debug("IO Error - %s" % e)
logging.debug("IO Error - %s", e)
finally:
if file_size == os.path.getsize(tmp_file_path):
if hash_val and not check_hash(tmp_file_path, hash_val, hash_type):
Expand Down
14 changes: 11 additions & 3 deletions monai/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -9,5 +9,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .deviceconfig import *
from .type_definitions import *
from .deviceconfig import (
USE_COMPILED,
get_gpu_info,
get_system_info,
print_config,
print_debug_info,
print_gpu_info,
print_system_info,
)
from .type_definitions import IndexSelection, KeysCollection
Loading