-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #605 from AMYPAD/pip-pkg
ENH: Python package
- Loading branch information
Showing
8 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Thin wrapper around dcm2niix binary""" | ||
__author__ = "Casper da Costa-Luis <https://github.com/casperdcl>" | ||
__date__ = "2022" | ||
# version detector. Precedence: installed dist, git, 'UNKNOWN' | ||
try: | ||
from ._dist_ver import __version__ | ||
except ImportError: # pragma: nocover | ||
try: | ||
from setuptools_scm import get_version | ||
|
||
__version__ = get_version(root="../..", relative_to=__file__) | ||
except (ImportError, LookupError): | ||
__version__ = "UNKNOWN" | ||
__all__ = ['bin', 'bin_path', 'main'] | ||
|
||
from pathlib import Path | ||
|
||
bin_path = Path(__file__).resolve().parent / "dcm2niix" | ||
bin = str(bin_path) | ||
|
||
|
||
def main(args=None): | ||
if args is None: | ||
import sys | ||
args = sys.argv[1:] | ||
from subprocess import run | ||
run([bin] + args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import main | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", | ||
"scikit-build>=0.11.0", "cmake>=3.18", "ninja"] | ||
|
||
[tool.setuptools_scm] | ||
write_to = "dcm2niix/_dist_ver.py" | ||
write_to_template = "__version__ = '{version}'\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[metadata] | ||
name=dcm2niix | ||
description=DCM2NIIX Python package | ||
long_description=file: README.md | ||
long_description_content_type=text/markdown | ||
license_file=license.txt | ||
url=https://github.com/rordenlab/dcm2niix | ||
project_urls= | ||
Changelog=https://github.com/rordenlab/dcm2niix/releases | ||
Documentation=https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage | ||
author=Li X, Morgan PS, Ashburner J, Smith J, Rorden C | ||
maintainer=Casper da Costa-Luis | ||
maintainer_email[email protected] | ||
keywords=research, jpeg, dicom, neuroscience, mri, neuroimaging, nifti, dcm, nii, nitrc, bids, dcm2niix, mricrogl | ||
classifiers= | ||
Development Status :: 5 - Production/Stable | ||
Intended Audience :: Education | ||
Intended Audience :: Healthcare Industry | ||
Intended Audience :: Science/Research | ||
Operating System :: Microsoft :: Windows | ||
Operating System :: POSIX :: Linux | ||
Programming Language :: C++ | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3 :: Only | ||
Topic :: Scientific/Engineering :: Medical Science Apps. | ||
[options] | ||
setup_requires= | ||
setuptools>=42 | ||
wheel | ||
setuptools_scm[toml] | ||
scikit-build>=0.11.0 | ||
cmake>=3.18 | ||
ninja | ||
python_requires=>=3.6 | ||
[options.entry_points] | ||
console_scripts= | ||
dcm2niix=dcm2niix:main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Compile source code and setup Python 3 package""" | ||
import re | ||
from pathlib import Path | ||
|
||
from setuptools_scm import get_version | ||
from skbuild import setup | ||
|
||
__version__ = get_version(root=".", relative_to=__file__) | ||
build_ver = ".".join(__version__.split(".")[:3]).split(".dev")[0] | ||
for i in (Path(__file__).resolve().parent / "_skbuild").rglob("CMakeCache.txt"): | ||
i.write_text(re.sub("^//.*$\n^[^#].*pip-build-env.*$", "", i.read_text(), flags=re.M)) | ||
setup(use_scm_version=True, packages=["dcm2niix"], | ||
cmake_languages=("CXX",), cmake_minimum_required_version="3.18") |