SMIL  1.1
Installing from sources

Typical workflow

Typical workflow for installing Smil from sources is :

Note
If you're installing Smil under Anaconda, please read the instructions on config-smil before.
  1. get Smil source repository :
    cd /somewhere
    git clone https://github.com/MinesParis-MorphoMath
    mkdir -p build
    cd build
    
  2. install requirements - this step depends on the operating system.
    • For linux distributions, there are some scripts under the contrib/scripts to easy installation or requirements. The following shall work fine for Ubuntu, Debian, CentOS and Fedora
      source /etc/os-release
      sudo source ../smil/contrib/scripts/requirements-$ID.sh
      
      These scripts are also available at contrib/scripts
  3. Configure and compile : you have two options
    • Easy Build : use the config-smil configuration script :
      contrib/scripts/config-smil -h
      contrib/scripts/config-smil --auto --test
      make -j 8
      sudo make install
      
    • use ccmake to fine tune Smil configuration :
      ccmake ../smil
      make -j 8
      sudo make install
      
    • you can do both : quick configuration with the config-smil script and fine tune it with ccmake.
Warning
If you're building Smil with the Swig Python interface, you MUST REMEMBER that each build is specific to the Python library version Smil was built with. So, if when building Smil, Python 3.5 was found and later you upgraded it to, say, Python 3.6, they won't be compatible and you'll need to rebuild Smil.

config-smil

 $ ../smil/contrib/scripts/config-smil --help

 config-smil

 Usage :
   config-smil [ options ] SourceDirectory

 Options :
   --help
     This message
   --prefix=prefix
     This option defines the prefix where Smil will be installed.
     Default value is /usr/local.
   --addon=name,name,name,...
     A comma separated list of Addons to enable
     Default enabled Addons : Color Filters HoughTransform Chabardes StochasticWS FFT Parsimonious
   --generic
     Compile for a generic architecture. Default is to optimize for the
     processor in the computer Smil is being compiled.
   --auto
     Optimize Smil generated code for the processor at this computer.
     This is the default option.
   --doc
   --devdoc
     Build doxygen documentation
   --test
     Add Makefile targets to build test programs (make test)
   --package
     Add Makefile targets to build Linux packages
   -v
     Verbose
   -Dvar=value
     Define CMake variables (use with care)

 Example :
   config-smil --addon=GraphCuts --prefix=/usr/local/Smil-27 /home/sources/smil

 Author :
   Jose-Marcio Martins da Cruz

 See also :
   Full Smil documentation at : https://smil.cmm.minesparis.psl.eu

Addons

This area in the source tree contains some programs which, for some reason, aren't part of Smil core code : need particular external libraries, experimental, not fully validated, ...

This addons can be enabled/disabled at configuration time (with cmake or ccmake. Addons enabled by default at current release are : Color, Filters, StochasticWS, Parsimonious, ZhangSkel, FFT, HoughTransform and Chabardes.

User Modules

This area in the source tree is reserved for programs created by final users.

To create your own module, just duplicate the SampleModule directory inside the UserModules directory, and replace all references to "SampleModule" by the name of your module. And adapt all files inside to fit your needs. We hope this example is quite self-explanatory.

Don't forget to enable UserModules at configuration time, with cmake or ccmake.

Anaconda

Running Smil under Anaconda has many advantages :

  • Anaconda can be installed and configured at user space, that means, you don't need to have privileges on your computer to install, configure and add the packages you need;
  • in some conservative distributions (e.g. CentOS) you'll be able to use recent versions of many tools : gcc, Python, Qt, ....

The downside is that you'll need to install Smil from sources... but that's not that hard. Just follow these steps :

  1. Install Anaconda, if not already done. Visit the Anaconda web site and check their Installing Instructions
    • Quick instructions :
      # get it (YYYY-MM is the year and month of the last release)
      wget https://repo.anaconda.com/archive/Anaconda3-YYYY.MM-Linux-x86_64.sh
      # launch the installer and answer all questions
      bash ./Anaconda3-YYYY.MM-Linux-x86_64.sh
      
      You'll need to login again to have your conda base environment available.
    • Create an environment for Smil - a good practice says to use base environment only for administrations purposes.
      # the option "python=3.8" is useful if you want a particular version of Python
      conda create -n smil python=3.8
      conda activate smil
      conda install gxx_linux-64 cmake swig \
                    libpng jpeg libtiff curl \
                    numpy ipython \
                    qt pyqt
      conda install -c conda-forge qwt
      
  2. get Smil source repository :
    cd /somewhere
    git clone https://github.com/MinesParis-MorphoMath
    mkdir -p build
    cd build
    
  3. configure and compile
    contrib/scripts/config-smil -h
    contrib/scripts/config-smil --auto --prefix=/whatever/Smil-38
    make -j 8
    sudo make install
    
    You'll need to add a –prefix option to indicate where you want to install Smil. This may happen in two situations :
    • you don't have privileges on your computer
    • you'll need Smil in more than one environment with different versions of Python.
  4. post-install - you may eventually set some environment variables :
    export PYTHONPATH=/whatever/Smil-38/lib/Smil
    export LD_LIBRARY_PATH=$CONDA_PREFIX/lib
    
  5. test your installation with the following commands :
    $ ipython
    Python 3.8.5 (default, Jul 28 2020, 12:59:40)
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
    
    In [1]: import smilPython as sp
    SMIL (Simple Morphological Image Library) 0.10.6-dev
    Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
    Copyright (c) 2017-2023, CMM - Centre de Morphologie Mathematique
    All rights reserved.
    
    In [2]: im = sp.Image()
    In [3]: im.show()