Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Then, to install the whole thing, it is necessary to first install blockmatching

conda install vt -c morpheme

or,

conda install vt-python -c morpheme -c conda-forge


Then, you can install the 3D-registration library either directly via pip:

pip install 3D-registration
Expand Down
76 changes: 76 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Registrationtools docker

The dockerfile makes an image that contains a set of relevant packages for image registration in python.

The relevant packages for image registration that contains are:

- [`registrationtools`](https://github.com/GuignardLab/registration-tools): This package
- [`vt-python`](https://gitlab.inria.fr/morpheme/vt-python): Original package over which this package makes a wrapper.
- [`SimpelITK`](https://simpleitk.org/): Classical package for image registration, wrapper over the ITK package.
- [`skimage`](https://scikit-image.org/): Well-stablished package for image manipulation in python based on numpy.

In addition to these packages, other packages are installed (e.g. numpy, matplotlib...). A list can be seen in environment.yaml.

Constructed images are already deposited in [dsblab/registrationtools](https://hub.docker.com/repository/docker/dsblab/registrationtools), so there is not need of building the image except if you want to extend further capabilities.

# Running the image

## Interactive Shell

Start the container in interactive format.

```shell
docker run -it \
--mount type=bind,source="$(pwd)",target=/home \
dsblab/registrationtools:v0.1
```

Activate the conda image.

```shell
source activate registration
cd home
```

And now all the packages and modules will be loaded. You can start a python shell:

```shell
python
```

or execute packages installed from the command line (e.g. blockmatching)

```shell
blockmatching -h
```

## Script

To execute directly a bash script simply

```shell
docker run \
--mount type=bind,source="$(pwd)",target=/home \
dsblab/registrationtools:v0.1 /bin/bash -c "source activate registration: cd home; <bash_script.sh>"
```

and a python script

```shell
docker run \
--mount type=bind,source="$(pwd)",target=/home \
dsblab/registrationtools:v0.1 /bin/bash -c "source activate registration; cd home; python <python_script.py>"
```

## Jupyter lab

If you want to work interactively with a jupyter notebook.

```shell
docker run -it \
-p 8888:8888 \
--mount type=bind,source="$(pwd)",target=/home \
dsblab/registrationtools:v0.1 /bin/bash -c "jupyter lab --notebook-dir=/home --ip='*' --port=8888 --allow-root"
```

You can then view the Jupyter Notebook by opening http://localhost:8888 in your browser, or http://<DOCKER-MACHINE-IP>:8888 if you are using a Docker.
6 changes: 6 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

version=v0.1

docker build . -t dsblab/registrationtools:$version
docker push dsblab/registrationtools:$version
8 changes: 8 additions & 0 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM continuumio/miniconda3:4.12.0

RUN apt-get update
COPY environment.yaml .
RUN conda install cmake make
RUN apt-get install g++ gcc -y
RUN conda env create -f environment.yaml
RUN pip install git+https://github.com/GuignardLab/registration-tools
171 changes: 171 additions & 0 deletions docker/environment.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it's necessary wrong but it looks like a very long list of dependencies like for example is networkx really necessary?
But anyway, since it's already built it does not matter too much.

Copy link
Author

@gatocor gatocor Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just because skimage is installed.

I added some aditional basic packages to help visualizing the results and working around with the data (matplotlib, scikitimage), an those installed all the rest (networkx for example is a installed by scikitimage)

With the docker is the same, I even installed SimpleITK to rich set os tools without having to install anything else.

Do you think a more minimalistec version with just registrationtools will be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, yes I think that if there is no direct use of a library it's better to leave it out.
That being said, I am not super familiar with docker builds and I might be wrong

Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: registration
channels:
- morpheme
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- ca-certificates=2024.6.2=hbcca054_0
- ld_impl_linux-64=2.38=h1181459_1
- libblas=3.9.0=22_linux64_openblas
- libcblas=3.9.0=22_linux64_openblas
- libffi=3.4.4=h6a678d5_1
- libgcc=7.2.0=h69d50b8_2
- libgcc-ng=13.2.0=h77fa898_13
- libgfortran-ng=13.2.0=h69a702a_13
- libgfortran5=13.2.0=h3d2ce59_13
- libgomp=13.2.0=h77fa898_13
- liblapack=3.9.0=22_linux64_openblas
- libopenblas=0.3.27=pthreads_h413a1c8_0
- libstdcxx-ng=13.2.0=hc0a3c3a_13
- libzlib=1.2.13=h4ab18f5_6
- ncurses=6.4=h6a678d5_0
- openssl=3.3.1=h4ab18f5_1
- pip=24.0=py39h06a4308_0
- pybind11=2.9.2=py39hf939315_1
- pybind11-global=2.9.2=py39hf939315_1
- python=3.9.19=h955ad1f_1
- python_abi=3.9=2_cp39
- readline=8.2=h5eee18b_0
- setuptools=69.5.1=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- vt=1.0.0=h3fd9d12_0
- wheel=0.43.0=py39h06a4308_0
- xtensor=0.24.0=h4bd325d_0
- xtensor-python=0.26.0=py39h5472131_1
- xtl=0.7.4=h4bd325d_0
- xz=5.4.6=h5eee18b_1
- zlib=1.2.13=h4ab18f5_6
- pip:
- 3d-registration @ git+https://github.com/GuignardLab/registration-tools
- anyio==4.4.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==2.4.1
- async-lru==2.0.4
- attrs==23.2.0
- babel==2.15.0
- beautifulsoup4==4.12.3
- bleach==6.1.0
- certifi==2024.6.2
- cffi==1.16.0
- charset-normalizer==3.3.2
- comm==0.2.2
- contourpy==1.2.1
- cycler==0.12.1
- debugpy==1.8.2
- decorator==5.1.1
- defusedxml==0.7.1
- ensure==1.0.4
- exceptiongroup==1.2.1
- executing==2.0.1
- fastjsonschema==2.20.0
- fonttools==4.53.0
- fqdn==1.5.1
- h11==0.14.0
- h5py==3.11.0
- httpcore==1.0.5
- httpx==0.27.0
- idna==3.7
- imageio==2.34.2
- importlib-metadata==8.0.0
- importlib-resources==6.4.0
- ipykernel==6.29.4
- ipython==8.18.1
- ipywidgets==8.1.3
- isoduration==20.11.0
- jedi==0.19.1
- jinja2==3.1.4
- json5==0.9.25
- jsonpointer==3.0.0
- jsonschema==4.22.0
- jsonschema-specifications==2023.12.1
- jupyter==1.0.0
- jupyter-client==8.6.2
- jupyter-console==6.6.3
- jupyter-core==5.7.2
- jupyter-events==0.10.0
- jupyter-lsp==2.2.5
- jupyter-server==2.14.1
- jupyter-server-terminals==0.5.3
- jupyterlab==4.2.3
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.27.2
- jupyterlab-widgets==3.0.11
- kiwisolver==1.4.5
- lab==8.2
- lazy-loader==0.4
- markupsafe==2.1.5
- matplotlib==3.9.0
- matplotlib-inline==0.1.7
- mistune==3.0.2
- nbclient==0.10.0
- nbconvert==7.16.4
- nbformat==5.10.4
- nest-asyncio==1.6.0
- networkx==3.2.1
- notebook==7.2.1
- notebook-shim==0.2.4
- numpy==1.23.0
- overrides==7.7.0
- packaging==24.1
- pandas==2.2.2
- pandocfilters==1.5.1
- parso==0.8.4
- patsy==0.5.6
- pexpect==4.9.0
- pillow==10.3.0
- platformdirs==4.2.2
- prometheus-client==0.20.0
- prompt-toolkit==3.0.47
- psutil==6.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.2
- pycparser==2.22
- pygments==2.18.0
- pyparsing==3.1.2
- python-dateutil==2.9.0.post0
- python-json-logger==2.0.7
- pytz==2024.1
- pyyaml==6.0.1
- pyzmq==26.0.3
- qtconsole==5.5.2
- qtpy==2.4.1
- referencing==0.35.1
- requests==2.32.3
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rpds-py==0.18.1
- scikit-image==0.24.0
- scipy==1.13.1
- send2trash==1.8.3
- simpleitk==2.3.1
- simplejson==3.19.2
- six==1.16.0
- sniffio==1.3.1
- soupsieve==2.5
- stack-data==0.6.3
- statsmodels==0.14.2
- terminado==0.18.1
- tifffile==2024.6.18
- tinycss2==1.3.0
- tomli==2.0.1
- tornado==6.4.1
- traitlets==5.14.3
- transforms3d==0.4.2
- txt2tags==3.9
- types-python-dateutil==2.9.0.20240316
- typing-extensions==4.12.2
- tzdata==2024.1
- uri-template==1.3.0
- urllib3==2.2.2
- vtpython @ git+https://gitlab.inria.fr/morpheme/vt-python@122be17b2a25641a982649d54c17434e46989706
- wcwidth==0.2.13
- webcolors==24.6.0
- webencodings==0.5.1
- websocket-client==1.8.0
- widgetsnbextension==4.0.11
- zipp==3.19.2
74 changes: 74 additions & 0 deletions environment.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as for the other dependencies file

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: registrationtools
channels:
- morpheme
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- bzip2=1.0.8=hd590300_5
- ca-certificates=2024.2.2=hbcca054_0
- ld_impl_linux-64=2.40=h41732ed_0
- libblas=3.9.0=22_linux64_openblas
- libcblas=3.9.0=22_linux64_openblas
- libffi=3.4.2=h7f98852_5
- libgcc-ng=13.2.0=h807b86a_5
- libgfortran-ng=13.2.0=h69a702a_5
- libgfortran5=13.2.0=ha4646dd_5
- libgomp=13.2.0=h807b86a_5
- liblapack=3.9.0=22_linux64_openblas
- libnsl=2.0.1=hd590300_0
- libopenblas=0.3.27=pthreads_h413a1c8_0
- libsqlite=3.45.3=h2797004_0
- libstdcxx-ng=13.2.0=h7e041cc_5
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.2.13=hd590300_5
- ncurses=6.4.20240210=h59595ed_0
- numpy=1.26.4=py39h474f0d3_0
- openssl=3.2.1=hd590300_1
- pip=24.0=pyhd8ed1ab_0
- pybind11=2.12.0=py39h7633fee_0
- pybind11-global=2.12.0=py39h7633fee_0
- python=3.9.19=h0755675_0_cpython
- python_abi=3.9=4_cp39
- readline=8.2=h8228510_1
- setuptools=69.5.1=pyhd8ed1ab_0
- tk=8.6.13=noxft_h4845f30_101
- vt=1.0.0=h3fd9d12_0
- vt-python=1.1.0=py39h3fd9d12_5
- wheel=0.43.0=pyhd8ed1ab_1
- xtensor=0.24.0=h4bd325d_0
- xtensor-python=0.26.0=py39h5472131_1
- xtl=0.7.4=h4bd325d_0
- xz=5.2.6=h166bdaf_0
- zlib=1.2.13=hd590300_5
- pip:
- 3d-registration==0.5.2
- contourpy==1.2.1
- cycler==0.12.1
- ensure==1.0.4
- fonttools==4.51.0
- h5py==3.11.0
- imageio==2.34.0
- importlib-resources==6.4.0
- kiwisolver==1.4.5
- lazy-loader==0.4
- matplotlib==3.8.4
- networkx==3.2.1
- packaging==24.0
- pandas==2.2.2
- patsy==0.5.6
- pillow==10.3.0
- pyparsing==3.1.2
- python-dateutil==2.9.0.post0
- pytz==2024.1
- scikit-image==0.22.0
- scipy==1.13.0
- simpleitk==2.3.1
- six==1.16.0
- statsmodels==0.14.2
- tifffile==2024.4.18
- transforms3d==0.4.1
- tzdata==2024.1
- zipp==3.18.1
14 changes: 10 additions & 4 deletions src/registrationtools/time_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,18 @@ def __produce_trsf(self, params: Tuple[trsf_parameters, int, int, bool]):
p.trsf_folder, "t%06d-%06d.klb" % (t_flo, t_ref)
)
)
elif p.keep_vectorfield:
print(
"The vectorfield cannot be stored in klb format without pyklb being installed. It will be stored in a .tif format."
)
res_trsf = (
" -composition-with-initial -res-trsf "
+ os.path.join(
p.trsf_folder, "t%06d-%06d.tif" % (t_flo, t_ref)
)
)
else:
res_trsf = ""
if p.keep_vectorfield:
print(
"The vectorfield cannot be stored without pyklb being installed"
)
call(
self.path_to_bin
+ "blockmatching -ref "
Expand Down