Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

909 IO factory - develop ITKReader, NibabelReader, LoadImage #893

Merged
merged 45 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
59ba32d
Merge pull request #86 from Project-MONAI/master
Nic-Ma Jul 17, 2020
d00d0f5
Merge pull request #110 from Project-MONAI/master
Nic-Ma Aug 12, 2020
d002139
[DLMED] Add LoadImage transform
Nic-Ma Aug 12, 2020
496c390
[MONAI] python code formatting
monai-bot Aug 12, 2020
46ee38c
[DLMED] add logic to load affine
Nic-Ma Aug 14, 2020
60f6c3c
Merge branch 'master' into 856-refactor-IO-ITK
Nic-Ma Aug 14, 2020
7de3675
[MONAI] python code formatting
monai-bot Aug 14, 2020
f39ba1f
[DLMED] update according to comments
Nic-Ma Aug 14, 2020
a9acc9f
[MONAI] python code formatting
monai-bot Aug 14, 2020
4686724
[DLMED] update axis
Nic-Ma Aug 16, 2020
162c2e8
[DLMED] itk to optional import
Nic-Ma Aug 16, 2020
ac2874e
[DLMED] fix optional import issue
Nic-Ma Aug 16, 2020
2c1c244
[MONAI] python code formatting
monai-bot Aug 16, 2020
adceec8
[DLMED] fix flake8 issue
Nic-Ma Aug 16, 2020
774ed77
[DLMED] format code
Nic-Ma Aug 16, 2020
2fcd74b
[DLMED] add for test
Nic-Ma Aug 17, 2020
0b3eac7
[DLMED] test flake8
Nic-Ma Aug 17, 2020
60cf0f2
[DLMED] add unit tests
Nic-Ma Aug 17, 2020
1b7fb4c
[DLMED] remove test notebook
Nic-Ma Aug 17, 2020
b74197b
[MONAI] python code formatting
monai-bot Aug 17, 2020
be5b69c
[DLMED] restore notebooks
Nic-Ma Aug 17, 2020
c9ba20a
[DLMED] refactor image readers and load image transform
Nic-Ma Aug 19, 2020
1270df1
[DLMED] update LoadImage transform
Nic-Ma Aug 19, 2020
f0fe485
Merge branch 'master' into 856-refactor-IO-ITK
Nic-Ma Aug 19, 2020
21ba37d
[MONAI] python code formatting
monai-bot Aug 19, 2020
d7f3c18
[DLMED] fix packaging error
Nic-Ma Aug 19, 2020
1f5eb08
[DLMED] update according to comments
Nic-Ma Aug 20, 2020
63e65f7
Merge branch 'master' into 856-refactor-IO-ITK
Nic-Ma Aug 20, 2020
c1a2145
[DLMED] remove constructor of ImageReader
Nic-Ma Aug 20, 2020
cc15bda
Merge branch 'master' into 856-refactor-IO-ITK
Nic-Ma Aug 20, 2020
6da75e4
[DLMED] update read API
Nic-Ma Aug 20, 2020
ec64108
[MONAI] python code formatting
monai-bot Aug 20, 2020
8b939d2
[DLMED] ignore pytype issue
Nic-Ma Aug 20, 2020
705c2ef
Merge branch 'master' into 856-refactor-IO-ITK
Nic-Ma Aug 20, 2020
b7e08d6
[DLMED] fix typo
Nic-Ma Aug 20, 2020
2d906f8
[DLMED] fix typehints
Nic-Ma Aug 20, 2020
4e372fb
[MONAI] python code formatting
monai-bot Aug 20, 2020
3f27f45
[DLMED] fix typehints
Nic-Ma Aug 20, 2020
51af48d
[DLMED] fix pytype
Nic-Ma Aug 20, 2020
6ced0f0
[MONAI] python code formatting
monai-bot Aug 20, 2020
b9ff481
[DLMED] ignore itk error
Nic-Ma Aug 20, 2020
114e28b
[DLMED] fix mytype issue
Nic-Ma Aug 20, 2020
18758e6
fixes mypy errors
wyli Aug 20, 2020
76988b9
revert packaging pipeline
wyli Aug 20, 2020
8f2c6b5
Merge branch 'master' into 856-refactor-IO-ITK
wyli Aug 20, 2020
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
3 changes: 2 additions & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
python -m pip install torch==1.4 -f https://download.pytorch.org/whl/cpu/torch_stable.html
python -m pip install torchvision==0.5.0
# min. requirements for windows instances
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:11]); f.close()"
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:12]); f.close()"
- name: Install the dependencies
run: |
python -m pip install torch==1.4
Expand Down Expand Up @@ -205,6 +205,7 @@ jobs:
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
# fresh torch installation according to pyproject.toml
python -m pip install torch>=1.4 torchvision
python -m pip install -r requirements-dev.txt
- name: Test source archive and wheel file
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
torch>=1.4.0
pytorch-ignite==0.3.0
numpy>=1.17
itk
nibabel
parameterized
scikit-image>=0.14.2
Expand Down
14 changes: 14 additions & 0 deletions docs/source/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ Patch-based dataset
:members:


Image reader
------------

ITKReader
~~~~~~~~~
.. autoclass:: ITKReader
:members:

NibabelReader
~~~~~~~~~~~~~
.. autoclass:: NibabelReader
:members:


Nifti format handling
---------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ Since MONAI v0.2.0, the extras syntax such as `pip install 'monai[nibabel]'` is

- The options are
```
[nibabel, skimage, pillow, tensorboard, gdown, ignite]
[nibabel, skimage, pillow, tensorboard, gdown, ignite, itk]
```
which correspond to `nibabel`, `scikit-image`, `pillow`, `tensorboard`,
`gdown`, and `pytorch-ignite` respectively.
`gdown`, `pytorch-ignite`, and `itk` respectively.

- `pip install 'monai[all]'` installs all the optional dependencies.
12 changes: 12 additions & 0 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ Intensity
IO
^^

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

`LoadNifti`
"""""""""""
.. autoclass:: LoadNifti
Expand Down Expand Up @@ -630,6 +636,12 @@ IO (Dict)
:members:
:special-members: __call__

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

`LoadNiftid`
""""""""""""
.. autoclass:: LoadNiftid
Expand Down
18 changes: 18 additions & 0 deletions monai/config/deviceconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@
except (ImportError, AttributeError):
tensorboard_version = "NOT INSTALLED or UNKNOWN VERSION."

try:
import gdown

gdown_version = gdown.__version__
del gdown
except (ImportError, AttributeError):
gdown_version = "NOT INSTALLED or UNKNOWN VERSION."

try:
import itk

itk_version = itk.Version.GetITKVersion()
del itk
except (ImportError, AttributeError):
itk_version = "NOT INSTALLED or UNKNOWN VERSION."


def get_config_values():
"""
Expand All @@ -84,6 +100,8 @@ def get_optional_config_values():
output["scikit-image"] = skimage_version
output["Pillow"] = PIL_version
output["Tensorboard"] = tensorboard_version
output["gdown"] = gdown_version
output["ITK"] = itk_version

return output

Expand Down
1 change: 1 addition & 0 deletions monai/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .dataset import ArrayDataset, CacheDataset, Dataset, PersistentDataset, ZipDataset
from .decathalon_datalist import load_decathalon_datalist
from .grid_dataset import GridPatchDataset
from .image_reader import *
from .nifti_reader import NiftiDataset
from .nifti_saver import NiftiSaver
from .nifti_writer import write_nifti
Expand Down
Loading