From b74447a4014fd148a8ad3874b4f73fac69fa5ac6 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:33:26 +0000 Subject: [PATCH 1/9] setup.py reads front page material from README.md instead of long_description.rst --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d420b471..fad23238 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ ' image-guided therapy' # Get the long description -with open('pip/long_description.rst') as f: +with open('README.md') as f: long_description = f.read() setup( From 5145ca5bf260a46b2d7849c55f8af2e07ff1dae2 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:34:08 +0000 Subject: [PATCH 2/9] Removed long_description.rst --- pip/long_description.rst | 158 --------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 pip/long_description.rst diff --git a/pip/long_description.rst b/pip/long_description.rst deleted file mode 100644 index 71735739..00000000 --- a/pip/long_description.rst +++ /dev/null @@ -1,158 +0,0 @@ -NiftyNet -======== - -NiftyNet is a `TensorFlow`_-based [#]_ open-source convolutional neural networks (CNN) platform for research in medical image analysis and image-guided therapy. -NiftyNet's modular structure is designed for sharing networks and pre-trained models. -Using this modular structure you can: - -* Get started with established pre-trained networks using built-in tools -* Adapt existing networks to your imaging data -* Quickly build new solutions to your own image analysis problems - -NiftyNet is a consortium of research organisations -(BMEIS -- `School of Biomedical Engineering and Imaging Sciences, King's College London`_; -WEISS -- `Wellcome EPSRC Centre for Interventional and Surgical Sciences, UCL`_; -CMIC -- `Centre for Medical Image Computing, UCL`_; -HIG -- High-dimensional Imaging Group, UCL), where BMEIS acts as the consortium lead. - -.. image:: https://badge.fury.io/py/NiftyNet.svg - :target: https://badge.fury.io/py/NiftyNet - -.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg - :target: https://github.com/NifTK/NiftyNet/blob/dev/LICENSE - -.. [#] Please install the appropriate `TensorFlow`_ PyPI package (``tensorflow`` or ``tensorflow-gpu``) **before** executing ``pip install niftynet`` -- see the instructions on the `NiftyNet source code repository`_ for details. - - -Features --------- - -* Easy-to-customise interfaces of network components -* Sharing networks and pretrained models -* Support for 2-D, 2.5-D, 3-D, 4-D inputs [#]_ -* Efficient discriminative training with multiple-GPU support -* Implementation of recent networks (HighRes3DNet, 3D U-net, V-net, DeepMedic) -* Comprehensive evaluation metrics for medical image segmentation - -**NiftyNet is not intended for clinical use**. - -NiftyNet release notes are available in the `changelog`_. - -.. _`changelog`: https://github.com/NifTK/NiftyNet/blob/dev/CHANGELOG.md - -.. [#] 2.5-D: volumetric images processed as a stack of 2D slices; 4-D: co-registered multi-modal 3D volumes - - -Getting started ---------------- - -Installation -^^^^^^^^^^^^ - -Please follow the `installation instructions`_. - -.. _`installation instructions`: http://niftynet.readthedocs.io/en/dev/installation.html - -Examples -^^^^^^^^ - -Please see the `NiftyNet demos`_. - -.. _`NiftyNet demos`: https://github.com/NifTK/NiftyNet/tree/dev/demos - -Network (re-)implementations -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Please see the list of `network (re-)implementations in NiftyNet`_. - -.. _`network (re-)implementations in NiftyNet`: https://github.com/niftk/NiftyNet/tree/dev/niftynet/network - -API documentation -^^^^^^^^^^^^^^^^^ - -The API reference is available on `Read the Docs`_. - -.. _`Read the Docs`: http://niftynet.rtfd.io/ - -Contributing -^^^^^^^^^^^^ - -Please see the `contribution guidelines`_ on the `NiftyNet source code repository`_. - -.. _`contribution guidelines`: https://github.com/niftk/NiftyNet/blob/dev/CONTRIBUTING.md - -Useful links -^^^^^^^^^^^^ - -`NiftyNet website`_ - -`NiftyNet source code on GitHub`_ - -NiftyNet mailing list: niftynet@googlegroups.com - - -.. _`NiftyNet website`: http://niftynet.io/ -.. _`NiftyNet source code on GitHub`: https://github.com/NifTK/NiftyNet - - -Citing NiftyNet ---------------- - -If you use NiftyNet in your work, please cite `Li et. al. 2017`_: - - Li W., Wang G., Fidon L., Ourselin S., Cardoso M.J., Vercauteren T. (2017) - `On the Compactness, Efficiency, and Representation of 3D Convolutional Networks: Brain Parcellation as a Pretext Task.`_ - In: Niethammer M. et al. (eds) Information Processing in Medical Imaging. IPMI 2017. - Lecture Notes in Computer Science, vol 10265. Springer, Cham. DOI: `10.1007/978-3-319-59050-9_28`_ - -BibTeX entry: - -.. code-block:: bibtex - - @InProceedings{niftynet17, - author = {Li, Wenqi and Wang, Guotai and Fidon, Lucas and Ourselin, Sebastien and Cardoso, M. Jorge and Vercauteren, Tom}, - title = {On the Compactness, Efficiency, and Representation of 3D Convolutional Networks: Brain Parcellation as a Pretext Task}, - booktitle = {International Conference on Information Processing in Medical Imaging (IPMI)}, - year = {2017} - } - -.. _`Li et. al. 2017`: http://doi.org/10.1007/978-3-319-59050-9_28 -.. _`On the Compactness, Efficiency, and Representation of 3D Convolutional Networks: Brain Parcellation as a Pretext Task.`: http://doi.org/10.1007/978-3-319-59050-9_28 -.. _`10.1007/978-3-319-59050-9_28`: http://doi.org/10.1007/978-3-319-59050-9_28 - - -Licensing and copyright ------------------------ - -NiftyNet is released under the Apache License, Version 2.0. -Please see the LICENSE file in the `NiftyNet source code repository`_ for details. - -Copyright 2018, the NiftyNet Consortium. - -Acknowledgements ----------------- - -This project is grateful for the support from the `Wellcome Trust`_, -the `Engineering and Physical Sciences Research Council (EPSRC)`_, -the `National Institute for Health Research (NIHR)`_, -the `Department of Health (DoH)`_, -`University College London (UCL)`_, -`King's College London (KCL)`_, -the `Science and Engineering South Consortium (SES)`_, -the `STFC Rutherford-Appleton Laboratory`_, and `NVIDIA`_. - -.. _`TensorFlow`: https://www.tensorflow.org/ -.. _`School of Biomedical Engineering and Imaging Sciences, King's College London`: https://www.kcl.ac.uk/lsm/research/divisions/imaging/index.aspx -.. _`Wellcome EPSRC Centre for Interventional and Surgical Sciences, UCL`: http://www.ucl.ac.uk/weiss -.. _`NiftyNet source code repository`: https://github.com/NifTK/NiftyNet -.. _`Centre for Medical Image Computing, UCL`: http://cmic.cs.ucl.ac.uk/ -.. _`Centre for Medical Image Computing (CMIC)`: http://cmic.cs.ucl.ac.uk/ -.. _`University College London (UCL)`: http://www.ucl.ac.uk/ -.. _`King's College London (KCL)`: http://www.kcl.ac.uk/ -.. _`Wellcome Trust`: https://wellcome.ac.uk/ -.. _`Engineering and Physical Sciences Research Council (EPSRC)`: https://www.epsrc.ac.uk/ -.. _`National Institute for Health Research (NIHR)`: https://www.nihr.ac.uk/ -.. _`Department of Health (DoH)`: https://www.gov.uk/government/organisations/department-of-health -.. _`Science and Engineering South Consortium (SES)`: https://www.ses.ac.uk/ -.. _`STFC Rutherford-Appleton Laboratory`: http://www.stfc.ac.uk/about-us/where-we-work/rutherford-appleton-laboratory/ -.. _`NVIDIA`: http://www.nvidia.com From 191f9ee4cf017c6302d1b5623979d4b2481e7b74 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:38:29 +0000 Subject: [PATCH 3/9] TEST (should not be merged to dev): changed camera-ready directory setting in CI script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5cd3f6d..ec28dd60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -515,7 +515,7 @@ pip-camera-ready: - source ci/findwheel.sh - echo $niftynet_wheel # Creat camera-ready folder if doesn't exist - - camera_ready_dir=/home/gitlab-runner/environments/niftynet/pip/camera-ready + - camera_ready_dir=/home/dzhoshkun/environments/niftynet/pip/camera-ready - mkdir -p $camera_ready_dir - ls -lrtha $camera_ready_dir # Clean up the camera-ready folder if already there From 8b386d257ab3c0221c844c751a78382f83de75e9 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:45:37 +0000 Subject: [PATCH 4/9] TEST (should not be merged to dev): using python 3 for bundling pip wheel --- ci/bundlewheel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/bundlewheel.sh b/ci/bundlewheel.sh index 1beb047e..523a7da1 100755 --- a/ci/bundlewheel.sh +++ b/ci/bundlewheel.sh @@ -4,7 +4,7 @@ rm -f $niftynet_dir/dist/*.whl # bundle installer -python setup.py bdist_wheel +python3 setup.py bdist_wheel # inform other scripts of wheel's location export niftynet_wheel=$(ls $niftynet_dir/dist/*.whl) # there will be only one file! From 132359c8800ceba7666645be44de1cb6cab2af7b Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:50:33 +0000 Subject: [PATCH 5/9] Using content type option to indicate long description is in markdown format --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fad23238..e7d6366a 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ ' image-guided therapy' # Get the long description -with open('README.md') as f: +with open('README.md', encoding='utf-8') as f: long_description = f.read() setup( @@ -23,6 +23,7 @@ description=description, long_description=long_description, + long_description_content_type='text/markdown', url='http://niftynet.io/', From 5743b4b185b5f889df36e94ea2df86b934ac0527 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 5 Feb 2019 15:52:16 +0000 Subject: [PATCH 6/9] update readthedocs --- doc/source/index.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index c94e857e..54297917 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -122,7 +122,7 @@ Resources `Model zoo repository`_ -Mailing list: niftynet@googlegroups.com +`NiftyNet Google Group / Mailing List`_ `Stack Overflow`_ (for general questions) @@ -131,6 +131,7 @@ Mailing list: niftynet@googlegroups.com .. _`Source code on GitHub`: https://github.com/NifTK/NiftyNet .. _`Model zoo repository`: https://github.com/NifTK/NiftyNetModelZoo/blob/master/README.md .. _`Stack Overflow`: https://stackoverflow.com/questions/tagged/niftynet +.. _`NiftyNet Google Group / Mailing List`: https://groups.google.com/forum/#!forum/niftynet APIs & reference @@ -188,7 +189,7 @@ If you use NiftyNet in your work, please cite `Gibson and Li, et al. 2017`_: E. Gibson*, W. Li*, C. Sudre, L. Fidon, D. I. Shakir, G. Wang, Z. Eaton-Rosen, R. Gray, T. Doel, Y. Hu, T. Whyntie, P. Nachev, M. Modat, - D. C. Barratt, S. Ourselin, M. J. Cardoso^ and T. Vercauteren^ 2017. + D. C. Barratt, S. Ourselin, M. J. Cardoso† and T. Vercauteren† 2017. `NiftyNet: a deep-learning platform for medical imaging.`_ Computer Methods and Programs in Biomedicine (2017). From c07729e96b05833ec0b1caad881f0ffadc857606 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:54:44 +0000 Subject: [PATCH 7/9] Revert "TEST (should not be merged to dev): using python 3 for bundling pip wheel" This reverts commit 8b386d257ab3c0221c844c751a78382f83de75e9. --- ci/bundlewheel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/bundlewheel.sh b/ci/bundlewheel.sh index 523a7da1..1beb047e 100755 --- a/ci/bundlewheel.sh +++ b/ci/bundlewheel.sh @@ -4,7 +4,7 @@ rm -f $niftynet_dir/dist/*.whl # bundle installer -python3 setup.py bdist_wheel +python setup.py bdist_wheel # inform other scripts of wheel's location export niftynet_wheel=$(ls $niftynet_dir/dist/*.whl) # there will be only one file! From 4c46213fa84c478fbcdf506c06813263f8a05681 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 5 Feb 2019 15:54:57 +0000 Subject: [PATCH 8/9] Revert "TEST (should not be merged to dev): changed camera-ready directory setting in CI script" This reverts commit 191f9ee4cf017c6302d1b5623979d4b2481e7b74. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec28dd60..a5cd3f6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -515,7 +515,7 @@ pip-camera-ready: - source ci/findwheel.sh - echo $niftynet_wheel # Creat camera-ready folder if doesn't exist - - camera_ready_dir=/home/dzhoshkun/environments/niftynet/pip/camera-ready + - camera_ready_dir=/home/gitlab-runner/environments/niftynet/pip/camera-ready - mkdir -p $camera_ready_dir - ls -lrtha $camera_ready_dir # Clean up the camera-ready folder if already there From 0d7c47ee1866a84bb6075a9f8e8dd029dd0124bb Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 5 Feb 2019 16:12:27 +0000 Subject: [PATCH 9/9] improved CI device selection and py2&3 --- .gitlab-ci.yml | 25 +++++++++++++++++++------ setup.py | 1 + tests/get_gpu_index.py | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5cd3f6d..7300db82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,6 @@ testjob: only: - master - dev - - merging-github-pr-269 - tags script: # !!kill coverage in case of hanging processes @@ -45,9 +44,6 @@ testjob: - python -c "import tensorflow as tf; from tensorflow.python.client import device_lib; print device_lib.list_local_devices()" - ls -la /dev | grep nvidia - - echo $(python tests/get_gpu_index.py) - - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) - # removing existing testing data - if [ -d models ]; then rm -r models; fi - if [ -d testing_data ]; then rm -r testing_data; fi @@ -80,6 +76,9 @@ testjob: - pip install -r requirements-gpu.txt + - echo $(python tests/get_gpu_index.py) + - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) + # check whether version command works # Git-clone: - python net_segment.py --version 2>&1 | grep -E 'NiftyNet.*version.*[0-9]+\.[0-9]+\.[0-9]+' @@ -167,6 +166,9 @@ testjob: - pip install coverage - pip install -r requirements-gpu.txt + - echo $(python tests/get_gpu_index.py) + - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) + - python net_download.py testing -r - coverage run -a --source . net_segment.py train -c config/highres3dnet_config.ini --batch_size=1 --num_threads=2 --queue_length=40 --max_iter=10 - coverage run -a --source . net_segment.py inference -c config/highres3dnet_config.ini --batch_size 8 --spatial_window_size 64,64,64 --queue_length 64 @@ -230,7 +232,6 @@ quicktest: except: - master - dev - - merging-github-pr-269 - tags - 147-revise-contribution-guidelines-to-include-github - 150-properly-format-the-bibtex-entry-to-the-ipmi-2017-paper-on-the-main-readme @@ -289,6 +290,10 @@ quicktest: - coverage erase # run only fast tests - pip install -r requirements-gpu.txt + + - echo $(python tests/get_gpu_index.py) + - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) + - python net_download.py testing -r - QUICKTEST=True coverage run -a --source . -m unittest discover -s "tests" -p "*_test.py" - coverage report --omit='niftynet-dev-test*' -m @@ -307,7 +312,7 @@ pip-installer: only: - master - dev - - merging-github-pr-269 + - release-v0.5.0 - tags script: # get the shortened version of last commit's hash @@ -343,6 +348,10 @@ pip-installer: # NiftyNet console entries should fail gracefully if TF not installed # i.e. check that the warning displays the TF website - cd $niftynet_dir + + - echo $(python tests/get_gpu_index.py) + - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) + - set +e - python -c "import niftynet" 2>&1 | grep "https://www.tensorflow.org/" - set -e @@ -443,6 +452,10 @@ pip-installer: # NiftyNet console entries should fail gracefully if TF not installed # i.e. check that the warning displays the TF website - cd $niftynet_dir + + - echo $(python tests/get_gpu_index.py) + - export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py) + - set +e - python -c "import niftynet" 2>&1 | grep "https://www.tensorflow.org/" - set -e diff --git a/setup.py b/setup.py index e7d6366a..e53f71d8 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages +from io import open import versioneer from niftynet.utilities.versioning import get_niftynet_version diff --git a/tests/get_gpu_index.py b/tests/get_gpu_index.py index f8191aa1..e5971c38 100755 --- a/tests/get_gpu_index.py +++ b/tests/get_gpu_index.py @@ -10,7 +10,7 @@ p3 = Popen(['sed', 's: MiB::'], stdin=p2.stdout, stdout=PIPE) output, error = p3.communicate() -free_memory = [float(x) for x in output.split('\n')[:-1]] +free_memory = [float(x) for x in output.decode('utf-8').split('\n')[:-1]] if free_memory[1] > free_memory[0]: print('1') else: