Commit 82069c05 authored by Istvan N Huszar's avatar Istvan N Huszar
Browse files

Restructuring the tirl repository for FSL release

parent bfbeed66
# Changelog
### Upcoming
- FSL integration -> replaces TIRL v2.1.3b in FSL 6.0.4
- FSLeyes plugin for TImage files
### 6 June 2022 -- v3.1.0
- Added a changelog
- Changed: the tirl main menu
- Changed: tirl scripts are now installed as a separate package
- Changed: tirl config now points to a simplified YAML configuration file instead of settings.py
- Removed data files from the package
### June 2021 -- v3.0.0
- Rewrote the constructors for most TIRLObjects
- Rewrote the TImage class to support layers and a more intuitive handling of image resolution
- Added support for SharedMemory objects to handle big image/field data in multiprocessing
2021-06-01 INH
tensoroptest.py is not working at the moment
2021-05-31 INH
Allow TField dataobjects to be defined on shared memory if CPU > 1
Allow direct evaluation without copying to shared memory
---------> nested parallel spatial and tensor operators; allow direct use of SharedMemory
Make tensor assignment intuitive
Test high-level scripts
Complete three-stage framework
2021-05-30 INH
Tensor assignment is not intuitive
Chain passed between processes, which is dangerous
Data gets copied to shared memory and back when cpu > 1 --> slow
......@@ -7,14 +7,14 @@
#
# Tensor Image Registration Library
# Author: Istvan N. Huszar
# Copyright (C) 2018-2020 University of Oxford
# Copyright (C) 2018-2022 University of Oxford
# Part of the FMRIB Software Library (FSL)
FSL Licence
FMRIB Software Library, Release 6.0.4 (c) 2020, The University of Oxford
FMRIB Software Library, Release 6.0.5 (c) 2021, The University of Oxford
(the "Software")
The Software remains the property of the University of Oxford ("the
......
recursive-include share *
recursive-include tests *.py
\ No newline at end of file
include CHANGELOG.md
include LICENSE
include README.md
include requirements.txt
include setup.py
include tirl.yml
include tirlenv.yml
\ No newline at end of file
#!/bin/bash
# Copy share and test directories to the build directory
mkdir -p ${PREFIX}/lib/python${PY_VER}/site-packages/tirl/tests
cp -r $RECIPE_DIR/../tests ${PREFIX}/lib/python${PY_VER}/site-packages/tirl/
mkdir -p ${PREFIX}/lib/python${PY_VER}/site-packages/tirl/share
cp -r $RECIPE_DIR/../share ${PREFIX}/lib/python${PY_VER}/site-packages/tirl/
# Install the python package to the build directory
python setup.py install --single-version-externally-managed --record=record.txt
${PYTHON} -m pip install -vv --no-deps .
# Replace placeholders with the appropriate licensing information
python ${RECIPE_DIR}/replace.py ${PREFIX}
${PYTHON} ${RECIPE_DIR}/replace.py ${PREFIX}
# Copy share and test directories to the build directory
mkdir -p ${PREFIX}/data/tirl/
cp -r ./tests ${PREFIX}/data/tirl/
cp -r ./share ${PREFIX}/data/tirl/
{% set version = "2.2.1" %}
# This is a FSL conda recipe for: fsl-tirl
# The project git repository is: https://git.fmrib.ox.ac.uk/ihuszar/tirl.git
# The git repository for this conda recipe is: https://git.fmrib.ox.ac.uk/fsl/conda/fsl-tirl.git
{% set name = 'fsl-tirl' %}
{% set version = '3.1.0' %}
{% set repository = 'https://git.fmrib.ox.ac.uk/ihuszar/tirl.git' %}
{% set build = '3' %}
package:
name: tirl
version: {{ version }}
name: {{ name }}
version: {{ version }}
source:
path: ../
# the FSLCONDA_REPOSITORY and FSLCONDA_REVISION
# environment variables can be used to override
# the repository/revision for development purposes.
git_url: {{ os.environ.get("FSLCONDA_REPOSITORY", repository) }}
git_rev: {{ os.environ.get("FSLCONDA_REVISION", version) }}
requirements:
build:
- {{ compiler('cxx') }}
build:
number: {{ build }}
host:
- python
- cython
- numpy
- openblas
requirements:
host:
- python
- cython
- numpy
- liblapack
- liblapacke
- libblas
- libcblas
run:
- attrdict
- dask
- dill
- imagecodecs
- imageio
- joblib
- mayavi
- matplotlib
- nibabel
- nlopt
- numba
- numpy
- opencv
- openslide
- pillow
- psutil
- pygments
- python
- python-dateutil
- scikit-image
- scikit-learn
- scipy
- tifffile
run:
- attrdict
- dask
- dill
- ghalton
- imagecodecs
- imageio
- joblib
- mayavi
- matplotlib-base
- nibabel
- nlopt
- numba
- {{ pin_compatible('numpy') }}
- opencv
- openslide
- openslide-python
- pillow
- psutil
- pygments
- python
- python-dateutil
- scikit-image
- scikit-learn
- scipy
- tifffile
build:
- {{ compiler('cxx') }}
test:
imports:
- tirl
- tirl.fsl
- tirl.chain
- tirl.tfield
- tirl.timage
- tirl.domain
- tirl.point
- tirl.cmodules
- tirl.operations
- tirl.interpolators
- tirl.parameters
- tirl.transformations.basic
- tirl.transformations.linear
- tirl.transformations.nonlinear
- tirl.costs
- tirl.optimisation
- tirl.regularisers
- tirl.scripts
- tirl.tirlvision
- tirl.usermodules
imports:
- tirl
- tirl.fsl
- tirl.chain
- tirl.cmodules
- tirl.cost
- tirl.domain
- tirl.interpolation
- tirl.operations
- tirl.optimisation
- tirl.parameters
- tirl.regularisation
- tirl.tfield
- tirl.tirlvision
- tirl.timage
- tirl.transformations.linear
- tirl.transformations.nonlinear
commands:
- tirl home
- tirl version
- tirl info
- tirl module
- tirl histology_to_block
- tirl find_sites
- tirl block_to_slice
- tirl slice_to_volume
- tirl prepare_multi_stage3
- tirl combine
- tirl stripbg
- tirl extract_blocks
- tirl crop_centre
- tirl sliceview
commands:
- tirl home
- tirl version
- tirl info
- tirl module
- tirl histology_to_block
- tirl find_sites
- tirl block_to_slice
- tirl slice_to_volume
- tirl prepare_multi_stage3
- tirl combine
- tirl stripbg
- tirl extract_blocks
- tirl crop_centre
- tirl sliceview
about:
home: https://git.fmrib.ox.ac.uk/ihuszar/tirl/
license: FSL
license_file: LICENSE.txt
summary: Tensor Image Registration Library
dev_url: https://git.fmrib.ox.ac.uk/ihuszar/tirl/
home: https://git.fmrib.ox.ac.uk/ihuszar/tirl/
license: FSL
license_file: LICENSE.txt
summary: Tensor Image Registration Library
dev_url: https://git.fmrib.ox.ac.uk/ihuszar/tirl/
if [ -e ${FSLDIR}/etc/fslconf/requestFSLpythonLink.sh ]; then
$FSLDIR/etc/fslconf/requestFSLpythonLink.sh tirl
if [ -e ${FSLDIR}/share/fsl/sbin/createFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/createFSLWrapper tirl
fi
# Move the "share" directory if the package is installed in fslpython.
if [ ! -z ${FSLDIR} ]; then
case "$PREFIX" in
"${FSLDIR}"*)
mkdir -p ${FSLDIR}/data/tirl
sharedir=${FSLDIR}/data/tirl/share
mv ${PREFIX}/lib/python*/site-packages/tirl/share ${sharedir}
;;
*)
sharedir=$(echo "${PREFIX}/lib/python*/site-packages/tirl/share")
;;
esac
fi
testsdir=$(echo "${PREFIX}/lib/python*/site-packages/tirl/tests")
# Register the "share" and "tests" directory paths within TIRL
python -c "import tirl; tirl.set_sharedir(\"${sharedir}\")"
python -c "import tirl; tirl.set_testdir(\"${testsdir}\")"
tirldir="${PREFIX}/lib/python*/site-packages/tirl/"
sharedir="${PREFIX}/data/tirl/share"
testsdir="${PREFIX}/data/tirl/tests"
# Set the TIRLHOME environment variable
conda env config vars set TIRLHOME="`tirl home`"
sed -ie "s@^TIRLSHARE =.*@TIRLSHARE = '${sharedir}'@g" ${tirldir}/settings.py
sed -ie "s@^TIRLTESTS =.*@TIRLTESTS = '${testsdir}'@g" ${tirldir}/settings.py
if [ -e ${FSLDIR}/etc/fslconf/requestFSLpythonUnlink.sh ]; then
$FSLDIR/etc/fslconf/requestFSLpythonUnlink.sh tirl
if [ -e ${FSLDIR}/share/fsl/sbin/removeFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/removeFSLWrapper tirl
fi
......@@ -8,27 +8,35 @@
# | | _| |_ | | \ \ | |____
# |_| |_____| |_| \_\ |______|
#
# Copyright (C) 2018-2020 University of Oxford
# Copyright (C) 2018-2022 University of Oxford
# Part of the FMRIB Software Library (FSL)
# Author: Istvan N. Huszar
# SHBASECOPYRIGHT
import os
import shutil
import tirl
import numpy as np
from setuptools import setup, Extension, find_packages
import auxlib.packaging
from Cython.Build import cythonize
from tirl.settings import CONFIGFILE
from setuptools import setup, Extension, find_packages
#-------------------------------- C/C++ Modules -------------------------------#
# Field inversion (2D and 3D)
fieldinversion = \
Extension("tirl.cmodules.finv",
sources=["src/tirl/cmodules/finv2d_src.c",
"src/tirl/cmodules/finv3d_src.c",
"src/tirl/cmodules/finv.pyx"],
sources=["tirl/cmodules/finv2d_src.c",
"tirl/cmodules/finv3d_src.c",
"tirl/cmodules/finv.pyx"],
include_dirs=[np.get_include()],
extra_link_args=["-lopenblas", "-lgfortran"],
extra_link_args=[
"-llapacke", "-llapack", "-lcblas", "-lblas", "-lgfortran"],
extra_compile_args=["-std=c99"],
language="c")
......@@ -37,8 +45,8 @@ fieldinversion = \
# be an example of a C++ extension to TIRL.
fslinterpolator = \
Extension("tirl.cmodules.fslinterpolator",
sources=["src/tirl/cmodules/fslinterpolator_src.cpp",
"src/tirl/cmodules/fslinterpolator.pyx"],
sources=["tirl/cmodules/fslinterpolator_src.cpp",
"tirl/cmodules/fslinterpolator.pyx"],
extra_compile_args=["-fpermissive"],
language="c++")
......@@ -53,15 +61,29 @@ with open("requirements.txt", "r") as fp:
dependencies = [l.strip() for l in fp.readlines()]
# -------------------------------- User config --------------------------------#
configdir = os.path.dirname(CONFIGFILE)
if not os.path.isdir(configdir):
os.makedirs(configdir)
shutil.copy2("tirl.yml", CONFIGFILE)
#-------------------------------- TIRL Installer ------------------------------#
setup(name="tirl",
version="2.2.1",
description="Tensor Image Registration Library",
author="Istvan N. Huszar",
ext_modules=cython_modules,
install_requires=dependencies,
packages=find_packages("src"),
package_dir={"tirl": "src/tirl"},
scripts=["src/tirl/tirl"]
setup(
name="tirl",
version=tirl.__version__,
description="Tensor Image Registration Library",
author="Istvan N. Huszar",
ext_modules=cython_modules,
install_requires=dependencies,
packages=find_packages("."),
package_dir={"tirl": "tirl"},
include_package_data=True,
scripts=["tirl/tirl"],
cmdclass={
'build_py': auxlib.packaging.BuildPyCommand,
'sdist': auxlib.packaging.SDistCommand,
}
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment