From f6c3349fefcb96038d9ee5e13fca19ff1f663d95 Mon Sep 17 00:00:00 2001 From: leej3 Date: Mon, 16 Apr 2018 10:50:59 -0400 Subject: [PATCH] add dockerfile --- ClearMap/Settings.py | 8 ++++ ClearMap/__init__.py | 14 +++++-- Dockerfile | 97 +++++++++++++++++++++++++++++++++++++++++++ README.md | 99 ++++++++++++++++++++++++++++++++++++++++++++ README.rst | 54 ------------------------ 5 files changed, 214 insertions(+), 58 deletions(-) create mode 100644 Dockerfile create mode 100644 README.md delete mode 100644 README.rst diff --git a/ClearMap/Settings.py b/ClearMap/Settings.py index a8c2ae6..d96a6d5 100644 --- a/ClearMap/Settings.py +++ b/ClearMap/Settings.py @@ -58,7 +58,15 @@ def setup(): #elif hostname == 'your-host-name': # IlastikPath = 'path-to-ilastik'; # ElastixPath = 'path-to-elastix'; + elif hostname == 'MH02086639MACLT': + IlastikPath = '/usr/local/bin/ilastik-v0.5.12'; + ElastixPath = '/usr/local/bin/elastix_macosx64_v4.8/bin/elastix'; ## + elif os.environ.get('CLEARMAP_CONTAINER'): + IlastikPath = '/opt/conda/src/ilastik/ilastik-1.3.0-Linux/'; + ElastixPath = '/usr'; + + # check existence: if not ElastixPath is None: diff --git a/ClearMap/__init__.py b/ClearMap/__init__.py index 169ee72..f34a3c2 100644 --- a/ClearMap/__init__.py +++ b/ClearMap/__init__.py @@ -22,7 +22,13 @@ __copyright__ = '2016 Christoph Kirst' -__all__ = ["Settings", "Parameter", "IO", "ImageProcessing", "Analysis"] - -import ClearMap.Settings -import ClearMap.Parameter +__all__ = [ +"Alignment", +"Analysis", +"ImageProcessing", +"IO", +"Parameter", +"Settings", +] + +from ClearMap import * diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..64ce653 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,97 @@ +FROM ubuntu:16.04 + +ENV LANG="en_US.UTF-8" \ + LC_ALL="C.UTF-8" \ + ENTRYPOINT_SCRIPT="/entrypoint/startup.sh" + +# Prepare environment +RUN apt-get update \ + && apt-get install -y --no-install-recommends --allow-unauthenticated \ + curl \ + bzip2 \ + ca-certificates \ + cython3 \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + libsm6 \ + elastix \ + libxext6 \ + libxrender1 \ + vim + +RUN chmod 777 /opt && chmod a+s /opt \ + && mkdir -p /entrypoint \ + && if [ ! -f "$ENTRYPOINT_SCRIPT" ]; then \ + echo '#!/usr/bin/env bash' >> $ENTRYPOINT_SCRIPT \ + && echo 'set +x' >> $ENTRYPOINT_SCRIPT \ + && echo 'if [ -z "$*" ]; then /usr/bin/env bash; else $*; fi' >> $ENTRYPOINT_SCRIPT; \ + fi \ + && chmod -R 777 /entrypoint && chmod a+s /entrypoint + + +ENTRYPOINT ["/entrypoint/startup.sh"] + +# Create new user: neuro +RUN useradd --no-user-group --create-home --shell /bin/bash neuro +USER neuro +RUN mkdir -p /opt/conda/src/clearmap +RUN mkdir /opt/conda/src/ilastik +RUN cd /opt/conda/src/ilastik \ + && curl http://files.ilastik.org/ilastik-1.3.0-Linux.tar.bz2 >ilastik.tar.bz2 \ + && tar xjf ilastik.tar.bz2 \ + && sync \ + && rm ilastik.tar.bz2 + +#------------------ +# Install Miniconda +#------------------ + +ENV CONDA_DIR=/opt/conda \ + PATH=/opt/conda/bin:$PATH +RUN echo "Downloading Miniconda installer ..." \ + && miniconda_installer=/tmp/miniconda.sh \ + && curl -sSL --retry 5 -o $miniconda_installer https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \ + && /bin/bash $miniconda_installer -u -b -p $CONDA_DIR \ + && rm -f $miniconda_installer \ + && conda config --system --prepend channels conda-forge \ + && conda config --system --set auto_update_conda false \ + && conda config --system --set show_channel_urls true \ + && conda update -n base conda \ + && conda clean -tipsy && sync + +# Installing precomputed python packages +RUN conda install -c conda-forge -y openblas=0.2.14; \ + sync && \ + conda install -c conda-forge -y \ + cython=0.23.1 \ + h5py=2.6.0 \ + mahotas \ + matplotlib \ + numpy \ + opencv=2.4.10 \ + scikit-image=0.12.3 \ + scipy=0.16.0 \ + natsort \ + tifffile \ + ipython \ + libgfortran==1 \ + ; \ + sync \ + && conda clean -tipsy && sync + +RUN python -c "from matplotlib import font_manager" + +# Installing clearmap +ENV CLEARMAP_CONTAINER="yes" +USER root +WORKDIR /opt/conda/src/clearmap +COPY . /opt/conda/src/clearmap +RUN pip install -e . && \ + rm -rf ~/.cache/pip +RUN chmod -R a+rX /opt/conda/src/clearmap && \ + chmod +x /opt/conda/bin/* + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..a86f824 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# ClearMap + + +ClearMap is a toolbox for the analysis and registration of volumetric data +from cleared tissues. + +ClearMap is targeted towards large lightsheet volumetric imaging data +of iDISCO+ cleared mouse brains samples, their registration to the Allen brain atlas, +volumetric image processing and statistical analysis. + +The method is fully described in this [Cell paper](http://www.cell.com/cell/abstract/S0092-8674%2816%2930555-4). +For further details visit the [iDISCO website](https://idisco.info) and +the [ClearMap documentation](https://rawgit.com/ChristophKirst/ClearMap/master/docs/_build/html/index.html). + + +## Installation + +### Using Docker + +The easiest way to use clearmap is to run it in a docker container. For example, with docker installed on a Unix-like system, to get shell access to an environment with clearmap installed: + + + + $ docker pull timdanaos/clearmap + $ docker run -v $PWD:/mnt --rm -ti timdanaos/clearmap + +To change to the directory that was being used outside the container and start an ipython session: + + + $ cd /mnt + $ ipython + +To import ClearMap: + + + In [1]: import ClearMap + + + +### Using Singularity + +Singularity is a solution to using ClearMap on HPC systems where Docker cannot be used. To use ClearMap using Singularity: + + + $ mkdir ~/temporary_directory_for_singularity + $ umask 002 + $ singularity pull docker://timdanaos/clearmap + $ singularity shell -B $PWD:/mnt -H ~/temporary_directory_for_singularity clearmap*img + + +### ClearMap software development with containers + +For the development of ClearMap, this repository can be mounted in the container so that changes made to the code can be run in the context of the working container. +For example in docker: + + + $ docker run -v [absolute_path_to_repo]:/opt/conda/src/clearmap/ timdanaos/clearmap + + +In singularity: + + $ singularity shell -B $PWD:/mnt -B [absolute_path_to_repo]:/opt/conda/src/clearmap/ -H ~/temporary_directory_for_singularity [path_to_clearmap_image] + + + + +### Manual installation + +Install ClearMap by first cloning this repository. + +See [GIT.md](https://github.com/ChristophKirst/ClearMap/blob/master/GIT.md) for basic help with git. + +If you want to register data to reference images via elastix or +classify pixels via ilastik configure the /ClearMap/Settings.py file. + +You will most likely also need to install several python packages e.g. via +pip or apt-get. + +See the [documentation](https://rawgit.com/ChristophKirst/ClearMap/master/docs/_build/html/index.html) for more details. + +Additional files for mouse brain registration can be found on the `[iDISCO website](https://idisco.info/). + + +## Quickstart + +* see the template scripts in the [./ClearMap/Scripts](https://github.com/ChristophKirst/ClearMap/tree/master/ClearMap/Scripts) folder +* see the [ClearMap documentation](https://rawgit.com/ChristophKirst/ClearMap/master/docs/_build/html/index.html) + + +## Copyright + (c) 2016 Christoph Kirst + The Rockefeller University, + ckirst@rockefeller.edu + +## License + GPLv3, see LICENSE.txt for details. + + + diff --git a/README.rst b/README.rst deleted file mode 100644 index 482d5d7..0000000 --- a/README.rst +++ /dev/null @@ -1,54 +0,0 @@ -ClearMap -======== - -ClearMap is a toolbox for the analysis and registration of volumetric data -from cleared tissues. - -ClearMap is targeted towards large lightsheet volumetric imaging data -of iDISCO+ cleared mouse brains samples, their registration to the Allen brain atlas, -volumetric image processing and statistical analysis. - -The method is fully described in this `Cell paper `_. -For further details visit the `iDISCO website `_ and -the `ClearMap documentation `_. - - -Installation ------------- - -Install ClearMap by cloning it form `github `_:: - - $ git clone https://github.com/ChristophKirst/ClearMap.git - -See `GIT.md `_ for basic help with git. - -If you want to register data to reference images via elastix or -classify pixels via ilastik configure the /ClearMap/Settings.py file. - -You will most likely also need to install several python packages e.g. via -pip or apt-get. - -See the `documentation `_ for more details. - -Additional files for mouse brain registration can be found on the `iDISCO website `_. - - -Quickstart ----------- - - * see the template scripts in the `./ClearMap/Scripts `_ folder - * see the `ClearMap documentation `_ - - -Copyright ---------- - (c) 2016 Christoph Kirst - The Rockefeller University, - ckirst@rockefeller.edu - -License -------- - GPLv3, see LICENSE.txt for details. - - -