Skip to content

Commit

Permalink
rebase dev and add box utils (#3586)
Browse files Browse the repository at this point in the history
* 3415 Update WSIReader (#3417)

* Update WSIReader level/location/size calculation

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update location downsampling

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update tests and add a new test case

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update few names and logics

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Fix the dependency issue

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Check for imagecodecs + tifffile

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Remove new test case that uses too much memory

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Add new case and ignore level=0 for TiffFile

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Address comments

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

Co-authored-by: Nic Ma <nma@nvidia.com>

* update create_file_basename (#3436)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* Update TiffFile backend in WSIReader (#3438)

* Update TiffFile backend to read only the entire image

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* 3429 Enhance the scalar write logic of TensorBoardStatsHandler (#3431)

* [DLMED] extract write logic

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3430 support dataframes and streams in CSVDataset (#3440)

* [DLMED] add dataframe

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance CSV iterable dataset

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add unit tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typehints

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add comment

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix file close issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix doc

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* Add base class for workflows (#3445)

* [DLMED] add BaseWorkflow

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] add *args, **kwargs

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* Enhance deprecated arg for kwargs in CSV datasets (#3446)

* [DLMED] fix deprecated arg

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* 3293 Remove extra deep supervision modules of DynUNet (#3427)

* enhance dynunet

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* fix black issue

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* use strict=False

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* fix black 21.12 error

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* enhance code and update docstring

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* 471- fixes deprecated args (#3447)

* fixes deprecated args

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* improve error message if reader nott available (#3457)

improve error message if reader nott available

* adds the missing imports (#3462)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* revise MILModel docstring (#3459)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* deprecate reduction (#3464)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3444 Add DatasetFunc (#3456)

* [DLMED] add dataset generator

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add DatasetGenerator

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix wrong test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] simplify according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] remove return

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update rtol for CI

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* Add missing components to API doc (#3468)

* [DLMED] add missing docs

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add missing components

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix test

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3466 3467 Add `channel_wise` and correct doc-string (#3469)

* [DLMED] add channel-wise

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] skip test if before 1.7

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] remove cls (#3475)

Signed-off-by: Nic Ma <nma@nvidia.com>

* Add Iteration base class (#3472)

* [DLMED] add Iteration base class

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* fix link error (#3488)

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* 3465 Support string as dtype (#3478)

* [DLMED] support string dtype

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance dtype in ToCupy

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update to 0.4.7 (#3483)

Signed-off-by: Nic Ma <nma@nvidia.com>

* Improve NVTX Range Naming (#3484)

* Update to not include number for the name of the first range

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update CuCIM and TorchVision wrappers to include name

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update nvtx range to append undelying class for wrapper tranforms

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Add new test cases to cover changes

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* Update cucim and torchvision check

Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>

* 3471 3491 Add example images for intensity transforms (#3494)

* [DLMED] add missing images

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix 3471

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix AsDiscrete

Signed-off-by: Nic Ma <nma@nvidia.com>

* Make bending energy loss invariant to resolution (#3493)

* make bending energy loss invariant to resolution

fixes #3485

Signed-off-by: Ebrahim Ebrahim <ebrahim.ebrahim@kitware.com>

* set BendingEnergyLoss default normalize to False

Maybe it's more important that the default behavior match usage of the
term "bending energy" elsewhere, rather than that it be the most
convenient behavior.

Signed-off-by: Ebrahim Ebrahim <ebrahim.ebrahim@kitware.com>

* Removes redundant casting -- ensure tuple (#3495)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3498 Correct `kwargs` arg for `convert_to_torchscript` (#3499)

* [DLMED] correct kwargs

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix grammar

Signed-off-by: Nic Ma <nma@nvidia.com>

* update tests with 1.10.1 (#3500)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3501 Add dict version SavitzkyGolaySmoothd (#3502)

* [DLMED] add SavitzkyGolaySmoothd

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* remove file (#3507)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* avoid 60.0.0 (#3514)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* [DLMED] add 6 new transform images (#3512)

Signed-off-by: Nic Ma <nma@nvidia.com>

* support of reversed indexing (#3508)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* Adding Torchscript utility functions (#3138)

* Adding Torchscript utility functions

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* Adding Torchscript utility functions

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Added test for extra files

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Updates

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updates

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Updates

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
Co-authored-by: Nic Ma <nma@nvidia.com>

* 3517 Refine AddCoordinateChannels transform (#3524)

* [DLMED] change to utility transforms

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance args

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3521 Copyright header update (#3522)

* adds missing item

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update the contributing guide

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update copyright headers

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3521 - adds a util to check the licence info (#3523)

* util to check the licence info

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update flags

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3350 Remove PyTorch 1.5.x related logic and mark versions for all new APIs (#3526)

* [DLMED] clarify old APIs

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3533 Update PyTorch docker to 21.12 (#3534)

* [DLMED] update to 21.12

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add PyTorch 1.9 test

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3531 Add args to subclass of CacheDataset (#3532)

* [DLMED] add missing args

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update progress arg

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3525 Fix invertible issue in OneOf compose (#3530)

* [DLMED] fix oneof

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add more unit tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update index

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* Revert "[DLMED] update according to comments"

This reverts commit c6c3a35.

Signed-off-by: Nic Ma <nma@nvidia.com>

* Revert "[DLMED] update index"

This reverts commit 649a7c5.

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3535 - drop python 36 support (#3536)

* drop py36 support

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* drop 20.09 test because of python min version 3.6

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* error->warning, revise copyright

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3541 has cupy check (#3544)

* has cupy check

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3053 release *_dist.py tests memory to avoid OOM (#3537)

* adds min. memory testing utils

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* include valueerror for robust outcome

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* ensure float

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* msg improvements

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update threshold

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* remove ref

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* separate disttests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3539 Remove decollate warning (#3545)

* [DLMED] remove warning

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance set_determinism (#3547)

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: Wenqi Li <wenqil@nvidia.com>

* Smooth Deform (#3551)

* Adding smooth deform transform

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Updates

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Docs update

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Type fixing

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* Fix

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Fix

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix for moveaxis

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Fix for moveaxis

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Adding example images, random field sized reduced to (10,10,10)

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* Changed backend

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* Tweak

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

* 3552 - runtest.sh defaults to no build/install (#3555)

* runtest.sh defaults to no build/install

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* following test case conventions for multiprocessing

- adding `_dist` to multiprocessing test cases
- decouple multiprocessing LMDB tests from `test_lmdbdataset`

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* exclude lmdbdataset tests in min_tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>

* Remove apply_same_field (#3556)

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>

* skipping pretraining network loading when downloading is unsuccessful (#3558)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* [DLMED] fix mypy errors (#3562)

Signed-off-by: Nic Ma <nma@nvidia.com>

* 3559 Enhance `DatasetSummary` for several points (#3560)

* [DLMED] update dataset summary

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] enhance data type

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix pickle issue

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: Wenqi Li <wenqil@nvidia.com>

* add box util in monai/data

* add box util in monai/data

* [pre-commit.ci] pre-commit suggestions (#3568)

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](pre-commit/pre-commit-hooks@v4.0.1...v4.1.0)
- [github.com/asottile/pyupgrade: v2.29.0 → v2.31.0](asottile/pyupgrade@v2.29.0...v2.31.0)
- [github.com/asottile/yesqa: v1.2.3 → v1.3.0](asottile/yesqa@v1.2.3...v1.3.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* 3565 - adds metadata when loading dicom series (#3566)

* adds metadata when loading dicom series

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* fixes timed tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 3580 - create codeql-analysis.yml (#3579)

* Create codeql-analysis.yml

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* build cpp

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* fixes Multiplication result converted to larger type

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* fixes url parsing

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* 498 Add logger_handler to LrScheduleHandler (#3570)

* [DLMED] add log handler

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix CI tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix CI test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] test CI

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix logging

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] temp test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix wrong unit test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix wrong test cases

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: Behrooz <3968947+drbeh@users.noreply.github.com>
Co-authored-by: Nic Ma <nma@nvidia.com>
Co-authored-by: Wenqi Li <wenqil@nvidia.com>
Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com>
Co-authored-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Co-authored-by: Ebrahim Ebrahim <ebrahim.mt@gmail.com>
Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
10 people authored Jan 5, 2022
1 parent f94e768 commit dd74c59
Show file tree
Hide file tree
Showing 803 changed files with 4,032 additions and 1,550 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ A few sentences describing the changes proposed in this pull request.
- [ ] 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`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/` folder.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ dev, main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
schedule:
- cron: '18 1 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

- name: Build
run: |
python -m pip install -r requirements-dev.txt
BUILD_MONAI=1 ./runtests.sh --build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .github/workflows/cron-mmar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
- name: Loading MMARs
run: |
# clean up temporary files
$(pwd)/runtests.sh --clean
$(pwd)/runtests.sh --build --clean
# run tests
python -m tests.ngc_mmar_loading
16 changes: 8 additions & 8 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage --unittests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
Expand All @@ -62,7 +62,7 @@ jobs:
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:21.02", "pytorch:21.10"] # 21.02 for backward comp.
container: ["pytorch:21.02", "pytorch:21.12"] # 21.02 for backward comp.
container:
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
Expand Down Expand Up @@ -91,8 +91,8 @@ jobs:
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage --unittests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
Expand All @@ -106,7 +106,7 @@ jobs:
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:21.02", "pytorch:21.10"] # 21.02 for backward comp.
container: ["pytorch:21.02", "pytorch:21.12"] # 21.02 for backward comp.
container:
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
Expand Down Expand Up @@ -190,8 +190,8 @@ jobs:
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
ngc --version
BUILD_MONAI=1 ./runtests.sh --coverage --pytype --unittests # unit tests with pytype checks, coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --pytype --unittests --disttests # unit tests with pytype checks, coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
which python
python -m pip install --upgrade pip wheel
python -m pip uninstall -y torch torchvision
python -m pip install torch==1.10.0+cu111 torchvision==0.11.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install -r requirements-dev.txt
- name: Run integration tests
run: |
Expand All @@ -46,8 +46,8 @@ jobs:
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --net
BUILD_MONAI=1 ./runtests.sh --unittests
BUILD_MONAI=1 ./runtests.sh --build --net
BUILD_MONAI=1 ./runtests.sh --build --unittests --disttests
if pgrep python; then pkill python; fi
shell: bash
- name: Add reaction
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/pythonapp-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,36 @@ jobs:
matrix:
environment:
- "PT17+CUDA102"
- "PT17+CUDA110"
- "PT18+CUDA102"
- "PT18+CUDA110"
- "PT18+CUDA112"
- "PT19+CUDA114"
- "PT110+CUDA115"
- "PT110+CUDA102"
include:
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
- environment: PT17+CUDA102
pytorch: "torch==1.7.1 torchvision==0.8.2"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT17+CUDA110
# we explicitly set pytorch to -h to avoid pip install error
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:20.09-py3"
- environment: PT18+CUDA102
pytorch: "torch==1.8.1 torchvision==0.9.1"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT18+CUDA110
- environment: PT18+CUDA112
# we explicitly set pytorch to -h to avoid pip install error
# 21.03: 1.9.0a0+df837d0
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.02-py3"
base: "nvcr.io/nvidia/pytorch:21.03-py3"
- environment: PT19+CUDA114
# we explicitly set pytorch to -h to avoid pip install error
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
# 21.10: 1.10.0a0+0aef44c
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.10-py3"
- environment: PT110+CUDA115
# we explicitly set pytorch to -h to avoid pip install error
# 21.12: 1.11.0a0+b6df043
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.12-py3"
- environment: PT110+CUDA102
pytorch: "torch==1.10.0 torchvision==0.11.1"
pytorch: "torch==1.10.1 torchvision==0.11.2"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
container:
image: ${{ matrix.base }}
Expand All @@ -61,7 +63,7 @@ jobs:
[ ${{ matrix.environment }} = "PT18+CUDA102" ] || \
[ ${{ matrix.environment }} = "PT110+CUDA102" ]
then
PYVER=3.6 PYSFX=3 DISTUTILS=python3-distutils && \
PYVER=3.7 PYSFX=3 DISTUTILS=python3-distutils && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
pkg-config \
Expand Down Expand Up @@ -122,7 +124,7 @@ jobs:
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
python -c "import monai; monai.config.print_config()"
# build for the current self-hosted CI Tesla V100
BUILD_MONAI=1 TORCH_CUDA_ARCH_LIST="7.0" ./runtests.sh --quick --unittests
BUILD_MONAI=1 TORCH_CUDA_ARCH_LIST="7.0" ./runtests.sh --build --quick --unittests --disttests
if [ ${{ matrix.environment }} = "PT110+CUDA102" ]; then
# test the clang-format tool downloading once
coverage run -m tests.clang_format_utils
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pythonapp-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ jobs:
- if: runner.os == 'windows'
name: Install torch cpu from pytorch.org (Windows only)
run: |
python -m pip install torch==1.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install torch==1.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install the dependencies
run: |
# min. requirements
python -m pip install torch==1.10.0
python -m pip install torch==1.10.1
python -m pip install -r requirements-min.txt
python -m pip list
BUILD_MONAI=0 python setup.py develop # no compile of extensions
Expand All @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
Expand All @@ -101,7 +101,7 @@ jobs:
- name: Install the dependencies
run: |
# min. requirements
python -m pip install torch==1.10.0
python -m pip install torch==1.10.1
python -m pip install -r requirements-min.txt
python -m pip list
BUILD_MONAI=0 python setup.py develop # no compile of extensions
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
- name: Lint and type check
run: |
# clean up temporary files
$(pwd)/runtests.sh --clean
$(pwd)/runtests.sh --build --clean
# Git hub actions have 2 cores, so parallize pytype
$(pwd)/runtests.sh --codeformat -j 2
$(pwd)/runtests.sh --build --codeformat -j 2
quick-py3: # full dependencies installed tests for different OS
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -87,10 +87,10 @@ jobs:
- if: runner.os == 'windows'
name: Install torch cpu from pytorch.org (Windows only)
run: |
python -m pip install torch==1.10.0+cpu torchvision==0.11.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install torch==1.10.1+cpu torchvision==0.11.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install the dependencies
run: |
python -m pip install torch==1.10.0 torchvision==0.11.1
python -m pip install torch==1.10.1 torchvision==0.11.2
cat "requirements-dev.txt"
python -m pip install -r requirements-dev.txt
python -m pip list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
python -m pip install --upgrade pip wheel
python -m pip uninstall -y torch torchvision
rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/ruamel*
python -m pip install torch==1.10.0 torchvision==0.11.1
python -m pip install torch==1.10.1 torchvision==0.11.2
python -m pip install -r requirements-dev.txt
- name: Run unit tests report coverage
run: |
Expand All @@ -59,8 +59,8 @@ jobs:
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage --unittests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
shell: bash
Expand All @@ -74,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -98,13 +98,13 @@ jobs:
- name: Install the dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install torch==1.10.0 torchvision==0.11.1
python -m pip install torch==1.10.1 torchvision==0.11.2
python -m pip install -r requirements-dev.txt
- name: Run quick tests CPU ubuntu
run: |
python -m pip list
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
BUILD_MONAI=1 ./runtests.sh --quick --unittests
BUILD_MONAI=1 ./runtests.sh --build --quick --unittests --disttests
coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v1
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -23,10 +23,10 @@ repos:
- id: detect-private-key

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.31.0
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]
name: Upgrade code
exclude: |
(?x)^(
Expand All @@ -35,7 +35,7 @@ repos:
)$
- repo: https://github.com/asottile/yesqa
rev: v1.2.3
rev: v1.3.0
hooks:
- id: yesqa
name: Unused noqa
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ python -m pip install -U -r requirements-dev.txt

License information: all source code files should start with this paragraph:
```
# Copyright <Year> MONAI Consortium
# Copyright (c) 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 @@ -113,7 +113,7 @@ or (for new features that would not break existing functionality):
```

It is recommended that the new test `test_[module_name].py` is constructed by using only
python 3.6+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
python 3.7+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
If it requires any other external packages, please make sure:
- the packages are listed in [`requirements-dev.txt`](requirements-dev.txt)
- the new test `test_[module_name].py` is added to the `exclude_cases` in [`./tests/min_tests.py`](./tests/min_tests.py) so that
Expand Down Expand Up @@ -228,7 +228,7 @@ Notably,
for example, ``import monai.transforms.Spacing`` is the equivalent of ``monai.transforms.spatial.array.Spacing`` if
``class Spacing`` defined in file `monai/transforms/spatial/array.py` is decorated with ``@export("monai.transforms")``.

For string definition, [f-string](https://www.python.org/dev/peps/pep-0498/) is recommended to use over `%-print` and `format-print` from python 3.6. So please try to use `f-string` if you need to define any string object.
For string definition, [f-string](https://www.python.org/dev/peps/pep-0498/) is recommended to use over `%-print` and `format-print`. So please try to use `f-string` if you need to define any string object.

#### Backwards compatibility
MONAI is currently under active development, and with major version zero (following the [Semantic Versioning](https://semver.org/)).
Expand Down
Loading

0 comments on commit dd74c59

Please sign in to comment.