From 37d3b8184e068f4b74f0d8a22a6d9a7427846c01 Mon Sep 17 00:00:00 2001 From: Xu Han Date: Thu, 2 Nov 2017 14:28:12 -0400 Subject: [PATCH 1/2] add niftyreg config file --- .gitignore | 1 + func_code/niftyreg.conf | 1 + func_code/niftyreg.py | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 func_code/niftyreg.conf diff --git a/.gitignore b/.gitignore index 556ed23..15c0dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc func_code/*.pyc +dockerfolder diff --git a/func_code/niftyreg.conf b/func_code/niftyreg.conf new file mode 100644 index 0000000..3a783bb --- /dev/null +++ b/func_code/niftyreg.conf @@ -0,0 +1 @@ +nifty_bin = '/niftyreg-git/install/bin' diff --git a/func_code/niftyreg.py b/func_code/niftyreg.py index d2b5a53..fb9ab6f 100644 --- a/func_code/niftyreg.py +++ b/func_code/niftyreg.py @@ -1,4 +1,12 @@ -nifty_bin = '/playpen/xhs400/Research/niftyreg-git/niftyreg_install/bin' +import os +import imp +import sys + +f = open(os.path.join(sys.path[0], '..', 'func_code', 'niftyreg.conf')) +config = imp.load_source('config', '', f) +f.close() + +nifty_bin = config.nifty_bin def nifty_reg_bspline(ref, flo, res = False, cpp = False, rmask = False, fmask = False, levels = False ): executable = nifty_bin + '/reg_f3d' From 4b235332b546d4ef663e14763e1b613333c7101f Mon Sep 17 00:00:00 2001 From: Xu Han Date: Thu, 2 Nov 2017 14:57:30 -0400 Subject: [PATCH 2/2] add dockerfile --- .dockerignore | 7 +++++ Dockerfile | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bdadd02 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +dockerfolder +func_code +.git +.gitignore +main_code +README.md +tmp_res diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3a9839e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,71 @@ +FROM nvidia/cuda:9.0-devel-ubuntu16.04 + +MAINTAINER Xu Han xhs400@cs.unc.edu + +RUN apt-get update; \ + apt-get -y upgrade; \ + apt-get install -y \ + python-pip \ + git \ + wget \ + g++ \ + cmake \ + doxygen \ + vim + +RUN python -m pip install --upgrade pip +RUN pip install numpy scipy +RUN python -m pip install scikit-build +RUN python -m pip install SimpleITK + +RUN apt-get install -y \ + zlib1g-dev \ + libpng-dev + +RUN git clone https://git.code.sf.net/p/niftyreg/git niftyreg-git; \ + cd niftyreg-git; \ + mkdir build; \ + mkdir install; \ + cd build; \ + cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/niftyreg-git/install ../; \ + make; \ + make install + +ENV NIFTYREG_INSTALL /niftyreg-git/install +ENV PATH $PATH:$NIFTYREG_INSTALL/bin +ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$NIFTYREG_INSTALL/lib + +RUN apt-get -y update; \ + apt-get install -y \ + libboost-all-dev \ + build-essential \ + python-dev \ + python-setuptools \ + libboost-python-dev \ + libboost-thread-dev + + + +RUN wget https://pypi.python.org/packages/b3/30/9e1c0a4c10e90b4c59ca7aa3c518e96f37aabcac73ffe6b5d9658f6ef843/pycuda-2017.1.1.tar.gz; \ + tar xfz pycuda-2017.1.1.tar.gz; \ + cd pycuda-2017.1.1; \ + python configure.py \ + --cuda-root=/usr/local/cuda \ + --cudadrv-lib-dir=/usr/lib/x86_64-linux-gnu \ + --boost-inc-dir=/usr/include \ + --boost-lib-dir=/usr/lib \ + --boost-python-libname=boost_python \ + --boost-thread-libname=boost_thread \ + --no-use-shipped-boost; \ + make install; \ + rm -rf pycuda-2017.1.1.tar.gz + +RUN git clone https://github.com/lebedov/scikit-cuda.git; \ + cd scikit-cuda; \ + python setup.py install + +RUN git clone https://github.com/uncbiag/PStrip.git + +COPY data/atlas/ /PStrip/data/atlas/ +COPY data/pca/pca_100/ /PStrip/data/pca/pca_100/ +