Pre-requisite installation

We show users what pre-requisites are required for setting up Spatial MultilayerExplorer and how to install these pre-requisites. Identify the system of using the explorer. We support mac OSX and Ubuntu Linux.

Here are the pre-requisites:

1) Python 3.5+
2) scikit-image (python package)
3) scikit-learn (python package)
4) opencv-python (python package)
5) tileup (Ruby package)
6) convert (ImageMagick 6.7+)
7) Java 1.7+
8) macOS SDK library and Command Line Tools (CLT) (macOS specific)

General macOS specific pre-requisites

First, install Command Line Tools:
xcode-select --install
This should run successfully. If not, please consult a detailed instruction manual here.
Next, install the macOS_SDK headers (for macOS Mojave, macOS Catalina, not necessary in macOS Sierra):
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
After doing this step, you should see a lot of header files in /usr/include. If you do not see files in /usr/include or this folder does not exist, please consult this thread for possible solutions here.

ImageMagick install in macOS Sierra or Mojave

It is easiest to install ImageMagick within Homebrew. If you don't have Homebrew, visit https://brew.sh to learn how to install it.

Once Homebrew is installed, check ~/.bash_profile (do: cat ~/.bash_profile) that you have added /usr/local/bin to $PATH variable. If you do not:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Then do the following:
brew install imagemagick
#if python is not already installed, then do the below line. macOS's python (located in /Library/...) also works fine.
#brew install python@3
brew install pkg-config
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
brew unlink imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile
Note imagemagick v6 is required for macOS. Version 7 is known to have compatibility problem with Ruby rmagick package, and is therefore avoided.
After doing the above, close the terminal. Open the terminal to refresh environment.
You should be able to enter just "convert -version" without problem.

Tileup install in macOS Sierra or Mojave

Tileup is a Ruby package. We installed earlier Ruby in Homebrew. Then simply do the following:
/usr/local/opt/ruby/bin/gem install rmagick
/usr/local/opt/ruby/bin/gem install tileup
echo 'export PATH="/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"' >> ~/.bash_profile   #check gems version is correct
In the last step, check that the gems version (2.6.0) is indeed the version you have installed.
After doing so, close the terminal. Open the terminal to refresh environment.
You should be able to enter just "tileup -h" without problem.

Python packages in macOS Sierra or Mojave

The following assumes that you have installed Python 3+ (either version that comes with macOS or Homebrew's python version works fine). First check which python you are using, this would be /usr/local/bin/python (if using Homebrew) or /Library/... (if using macOS python).
which python
Then do the following:
pip3 install -U scikit-image
pip3 install opencv-python
pip3 install scikit-learn
# these apply to both smfish-image-processing and giotto-viewer below:
# if do not wish to install dependencies, add --no-deps 
# if upgrade from existing version, add --upgrade --no-cache-dir --force-reinstall
pip3 install smfish-image-processing 
pip3 install giotto-viewer


Special instructions for macOS Catalina

In the step to install the SDK headers, or Command Line Tools (CLT) in Catalina, please do the following:
open /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include

ImageMagick install in Ubuntu

sudo apt-get install imagemagick

Tileup install in Ubuntu

sudo apt install ruby
sudo apt install ruby-dev
sudo apt install libmagickwand-dev
sudo gem install tileup

Python packages in Ubuntu

Install python packages to user directory ~/.local.
pip3 install --user scikit-image 
pip3 install --user opencv-python 
pip3 install --user scikit-learn
# these apply to both smfish-image-processing and giotto-viewer below:
# if do not wish to install dependencies, add --no-deps 
# if upgrade from existing version, add --upgrade --no-cache-dir --force-reinstall
pip3 install --user smfish-image-processing
pip3 install --user giotto-viewer