Skip to content

Installing LORIS for MIP in a local machine

Iosif Spartalis edited this page Feb 13, 2020 · 8 revisions

Install Steps

Installation Steps for installing LORIS in a remote machine (VM or not).

  1. Creating a User for LORIS
sudo useradd -U -m -G sudo -s /bin/bash lorisadmin
sudo passwd lorisadmin
su - lorisadmin

Important: All steps from this point forward must be executed by lorisadmin user

ssh into your remote machine as a user in the sudo group (like root)

sudo useradd -U -m -G sudo -s /bin/bash lorisadmin
sudo passwd lorisadmin
su - lorisadmin
whoami

You should see lorisadmin.

  1. Downloading LORIS Make sure you're ssh'd as lorisadmin Note that the path is assumed to be var/www/loris however your own path may be var/www/, depending on your setup.
cd /var/www
git clone https://github.com/aces/Loris.git
wget https://github.com/aces/Loris/archive/v21.0.0.zip -O release.zip
sudo unzip release.zip
sudo mv Loris* loris    
sudo chown -R lorisadmin.lorisadmin /var/www/loris
sudo service apache2 restart     
cd /var/www/loris/tools    
./install.sh  (when prompted, give as project name ‘loris’)
sudo a2enmod rewrite
sudo a2ensite loris
sudo chmod 775 /var/www/loris/project/
service apache2 reload
sudo service apache2 restart
  1. Install Composer

For more information, please read the Installing Loris wiki page.

curl -sS https://getcomposer.org/installer -o composer-setup.php
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

in case of multiple versions of php

sudo update-alternatives --set php /usr/bin/php7.2

Nodejs installation

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Troubleshooting:

In case you have this error in the loris-error.log: sudo cat /var/log/apache2/loris-error.log

AH00037: Symbolic link not allowed or link target not accessible: /var/www/loris/htdocs/fontawesome,

You may need to use make

cd /var/www/loris make

  1. Create database schema and config.xml

  1. Install Imaging pipeline

https://github.com/aces/Loris-MRI

sudo mkdir -p /data/loris/bin/mri
sudo chown -R lorisadmin:lorisadmin /data/loris
cd /data/loris/bin
git clone -b master https://github.com/aces/Loris-MRI.git mri

sudo apt-get install python3
sudo apt-get install python3-dev
sudo apt-get install python3-pip
sudo apt-get install libmysqlclient-dev
sudo pip3 install virtualenv
From http://bic-mni.github.io/

sudo apt-get install libc6 libstdc++6 imagemagick perl

Download

  1. minc-toolkit-.deb
  2. minc-toolkit-testsuite-.deb
  3. beast-library-.deb
  4. bic-mni-models-.deb
cd ~
wget http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/minc-toolkit-1.9.16-20180117-Ubuntu_16.04-x86_64.deb
wget http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/minc-toolkit-testsuite-0.1.3-20131212.deb
wget http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/bic-mni-models-0.1.1-20120421.deb
wget http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/beast-library-1.1.0-20121212.deb

Install .deb packages

sudo dpkg -i minc-toolkit-1.9.16-20180117-Ubuntu_16.04-x86_64.deb sudo dpkg -i minc-toolkit-testsuite-0.1.3-20131212.deb
sudo dpkg -i bic-mni-models-0.1.1-20120421.deb
sudo dpkg -i beast-library-1.1.0-20121212.deb
source /opt/minc/1.9.16/minc-toolkit-config.sh

cd /data/loris/bin/mri/

sudo mkdir /data/incoming

bash ./imaging_install.sh

[https://github.com/aueb-wim/LORIS-for-MIP/blob/master/docs/pics/minc_tool_installation.png]]

Edit .bashrc and append

source /data/loris/bin/mri/environment

Reboot, because loris-python is not being found.

Customize interface In order to customize the interface e.x. remove “Clinical”, “Reports”, “Tools” tabs and the marked options from “Admin” tab we do the following update operation at LorisMenu table by setting the column Visible to false.

UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='2'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='4'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='5'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='30'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='31'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='32'; UPDATE LORIS.LorisMenu SET Visible='false' WHERE ID='34';

  1. Quality control

In order to mark all newly inserted mincs as "Pass"

Images in our case are ought to be initialized with a 'PASS' label upon being imported to LORIS. This is done by triger "files_AFTER_INSERT"

DELIMITER $$
CREATE DEFINER = CURRENT_USER TRIGGER `LORIS`.`files_AFTER_INSERT` AFTER INSERT ON `files` FOR EACH ROW
BEGIN
	INSERT INTO files_qcstatus
	SET	FileID = NEW.FileID,
     SeriesUID = NEW.SeriesUID,
     EchoTime = NEW.EchoTime,
     QCStatus = "Pass",
     QCFirstChangeTime = unix_timestamp( NOW() ),
     QCLastChangeTime = unix_timestamp( NOW() );
END $$ql

Loris does not store the StudyID of the mincs files into the database. One workaround is to modify the "files" table

ALTER TABLE files ADD FileStudyID TEXT DEFAULT NULL;

and execute fill_studyid.py which read the mnic header of each file to fill the missing studyid information.

sudo apt-get install minc-tools
python fill_studyid.py

In order to discriminize which files with "PASS" have been examined for the next stage we add one column

ALTER TABLE files ADD FileStudyComplete INT DEFAULT 0;
  1. Insert Data

Make sure that pre and post folders exists, otherwise create them.

cd ~
mkdir pre post

Place your dicoms files to /home/loris/pre

It is recommended to make use of https://github.com/aueb-wim/DataQualityControlTool/ to find invalid .dcm files that you should not include while uploading a dicom, otherwise the upload will fail.

Example: Upload a dicom folder to loris_apache container from host to /home/lorisadmin/pre

docker cp folder_path_from_host loris_apache:/home/lorisadmin/pre

Execute

python dicom_uploader.py

dicom_uploader.py will process each dicom-folder within the folder pre and afterwards moves that dicom-folder to the post folder.

Clone this wiki locally