2022-04-08T11:11:25,341 Created temporary directory: /tmp/pip-ephem-wheel-cache-clxop7xu 2022-04-08T11:11:25,347 Created temporary directory: /tmp/pip-req-tracker-xtm8fgqm 2022-04-08T11:11:25,348 Initialized build tracking at /tmp/pip-req-tracker-xtm8fgqm 2022-04-08T11:11:25,348 Created build tracker: /tmp/pip-req-tracker-xtm8fgqm 2022-04-08T11:11:25,348 Entered build tracker: /tmp/pip-req-tracker-xtm8fgqm 2022-04-08T11:11:25,350 Created temporary directory: /tmp/pip-wheel-qrnv_8wt 2022-04-08T11:11:25,418 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 2022-04-08T11:11:25,426 2 location(s) to search for versions of mdreg: 2022-04-08T11:11:25,426 * https://pypi.org/simple/mdreg/ 2022-04-08T11:11:25,426 * https://www.piwheels.org/simple/mdreg/ 2022-04-08T11:11:25,428 Fetching project page and analyzing links: https://pypi.org/simple/mdreg/ 2022-04-08T11:11:25,429 Getting page https://pypi.org/simple/mdreg/ 2022-04-08T11:11:25,432 Found index url https://pypi.org/simple 2022-04-08T11:11:25,541 Skipping link: No binaries permitted for mdreg: https://files.pythonhosted.org/packages/bc/10/c83070f17306c03d644c7c76d8859872032edc1fc0df2a97380d4e93d708/mdreg-0.3.0-py3-none-any.whl#sha256=76d01b7c8b72d51decaaa5d64f040e8eb72037e15e17105cf8d1a84546559e46 (from https://pypi.org/simple/mdreg/) (requires-python:>=3.6, <4) 2022-04-08T11:11:25,543 Found link https://files.pythonhosted.org/packages/78/c8/ba73412c97b1eedd387919d54687fb19b22173a3ba98a9a77136320259eb/mdreg-0.3.0.tar.gz#sha256=7dc7854f0140d370e408b03eed00b9a8be51b382bd5ee60a10aea58706a2206b (from https://pypi.org/simple/mdreg/) (requires-python:>=3.6, <4), version: 0.3.0 2022-04-08T11:11:25,544 Skipping link: No binaries permitted for mdreg: https://files.pythonhosted.org/packages/6b/67/cd996be7b682acd1e126cc4e01f6f267fbfff5a7e5fca5c51e065c7b4497/mdreg-0.3.1-py3-none-any.whl#sha256=e3582f07ac52f4ad5b334091e8e595b32bcfb8c67c7e456920bb82eea4ba5ad4 (from https://pypi.org/simple/mdreg/) (requires-python:>=3.6, <4) 2022-04-08T11:11:25,545 Found link https://files.pythonhosted.org/packages/eb/8b/0358e3454beda70f4259a4d86932f6e072225039955f5a20d39144173ede/mdreg-0.3.1.tar.gz#sha256=8f5b490139cbe17e3c0bc07922cd8dbe529740485daf98ed0e594715236837e9 (from https://pypi.org/simple/mdreg/) (requires-python:>=3.6, <4), version: 0.3.1 2022-04-08T11:11:25,546 Fetching project page and analyzing links: https://www.piwheels.org/simple/mdreg/ 2022-04-08T11:11:25,547 Getting page https://www.piwheels.org/simple/mdreg/ 2022-04-08T11:11:25,549 Found index url https://www.piwheels.org/simple 2022-04-08T11:11:25,771 Skipping link: not a file: https://www.piwheels.org/simple/mdreg/ 2022-04-08T11:11:25,772 Skipping link: not a file: https://pypi.org/simple/mdreg/ 2022-04-08T11:11:25,805 Given no hashes to check 1 links for project 'mdreg': discarding no candidates 2022-04-08T11:11:25,836 Collecting mdreg==0.3.1 2022-04-08T11:11:25,841 Created temporary directory: /tmp/pip-unpack-1k7hyyv9 2022-04-08T11:11:26,067 Downloading mdreg-0.3.1.tar.gz (21 kB) 2022-04-08T11:11:26,193 Added mdreg==0.3.1 from https://files.pythonhosted.org/packages/eb/8b/0358e3454beda70f4259a4d86932f6e072225039955f5a20d39144173ede/mdreg-0.3.1.tar.gz#sha256=8f5b490139cbe17e3c0bc07922cd8dbe529740485daf98ed0e594715236837e9 to build tracker '/tmp/pip-req-tracker-xtm8fgqm' 2022-04-08T11:11:26,195 Running setup.py (path:/tmp/pip-wheel-qrnv_8wt/mdreg_7450a7b9a1a0470c9b22182853ef0e83/setup.py) egg_info for package mdreg 2022-04-08T11:11:26,196 Created temporary directory: /tmp/pip-pip-egg-info-moq81xr8 2022-04-08T11:11:26,197 Preparing metadata (setup.py): started 2022-04-08T11:11:26,199 Running command python setup.py egg_info 2022-04-08T11:11:27,866 Traceback (most recent call last): 2022-04-08T11:11:27,868 File "", line 36, in 2022-04-08T11:11:27,868 File "", line 34, in 2022-04-08T11:11:27,869 File "/tmp/pip-wheel-qrnv_8wt/mdreg_7450a7b9a1a0470c9b22182853ef0e83/setup.py", line 13, in 2022-04-08T11:11:27,869 with open('requirements.txt', encoding='utf-8') as f: 2022-04-08T11:11:27,870 FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt' 2022-04-08T11:11:27,870 # Description 2022-04-08T11:11:27,871 Python implementation of model-based image coregistration 2022-04-08T11:11:27,871 for quantitative medical imaging applications. 2022-04-08T11:11:27,872 The distribution comes with a number of common signal models and uses [ITK-Elastix](https://github.com/InsightSoftwareConsortium/ITKElastix) for deformable image registration. 2022-04-08T11:11:27,873 ## Installation 2022-04-08T11:11:27,874 Run `pip install mdreg`. 2022-04-08T11:11:27,875 ## Example data 2022-04-08T11:11:27,875 Example data in [DICOM format](https://shorturl.at/rwCUV) are provided for testing the setup. 2022-04-08T11:11:27,876 ## How to use 2022-04-08T11:11:27,877 Input data must be image arrays in numpy format, with dimensions `(x,y,z,t)` or `(x,y,t)`. 2022-04-08T11:11:27,877 To perform MDR on an image array `im` with default settings do: 2022-04-08T11:11:27,878 ```python 2022-04-08T11:11:27,878 from mdreg import MDReg 2022-04-08T11:11:27,879 mdr = MDReg() 2022-04-08T11:11:27,880 mdr.set_array(im) 2022-04-08T11:11:27,880 mdr.fit() 2022-04-08T11:11:27,880 ``` 2022-04-08T11:11:27,881 When fitting is complete the motion-corrected data are in `mdr.coreg` in the same dimensions 2022-04-08T11:11:27,882 as the original `im`. The calculated deformation fields in format `(x,y,d,t)` or `(x,y,z,d,t)` 2022-04-08T11:11:27,882 can be found as `mdr.deformation`. The dimension `d` holds `x`, `y` components 2022-04-08T11:11:27,882 of the deformation field, and a third `z` component if the input array is 3D. 2022-04-08T11:11:27,883 The default settings will apply a linear signal model and coregistration 2022-04-08T11:11:27,884 as defined in the elastix parameter file `Bsplines.txt`. 2022-04-08T11:11:27,885 # Customization 2022-04-08T11:11:27,885 MDR can be configured to apply different signal models and elastix coregistration settings. 2022-04-08T11:11:27,886 A number of example models and alternative elastix parameter files are included 2022-04-08T11:11:27,886 in the distribution as templates. 2022-04-08T11:11:27,887 The following example fits a mono-exponential decay, uses a mask `im_mask` for co-registration and applies an elastix parameter file `par_file` optimized for a previous DTI-MRI study: 2022-04-08T11:11:27,888 ```python 2022-04-08T11:11:27,889 from mdreg import MDReg 2022-04-08T11:11:27,889 from mdreg.models import exponential_decay 2022-04-08T11:11:27,890 mdr = MDReg() 2022-04-08T11:11:27,890 mdr.set_array(im) 2022-04-08T11:11:27,891 mdr.set_mask(im_mask) 2022-04-08T11:11:27,891 mdr.signal_model = exponential_decay 2022-04-08T11:11:27,892 mdr.read_elastix(par_file) 2022-04-08T11:11:27,892 mdr.fit() 2022-04-08T11:11:27,892 ``` 2022-04-08T11:11:27,893 `im_mask` must be a binary (0s and 1s) or boolean (Trues and Falses) image array in numpy format with the same dimensions as `im`. 2022-04-08T11:11:27,894 The signal model often depends on fixed constants and signal parameters 2022-04-08T11:11:27,894 such as sequence parameters in MRI, or patient-specific constants. These 2022-04-08T11:11:27,894 should all be grouped in a list and set before running the signal model. 2022-04-08T11:11:27,895 Equally elastix parameters can be fine tuned, either by importing a 2022-04-08T11:11:27,896 dedicated elastix file, or by modifying the settings. 2022-04-08T11:11:27,897 You may also choose if you wish to run the process in multiple cores (`parallel`) and to print the co-registration progress to the terminal plus a text file (`log`) or not. 2022-04-08T11:11:27,898 Then, a number of parameters are available to optimize MDR such as 2022-04-08T11:11:27,898 the precision (stopping criterion) and maximum number of iterations. 2022-04-08T11:11:27,899 Some examples: 2022-04-08T11:11:27,900 ```python 2022-04-08T11:11:27,900 from mdreg import MDReg 2022-04-08T11:11:27,901 from mdreg.models import exponential_decay 2022-04-08T11:11:27,902 t = [0.0, 1.25, 2.50, 3.75] # time points for exponential in sec 2022-04-08T11:11:27,902 mdr = MDReg() 2022-04-08T11:11:27,903 mdr.set_array(im) 2022-04-08T11:11:27,903 mdr.signal_parameters = t 2022-04-08T11:11:27,904 mdr.signal_model = exponential_decay 2022-04-08T11:11:27,904 mdr.set_elastix(MaximumNumberOfIterations = 256) # change defaults 2022-04-08T11:11:27,904 mdr.precision = 0.5 # default = 1 2022-04-08T11:11:27,905 mdr.max_iterations = 3 # default = 5 2022-04-08T11:11:27,905 mdr.parallel = False # default = True 2022-04-08T11:11:27,906 mdr.log = True # default = False 2022-04-08T11:11:27,906 mdr.fit() 2022-04-08T11:11:27,907 ``` 2022-04-08T11:11:27,907 `mdreg` comes with a number of options to 2022-04-08T11:11:27,908 export results and diagnostics: 2022-04-08T11:11:27,909 ```python 2022-04-08T11:11:27,909 mdr.export_unregistered = True # export parameters and fit without registration 2022-04-08T11:11:27,910 mdr.export_path = filepath # default is a results folder in the current working directory 2022-04-08T11:11:27,910 mdr.export() # export results after calling fit. 2022-04-08T11:11:27,911 ``` 2022-04-08T11:11:27,912 This export creates movies of original images, motion corrected images, 2022-04-08T11:11:27,912 modelfits, and maps of the fitted parameters. 2022-04-08T11:11:27,913 # Model fitting without motion correction 2022-04-08T11:11:27,914 `MDReg` also can be used to perform model fitting 2022-04-08T11:11:27,914 without correcting the motion. The following script 2022-04-08T11:11:27,915 fits a linearised exponential model to each pixel and exports data 2022-04-08T11:11:27,915 of model and fit: 2022-04-08T11:11:27,916 ```python 2022-04-08T11:11:27,916 from mdreg import MDReg 2022-04-08T11:11:27,917 from mdreg.models import exponential_decay 2022-04-08T11:11:27,918 mdr = MDReg() 2022-04-08T11:11:27,918 mdr.set_array(im) 2022-04-08T11:11:27,918 mdr.signal_model = linear_exponential_decay 2022-04-08T11:11:27,919 mdr.fit_signal() 2022-04-08T11:11:27,919 mdr.export_data() 2022-04-08T11:11:27,920 mdr.export_fit() 2022-04-08T11:11:27,920 ``` 2022-04-08T11:11:27,921 # Defining new MDR models 2022-04-08T11:11:27,922 A model must be defined as a separate module or class with two required functions `main()` and `pars()`. 2022-04-08T11:11:27,922 `pars()` must return a list of strings specifying the names of the model parameters. 2022-04-08T11:11:27,923 `main(im, const)` performs the pixel based model fitting and has two required arguments. 2022-04-08T11:11:27,923 `im` is a numpy ndarray with dimensions `(x,y,z,t)`, `(x,y,t)` or `(x,t)`. `const` is a list 2022-04-08T11:11:27,924 of any constant model parameters. 2022-04-08T11:11:27,924 The function must return the fit to the model as an numpy ndarray with the same dimensions 2022-04-08T11:11:27,925 as `im`, and an ndarray `pars` with dimensions `(x,y,z,p)`, `(x,y,p)` or `(x,p)`. Here `p` enumerates 2022-04-08T11:11:27,925 the model parameters. 2022-04-08T11:11:27,926 ## Context 2022-04-08T11:11:27,926 `mdreg` was first developed for use in quantitative renal MRI in the iBEAt study, 2022-04-08T11:11:27,927 and validated against group-wise model-free registration 2022-04-08T11:11:27,927 (Tagkalakis F, et al. Model-based motion correction outperforms a model-free method in quantitative renal MRI. Abstract-1383, ISMRM 2021). 2022-04-08T11:11:27,928 ## Acknowledgement 2022-04-08T11:11:27,928 The iBEAt study is part of the BEAt-DKD project. The BEAt-DKD project has received funding from the Innovative Medicines Initiative 2 Joint Undertaking under grant agreement No 115974. This Joint Undertaking receives support from the European Union’s Horizon 2020 research and innovation programme and EFPIA with JDRF. For a full list of BEAt-DKD partners, see www.beat-dkd.eu. 2022-04-08T11:11:27,929 ## Authors 2022-04-08T11:11:27,929 Kanishka Sharma, Joao Almeida e Sousa, Steven Sourbron 2022-04-08T11:11:27,974 ERROR: [present-diagnostic] python setup.py egg_info exited with 1 2022-04-08T11:11:28,021 [bold magenta]full command[/]: [blue]/usr/bin/python3 -c ' 2022-04-08T11:11:28,021 exec(compile('"'"''"'"''"'"' 2022-04-08T11:11:28,021 # This is -- a caller that pip uses to run setup.py 2022-04-08T11:11:28,021 # 2022-04-08T11:11:28,021 # - It imports setuptools before invoking setup.py, to enable projects that directly 2022-04-08T11:11:28,021 # import from `distutils.core` to work with newer packaging standards. 2022-04-08T11:11:28,021 # - It provides a clear error message when setuptools is not installed. 2022-04-08T11:11:28,021 # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so 2022-04-08T11:11:28,021 # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning: 2022-04-08T11:11:28,021 # manifest_maker: standard file '"'"'-c'"'"' not found". 2022-04-08T11:11:28,021 # - It generates a shim setup.py, for handling setup.cfg-only projects. 2022-04-08T11:11:28,021 import os, sys, tokenize 2022-04-08T11:11:28,021 2022-04-08T11:11:28,021 try: 2022-04-08T11:11:28,021 import setuptools 2022-04-08T11:11:28,021 except ImportError as error: 2022-04-08T11:11:28,021 print( 2022-04-08T11:11:28,021 "ERROR: Can not execute `setup.py` since setuptools is not available in " 2022-04-08T11:11:28,021 "the build environment.", 2022-04-08T11:11:28,021 file=sys.stderr, 2022-04-08T11:11:28,021 ) 2022-04-08T11:11:28,021 sys.exit(1) 2022-04-08T11:11:28,021 2022-04-08T11:11:28,021 __file__ = %r 2022-04-08T11:11:28,021 sys.argv[0] = __file__ 2022-04-08T11:11:28,021 2022-04-08T11:11:28,021 if os.path.exists(__file__): 2022-04-08T11:11:28,021 filename = __file__ 2022-04-08T11:11:28,021 with tokenize.open(__file__) as f: 2022-04-08T11:11:28,021 setup_py_code = f.read() 2022-04-08T11:11:28,021 else: 2022-04-08T11:11:28,021 filename = "" 2022-04-08T11:11:28,021 setup_py_code = "from setuptools import setup; setup()" 2022-04-08T11:11:28,021 2022-04-08T11:11:28,021 exec(compile(setup_py_code, filename, "exec")) 2022-04-08T11:11:28,021 '"'"''"'"''"'"' % ('"'"'/tmp/pip-wheel-qrnv_8wt/mdreg_7450a7b9a1a0470c9b22182853ef0e83/setup.py'"'"',), "", "exec"))' egg_info --egg-base /tmp/pip-pip-egg-info-moq81xr8[/] 2022-04-08T11:11:28,022 [bold magenta]cwd[/]: /tmp/pip-wheel-qrnv_8wt/mdreg_7450a7b9a1a0470c9b22182853ef0e83/ 2022-04-08T11:11:28,022 Preparing metadata (setup.py): finished with status 'error' 2022-04-08T11:11:28,025 ERROR: [present-diagnostic] metadata generation failed 2022-04-08T11:11:28,039 Exception information: 2022-04-08T11:11:28,039 Traceback (most recent call last): 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/build/metadata_legacy.py", line 68, in generate_metadata 2022-04-08T11:11:28,039 spinner=spinner, 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/subprocess.py", line 224, in call_subprocess 2022-04-08T11:11:28,039 raise error 2022-04-08T11:11:28,039 pip._internal.exceptions.InstallationSubprocessError: python setup.py egg_info exited with 1 2022-04-08T11:11:28,039 2022-04-08T11:11:28,039 The above exception was the direct cause of the following exception: 2022-04-08T11:11:28,039 2022-04-08T11:11:28,039 Traceback (most recent call last): 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper 2022-04-08T11:11:28,039 status = run_func(*args) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper 2022-04-08T11:11:28,039 return func(self, options, args) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/wheel.py", line 145, in run 2022-04-08T11:11:28,039 requirement_set = resolver.resolve(reqs, check_supported_wheels=True) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve 2022-04-08T11:11:28,039 collected.requirements, max_rounds=try_to_avoid_resolution_too_deep 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve 2022-04-08T11:11:28,039 state = resolution.resolve(requirements, max_rounds=max_rounds) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve 2022-04-08T11:11:28,039 self._add_to_criteria(self.state.criteria, r, parent=None) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria 2022-04-08T11:11:28,039 if not criterion.candidates: 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__ 2022-04-08T11:11:28,039 return bool(self._sequence) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__ 2022-04-08T11:11:28,039 return any(self) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in 2022-04-08T11:11:28,039 return (c for c in iterator if id(c) not in self._incompatible_ids) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built 2022-04-08T11:11:28,039 candidate = func() 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 220, in _make_candidate_from_link 2022-04-08T11:11:28,039 version=version, 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 294, in __init__ 2022-04-08T11:11:28,039 version=version, 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__ 2022-04-08T11:11:28,039 self.dist = self._prepare() 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare 2022-04-08T11:11:28,039 dist = self._prepare_distribution() 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 299, in _prepare_distribution 2022-04-08T11:11:28,039 return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 487, in prepare_linked_requirement 2022-04-08T11:11:28,039 return self._prepare_linked_requirement(req, parallel_builds) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 560, in _prepare_linked_requirement 2022-04-08T11:11:28,039 self.build_isolation, 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution 2022-04-08T11:11:28,039 abstract_dist.prepare_distribution_metadata(finder, build_isolation) 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/distributions/sdist.py", line 47, in prepare_distribution_metadata 2022-04-08T11:11:28,039 self.req.prepare_metadata() 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/req/req_install.py", line 533, in prepare_metadata 2022-04-08T11:11:28,039 details=details, 2022-04-08T11:11:28,039 File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/build/metadata_legacy.py", line 71, in generate_metadata 2022-04-08T11:11:28,039 raise MetadataGenerationFailed(package_details=details) from error 2022-04-08T11:11:28,039 pip._internal.exceptions.MetadataGenerationFailed: metadata generation failed 2022-04-08T11:11:28,061 Removed mdreg==0.3.1 from https://files.pythonhosted.org/packages/eb/8b/0358e3454beda70f4259a4d86932f6e072225039955f5a20d39144173ede/mdreg-0.3.1.tar.gz#sha256=8f5b490139cbe17e3c0bc07922cd8dbe529740485daf98ed0e594715236837e9 from build tracker '/tmp/pip-req-tracker-xtm8fgqm' 2022-04-08T11:11:28,062 Removed build tracker: '/tmp/pip-req-tracker-xtm8fgqm'