Replicable Results¶
From replicable reproducible, I mean the process where same analysis script but different data is executed and the results are qualitatively same.
About selected project¶
The same project Simplified Fet-reg 2021 which is used in repeatable reproducible is reused here.
The reg.py
file contains an algorithm that reads .png
images from a directory, process it and store the results in output directory.
python -m virtualenv env_reg
# On Mac & Linux
source env_reg/bin/activate
# On Windows
env_reg/bin/activate
git clone https://github.com/mianasbat/test1.git
cd FetReg-2021
pip install -rrequirements.txt
python reg.py input_data output_data
The above command runs the algorithm on *.png
images stored in the provided input_data
directory. The algorithm perform the analysis and
creates a seperate .txt
file for each image. The text files are stored in the provided output_data
directory.
Dockerize the Repo¶
Step 1: Clone the repo and change directory into it
mkdir temp
cd temp
git clone https://github.com/mianasbat/test1.git
cd FetReg-2021
Step 2: Create a Dockerfile (Remember D
must be capital and no file extension) and store the following text.
touch Dockerfile
# open Dockerfike with any text editor
open Dockerfile
FROM mianasbat/ubuntu1804-py3.6-pip:latest
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y
RUN python -m pip install --upgrade pip
RUN mkdir /mnt/input_data
RUN mkdir /mnt/output_data
WORKDIR /opt/app
COPY . .
RUN python -m pip install -rrequirements.txt
CMD ["python3", "reg.py"]
Step 3: Build the image
docker build -t img_seg:v1 .
Step 4: Run the image
docker run -v "$PWD/input_data:/mnt/input_data" -v "$PWD/output_data:/mnt/output_data" img_seg:v4 python3 reg.py /mnt/input_data /mnt/output_data
# For windows add the / before both $ symbols
docker run -v "/$PWD/input_data:/mnt/input_data" -v "/$PWD/output_data:/mnt/output_data" img_seg:v4 python3 reg.py /mnt/input_data /mnt/output_data
Step 5: Now check the output_directory in the current directory to get the results.
cd output_data ls