anchor.diff:  ENV ITK_VERSION v4.10.0
   ENV VTK_VERSION v7.0.0
   ENV SIMPLEITK_VERSION v0.10.0
  -
  +ENV ANTS_VERSION v2.1.0
  +ENV N_CPUS 2
   
   # Install.
   RUN \
  
positive.code: 
  # Set environment variables.
  ENV HOME /root
  
  # Define working directory.
  WORKDIR /root
  
negative.code: 
  # SimpleITK
  RUN \
      if [ ! -e  simpleitk ]; then \
          mkdir simpleitk && \
          cd simpleitk && \
          git clone --recursive http://itk.org/SimpleITK.git -b $SIMPLEITK_VERSION && \
          mkdir build && \
          cd build && \
          cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 -DPYTHON_INCLUDE_DIR=/usr/include/x86_64-linux-gnu/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 -DWRAP_JAVA=OFF -DWRAP_CSHARP=OFF -DWRAP_RUBY=OFF ../SimpleITK/SuperBuild && \
          make -j $N_CPUS && \
          cd ../..
      fi
  
  RUN echo "addlibpath $pwd/simpleitk/build/lib" >> $BASHRC
  
  #-------------------------------------------------------------------------------
  # VTK (http://www.vtk.org)
  #-------------------------------------------------------------------------------
  RUN \
      if [ ! -e  vtk ]; then \
          mkdir vtk && \
          cd vtk && \
          git clone https://gitlab.kitware.com/vtk/vtk.git -b $VTK_VERSION VTK && \
          mkdir build && \
          cd build && \
          cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 \
                -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 \
                -DPYTHON_INCLUDE_DIR=/usr/include/x86_64-linux-gnu/python3.5m \
                -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 \
                ../VTK && \
          make -j $N_CPUS && \
          make install && \
          cd ../.. \
      fi
  
  RUN echo "addlibpath $pwd/vtk/build/lib" >> $BASHRC
  
  RUN ldconfig
  
  # ITK
  # RUN \
  #     mkdir itk && \
  #     cd itk && \
  #     git clone http://itk.org/ITK.git -b $ITK_VERSION && \
  #     mkdir build && \
  #     cd build && \
  #     cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 \
  #           -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 \
  #           -DPYTHON_INCLUDE_DIR=/usr/include/x86_64-linux-gnu/python3.5m \
  #           -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 \
  #           ../ITK && \
  #     make -j $N_CPUS && \
  #     make install && \
  #     cd ../..
  #
  # RUN ldconfig
  
  #-------------------------------------------------------------------------------
  # AFNI
  # https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_linux_ubuntu.html#install-steps-linux-ubuntu
  #-------------------------------------------------------------------------------
  RUN \
      apt-get install -y tcsh xfonts-base python-qt4  && \
      apt-get install -y libmotif4 libmotif-dev motif-clients && \
      apt-get install -y gsl-bin netpbm gnome-tweak-tool libjpeg62 && \
      apt-get update && \
      sudo ln -s /usr/lib/x86_64-linux-gnu/libgsl.so /usr/lib/libgsl.so.0 && \
      dpkg -i http://mirrors.kernel.org/ubuntu/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb && \
      apt-get install -f
  
  RUN \
      chsh -s /usr/bin/tcsh  && \
      curl -O https://afni.nimh.nih.gov/pub/dist/bin/linux_fedora_21_64/@update.afni.binaries && \
      tcsh @update.afni.binaries -package linux_openmp_64 -do_extras && \
      chsh -s /bin/bash
  
  RUN \
      echo "addapath $HOME/abin" >> $BASHRC
  
  
  #-------------------------------------------------------------------------------
  # ANTS (https://github.com/stnava/ANTs)
  #-------------------------------------------------------------------------------
  RUN \
      if [ ! -e  ants ]; then \
          mkdir ants && \
          cd ants && \
          git clone https://github.com/stnava/ANTs.git -b $ANTS_VERSION  && \
          mkdir build && \
          cd build && \
          cmake -DUSE_VTK=ON -DUSE_SYSTEM_VTK=ON -DVTK_DIR=$HOME/vtk/build && \
          make -j $N_CPUS && \
          make install && \
          cd ../.. \
      fi
  
  RUN \
      echo "export ANTSPATH=${HOME}/ants/build/bin" >> $BASHRC
      echo "addapath $ANTSPATH" >> $BASHRC
  
  
  RUN ldconfig
  
  #-------------------------------------------------------------------------------
  # PETPVC (https://github.com/UCL/PETPVC)
  #-------------------------------------------------------------------------------
  RUN \
      if [ ! -e  petpvc ]; then \
          mkdir petpvc && \
          cd petpvc && \
          git clone https://github.com/UCL/PETPVC.git -b $PETPVC_VERSION && \
          mkdir build && \
          cd build && \
          cmake -DITK_DIR=$HOME/ants/build/ITKv4-build && \
          make -j $N_CPUS && \
          cd ../.. \
      fi
  
  RUN echo "addapath $HOME/petpvc/build/src" >> $BASHRC
  
  
  RUN ldconfig
  
  #-------------------------------------------------------------------------------
  # Camino (http://camino.cs.ucl.ac.uk/)
  #-------------------------------------------------------------------------------
  RUN \
      if [ ! -e  camino ]; then \
          git clone git://git.code.sf.net/p/camino/code camino \
      fi \
  
  RUN \
      echo "export MANPATH=$HOME/camino/man:$MANPATH" >> $BASHRC && \
      echo "addapath $HOME/camino/bin" >> $BASHRC
  
  #-------------------------------------------------------------------------------
  # FSL (http://fsl.fmrib.ox.ac.uk)
  #-------------------------------------------------------------------------------
  RUN \
      apt-get install fsl-complete && \
      echo "source /etc/fsl/5.0/fsl.sh" >> $BASHRC && \
      echo "export FSLPARALLEL=condor" >> $BASHRC
  
  #-------------------------------------------------------------------------------
  # Python environment with virtualenvwrapper
  #-------------------------------------------------------------------------------
  RUN \
      pip instal virtualenvwrapper && \
      source /usr/local/bin/virtualenvwrapper.sh
      mkvirtualenv -p /usr/bin/python3 pytre
      pip install -r root/pypes_requirements.txt
  
  ENV WORKON_HOME $HOME/pyenvs
  
  RUN \
      echo "source /usr/local/bin/virtualenvwrapper.sh" >> $BASHRC && \
      echo "export WORKON_HOME=$HOME/pyenvs" >> $BASHRC
  
  #-------------------------------------------------------------------------------
  # source .bashrc
  RUN source $BASHRC
  