Skip to content

Commit

Permalink
Merge pull request #27 from jcreinhold/publish-pypi-1
Browse files Browse the repository at this point in the history
Publish to pypi
  • Loading branch information
jcreinhold committed Mar 16, 2021
2 parents c7179d2 + 0b94eb5 commit c6fa419
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_install:
- conda update --yes conda
- chmod 755 create_env.sh
install:
- travis_retry . ./create_env.sh --antspy
- travis_retry . ./create_env.sh
- python --version
- which python
- pip --version
Expand Down
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Requirements
We have provided a script `create_env.sh` to create a conda environment with the necessary packages
(run like: `. ./create_env.sh`, this package will be installed in the created environment)

Basic Usage
-----------
Install
-------

The easiest way to install the package is through the following command:

pip install git+git://github.com/jcreinhold/intensity-normalization.git
pip install intensity-normalization

To install from the source directory, use

Expand All @@ -67,27 +67,18 @@ To install from the source directory, use
or (if you actively want to make changes to the package)

python setup.py develop

and use the several provided command line scripts to interface with the package,

Basic Usage
-----------

You can use the several provided command line scripts to interface with the package,
e.g.,

fcm-normalize -i t1/ -m masks/ -o test_fcm -v

where `t1/` is a directory full of N T1-w images and `masks/` is a directory full of N corresponding brain masks,
`test_fcm` is the output directory for the normalized images, and `-v` controls the verbosity of the output.

Note the package [antspy](https://github.com/ANTsX/ANTsPy) is required for the RAVEL normalization routine, the
preprocessing tool as well as the co-registration tool, but all other normalization and processing tools work without it.
To also install the antspy package either append `--antspy` to your call to `setup.py` or `create_env.sh`.

To use the convenience pre-processing scripts, install the package with the following command:

python setup.py install --antspy --preprocess

or

python setup.py develop --antspy --preprocess

The command line interface is standard across all normalization routines (i.e., you should be able to
run all normalization routines with the same call as in the above example); however, each has unique options
and not all methods support single image processing.
Expand Down Expand Up @@ -131,9 +122,8 @@ If you use the `intensity-normalization` package in an academic paper, please ci
volume={10949},
pages={109493H},
year={2019},
organization={International Society for Optics and Photonics}
}
organization={International Society for Optics and Photonics}}

References
----------

Expand Down
4 changes: 2 additions & 2 deletions create_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ conda install -c conda-forge "${conda_forge_packages[@]}" -y

if $ANTSPY; then
pip install antspyx=0.2.4
python setup.py install --antspy --preprocess
python setup.py install
else
python setup.py install --preprocess
python setup.py install
fi

echo "intensity_normalization conda env script finished"
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
62 changes: 62 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[metadata]
name = intensity-normalization-jcreinhold
version = 1.4.4
author = Jacob Reinhold
author_email = jcreinhold@gmail.com
description = Normalize the intensity of MR images
long_description = file: README.md
long_description_content_type = text/markdown
license = Apache License 2.0
url = https://github.com/jcreinhold/intensity-normalization
project_urls =
Bug Tracker = https://github.com/jcreinhold/intensity-normalization/issues
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering :: Medical Science Apps.

[options]
package_dir =
= intensity_normalization
packages = find:
exclude =
tests
docs
tutorials
python_requires = >=3.6
install_requires =
antspyx
matplotlib
nibabel
numpy
scikit-image
scikit-learn
scikit-fuzzy
scipy
statsmodels

[options.packages.find]
where = intensity_normalization

[options.entry_points]
console_scripts =
fcm-normalize = intensity_normalization.exec.fcm_normalize:main
gmm-normalize = intensity_normalization.exec.gmm_normalize:main
nyul-normalize = intensity_normalization.exec.nyul_normalize:main
kde-normalize = intensity_normalization.exec.kde_normalize:main
ws-normalize = intensity_normalization.exec.ws_normalize:main
zscore-normalize = intensity_normalization.exec.zscore_normalize:main
ravel-normalize = intensity_normalization.exec.ravel_normalize:main
lsq-normalize = intensity_normalization.exec.lsq_normalize:main
plot-hists = intensity_normalization.exec.plot_hists:main
preprocess = intensity_normalization.exec.preprocess:main
coregister = intensity_normalization.exec.coregister:main
tissue-mask = intensity_normalization.exec.tissue_mask:main
norm-quality = intensity_normalization.exec.norm_quality:main
72 changes: 2 additions & 70 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup
import setuptools

Module installs intensity-normalization package
Can be run via command: python setup.py install (or develop)
Author: Jacob Reinhold (jacob.reinhold@jhu.edu)
Created on: Apr 24, 2018
"""

from setuptools import setup, find_packages
from sys import platform
import sys

custom_args = sys.argv[2:].copy()
del sys.argv[2:]

install_antspy = '--antspy' in custom_args
link_preprocess = '--preprocess' in custom_args

console_scripts = ['fcm-normalize=intensity_normalization.exec.fcm_normalize:main',
'gmm-normalize=intensity_normalization.exec.gmm_normalize:main',
'nyul-normalize=intensity_normalization.exec.nyul_normalize:main',
'kde-normalize=intensity_normalization.exec.kde_normalize:main',
'ws-normalize=intensity_normalization.exec.ws_normalize:main',
'zscore-normalize=intensity_normalization.exec.zscore_normalize:main',
'ravel-normalize=intensity_normalization.exec.ravel_normalize:main',
'lsq-normalize=intensity_normalization.exec.lsq_normalize:main',
'plot-hists=intensity_normalization.exec.plot_hists:main']

if link_preprocess: console_scripts.extend(['preprocess=intensity_normalization.exec.preprocess:main',
'coregister=intensity_normalization.exec.coregister:main',
'tissue-mask=intensity_normalization.exec.tissue_mask:main',
'norm-quality=intensity_normalization.exec.norm_quality:main'])

with open('README.md', encoding="utf-8") as f:
readme = f.read()

with open('LICENSE', encoding="utf-8") as f:
license = f.read()

if platform not in ["linux", "linux32", "darwin"] and install_antspy:
raise Exception('antspy package only supports linux and OS X, must install without antspy option')

args = dict(
name='intensity-normalization',
version='1.4.4',
description="Normalize the intensity values of MR images",
long_description=readme,
author='Jacob Reinhold',
author_email='jacob.reinhold@jhu.edu',
url='https://gitlab.com/jcreinhold/intensity-normalization',
license=license,
packages=find_packages(exclude=('tests', 'docs', 'tutorials')),
entry_points={
'console_scripts': console_scripts
},
keywords="mr intensity normalization",
)

setup(install_requires=['matplotlib',
'nibabel',
'numpy',
'scikit-image',
'scikit-learn',
'scikit-fuzzy',
'scipy',
'statsmodels'] + ['antspyx'] if install_antspy else [], **args)
setuptools.setup()

0 comments on commit c6fa419

Please sign in to comment.