Commit c7e23198 authored by inhuszar's avatar inhuszar
Browse files

Release version commit: v2.1.0b1

parent 9adaff1c
#!/usr/bin/env python
import os
import numpy as np
from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
from setuptools import setup, Extension, find_packages
conda_include = os.path.join(os.environ.get("CONDA_PREFIX"), "include")
#-------------------------------- C/C++ Modules -------------------------------#
# Field inversion 2D and 3D
module_finv2d = \
# Field inversion (2D and 3D)
fieldinversion = \
Extension("tirl.cmodules.finv",
sources=["tirl/cmodules/finv2d_src.c",
"tirl/cmodules/finv3d_src.c",
"tirl/cmodules/finv.pyx"],
include_dirs=[np.get_include(),
os.path.join(os.environ.get("CONDA_PREFIX"), "include"),
os.path.join(os.environ.get("CONDA_PREFIX"), "include", "gsl")],
include_dirs=[np.get_include(), conda_include],
extra_link_args=["-lcblas", "-lblas", "-llapacke"],
extra_compile_args=["-std=c99"],
language="c")
# File-to-file streaming (low memory utilisation on duplicating memory maps)
module_filestream = \
# File-to-file streaming (used to duplicate memory maps)
filestream = \
Extension("tirl.cmodules.filestream",
sources=["tirl/cmodules/filestream_src.c",
"tirl/cmodules/filestream.pyx"],
language="c")
# FSLInterpolator
# Example implementation of the linear interpolation that is used by FLIRT (FSL)
module_fslinterpolator = \
# Implements the linear interpolation routine of FLIRT (FSL). This is meant to
# be an example of a C++ extension to TIRL.
fslinterpolator = \
Extension("tirl.cmodules.fslinterpolator",
sources=["tirl/cmodules/fslinterpolator_src.cpp",
"tirl/cmodules/fslinterpolator.pyx"],
extra_compile_args=["-fpermissive"],
extra_link_args=[],
language="c++")
cython_modules = cythonize(
[module_filestream, module_finv2d, module_fslinterpolator],
compiler_directives={'embedsignature': True, 'language_level': "3"})
os.environ['CC'] = 'gcc'
os.environ['CXX'] = 'g++'
ext_modules = cython_modules
[filestream, fieldinversion, fslinterpolator],
compiler_directives={'embedsignature': True, 'language_level': "3"}
)
#------------------------------ External Libraries ----------------------------#
dependencies = ["attrdict", "cython", "dill", "ghalton", "imagecodecs",
"joblib", "matplotlib", "nibabel", "nlopt", "numpy",
"openslide-python", "psutil", "pillow", "pygments", "scipy",
"scikit-image", "tifffile"]
with open("requirements.txt", "r") as fp:
dependencies = [l.strip() for l in fp.readlines()]
#-------------------------------- TIRL Installer ------------------------------#
setup(name="tirl",
version="2.0",
author="Istvan N. Huszar",
version="2.1.0b1",
description="Tensor Image Registration Library",
ext_modules=ext_modules,
author="Istvan N. Huszar",
ext_modules=cython_modules,
install_requires=dependencies,
packages=["tirl",
"tirl/cmodules",
"tirl/costs",
"tirl/interpolators",
"tirl/operations",
"tirl/optimisation",
"tirl/regularisers",
"tirl/scripts",
"tirl/scripts/mnd",
"tirl/tirlvision",
"tirl/tirlvision/optimisers",
"tirl/transformations",
"tirl/transformations/basic",
"tirl/transformations/linear",
"tirl/transformations/nonlinear",
"tirl/usermodules"],
packages=find_packages(),
scripts=["tirl/tirl"]
)
......@@ -229,7 +229,7 @@ __author__ = "Istvan N. Huszar"
__copyright__ = "Copyright (C) 2018-2020 University of Oxford"
__credits__ = ["Mark Jenkinson"]
__license__ = "FSL"
__version__ = "2.1"
__version__ = "2.1.0b1"
__maintainer__ = "Istvan N Huszar"
__status__ = "active"
......
This diff is collapsed.
//
// Created by Istvan N Huszar on 22/05/2020.
//
#ifndef FINV_FINV2D3D_H
#define FINV_FINV2D3D_H
#include <lapacke.h>
// Basic math
double Dot3D(double v[], double u[]);
double* Cross(double v[], double u[]);
double* Difference3D(double v[], double u[]);
int* DifferenceInt3D(int v[], int u[]);
int Unravel3DIndex(int Index, int* Shape, int* MultiIndex);
int _lin(int* Shape, int i, int j, int k);
int Ravel3DIndex(int* MultiIndex, int* Shape);
lapack_int InvertMat3D(double* A, int N);
// 3D functions
int IsInTetrahedron(double* Point, double** Simplex);
int StepTetrahedron(int** Simplex, int Vertex, int* Shape);
int InitialiseTetrahedron(int ** Simplex, int* Shape);
int CalculateInverseWarp3D(int* InputShape,
double** FwdMappedCoordinates, int* OutputShape,
int* NearestNeighbour, double** InvWarp, int Iterations);
int CalculateLocalAffine3D(double** Locations,
int* NearestNeighbour, int N, int* InputShape,
double** Coordinates, double** FwdMappedCoordinates,
double** LocalAffine, int Iterations);
int CalculateTxJacobian3D(double** Locations, int* NearestNeighbour,
int N, int* InputShape, double** Coordinates,
double** Jacobian, int** VertexIndex, int Iterations);
int FillHoles3D(double** InvWarp, int* Shape, int MaxIter);
#endif //FINV_FINV2D3D_H
......@@ -707,7 +707,7 @@ class TxDisplacementField(TxNonLinear):
# input coordinates. In most neuroimaging libraries non-linear
# transformations are defined this way.
if signature is not None:
if hasattr(signature, "__iter__") and len(signature) >= 1:
strsig = signature[0](0) if callable(signature[0]) else signature[0]
else:
strsig = None
......
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