Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 43513ea

Browse files
committed
- Improves the dockerfile and allows it to be run as an executable
- Adds segfault instructions to readme.
1 parent ce42468 commit 43513ea

File tree

2 files changed

+72
-103
lines changed

2 files changed

+72
-103
lines changed

Dockerfile

+65-101
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM debian
22

33
### Acquires required packages and libraries ###
44
RUN apt-get update && \
5+
apt-get upgrade -y && \
56
apt-get install -y \
67
build-essential \
78
cmake \
@@ -16,107 +17,33 @@ RUN apt-get update && \
1617
libtool \
1718
pkg-config \
1819
glib2.0 \
20+
libboost-all-dev \
21+
libjpeg-dev \
22+
libtiff-dev \
1923
libcairo2-dev \
2024
libgdk-pixbuf2.0-dev \
21-
libxml2-dev
25+
libxml2-dev \
26+
zlib1g-dev \
27+
swig3.0
2228

2329
### Compiles the required libraries ###
24-
RUN mkdir libraries WSICS
30+
RUN mkdir libraries
2531
WORKDIR /libraries/
2632

2733
RUN git clone https://github.com/Kitware/CMake.git && \
2834
ls -lh && \
2935
cd CMake && \
30-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local . && \
36+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/ . && \
3137
make -j 4 && \
3238
make install && \
3339
cd .. && \
3440
rm CMake -r
3541

36-
RUN wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz && \
37-
tar -xzf boost_1_67_0.tar.gz && \
38-
rm boost_1_67_0.tar.gz && \
39-
cd boost_1_67_0 && \
40-
./bootstrap.sh --with-libraries=program_options,filesystem,system,regex,date_time,thread,chrono,atomic && \
41-
./b2 link=shared runtime-link=shared && \
42-
./b2 install && \
43-
cd .. && \
44-
rm boost_1_67_0 -r
45-
46-
RUN wget ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk363/dcmtk-3.6.3.tar.gz && \
47-
tar -xzf dcmtk-3.6.3.tar.gz && \
48-
rm dcmtk-3.6.3.tar.gz && \
49-
cd dcmtk-3.6.3 && \
50-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local . && \
51-
make -j 4 && \
52-
make install && \
53-
cd .. && \
54-
rm dcmtk-3.6.3 -r
55-
56-
RUN git clone https://github.com/opencv/opencv.git && \
57-
cd opencv && \
58-
mkdir build && \
59-
cd build && \
60-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. && \
61-
make -j 4 && \
62-
make install && \
63-
cd ../.. && \
64-
rm opencv -r
65-
66-
RUN wget http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz && \
67-
tar -xzf tiff-4.0.9.tar.gz && \
68-
rm tiff-4.0.9.tar.gz && \
69-
cd tiff-4.0.9 && \
70-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local . && \
71-
make -j 4 && \
72-
make install && \
73-
cd .. && \
74-
rm tiff-4.0.9 -r
75-
76-
RUN wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz && \
77-
tar -xzf jpegsrc.v9c.tar.gz && \
78-
rm jpegsrc.v9c.tar.gz && \
79-
cd jpeg-9c && \
80-
./configure && \
81-
make -j 4 && \
82-
make install && \
83-
cd .. && \
84-
rm jpeg-9c -r
85-
86-
RUN wget http://www.zlib.net/zlib-1.2.11.tar.gz && \
87-
tar -xzf zlib-1.2.11.tar.gz && \
88-
rm zlib-1.2.11.tar.gz && \
89-
cd zlib-1.2.11 && \
90-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local . && \
91-
make -j 4 && \
92-
make install && \
93-
cd .. && \
94-
rm zlib-1.2.11 -r
95-
96-
RUN wget https://netcologne.dl.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz && \
97-
tar -xzf swig-3.0.12.tar.gz && \
98-
rm swig-3.0.12.tar.gz && \
99-
cd swig-3.0.12 && \
100-
./configure && \
101-
make -j 4 && \
102-
make install && \
103-
cd .. && \
104-
rm swig-3.0.12 -r
105-
106-
RUN git clone https://github.com/zeux/pugixml.git && \
107-
cd pugixml && \
108-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local . && \
109-
make -j 4 && \
110-
make install && \
111-
cp src/* /usr/local/include/ && \
112-
cd .. && \
113-
rm pugixml -r
114-
11542
RUN wget http://www.ece.uvic.ca/%7Efrodo/jasper/software/jasper-2.0.14.tar.gz && \
11643
tar -xzf jasper-2.0.14.tar.gz && \
11744
rm jasper-2.0.14.tar.gz && \
11845
cd jasper-2.0.14/build && \
119-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. && \
46+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/ .. && \
12047
make -j 4 && \
12148
make install && \
12249
cd ../.. && \
@@ -127,47 +54,84 @@ RUN wget https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz && \
12754
mkdir openjpeg-2.3.0/build/ && \
12855
rm v2.3.0.tar.gz && \
12956
cd openjpeg-2.3.0/build && \
130-
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. && \
57+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/ .. && \
13158
make -j 4 && \
13259
make install && \
13360
cd ../.. && \
13461
rm openjpeg-2.3.0 -r
13562

136-
RUN wget https://www.sqlite.org/snapshot/sqlite-snapshot-201807272333.tar.gz && \
137-
tar -xzf sqlite-snapshot-201807272333.tar.gz && \
138-
cd sqlite-snapshot-201807272333 && \
139-
./configure && \
63+
RUN wget https://www.sqlite.org/2019/sqlite-autoconf-3270100.tar.gz && \
64+
tar -xzf sqlite-autoconf-3270100.tar.gz && \
65+
rm sqlite-autoconf-3270100.tar.gz && \
66+
cd sqlite-autoconf-3270100 && \
67+
./configure --libdir /usr/lib/ --includedir /usr/include/ && \
14068
make -j 4 && \
14169
make install && \
14270
cd .. && \
143-
rm sqlite-snapshot-201807272333 -r
71+
rm sqlite-autoconf-3270100 -r
72+
73+
RUN git clone https://github.com/zeux/pugixml.git && \
74+
cd pugixml && \
75+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/ . && \
76+
make -j 4 && \
77+
make install && \
78+
cp src/* /usr/include/ && \
79+
cd .. && \
80+
rm pugixml -r
14481

14582
RUN git clone https://github.com/openslide/openslide.git && \
14683
cd openslide && \
14784
autoreconf -i && \
148-
./configure && \
85+
./configure --libdir /usr/lib/ --includedir /usr/include/ && \
14986
make -j 4 && \
15087
make install && \
15188
cd .. && \
15289
rm openslide -r
90+
91+
RUN git clone https://github.com/opencv/opencv.git && \
92+
cd opencv && \
93+
mkdir build && \
94+
cd build && \
95+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/ .. && \
96+
make -j 4 && \
97+
make install && \
98+
cd ../.. && \
99+
rm opencv -r
153100

154-
RUN git clone https://github.com/computationalpathologygroup/ASAP.git && \
101+
RUN git clone --single-branch --branch master https://github.com/computationalpathologygroup/ASAP.git && \
155102
cd ASAP && \
156103
cmake \
157-
-D CMAKE_BUILD_TYPE=Release \
158-
-D CMAKE_INSTALL_PREFIX=/usr/local \
159-
-D OPENSLIDE_INCLUDE_DIR=/usr/local/include/openslide/ \
160-
-D BOOST_ROOT=/usr/local \
161-
. && \
104+
-DCMAKE_BUILD_TYPE=Release \
105+
-DCMAKE_INSTALL_PREFIX=/usr/ \
106+
-DOPENSLIDE_INCLUDE_DIR=/usr/include/openslide/ \
107+
-DBOOST_ROOT=/usr/ \
108+
-DBUILD_DIAG_PATHOLOGY_EXECUTABLES=OFF \
109+
-DBUILD_DIAG_PATHOLOGY_TESTS=OFF \
110+
-DBUILD_BUILD_EXECUTABLES=OFF \
111+
-DBUILD_MULTIRESOLUTIONIMAGEINTERFACE_VSI_SUPPORT=OFF \
112+
-DBUILD_TESTS=OFF \
113+
. && \
162114
make -j 4 && \
163115
make install && \
164116
cd .. && \
165117
rm ASAP -r
166-
167-
ADD ./SlideStandardization .
168-
RUN cmake -D CMAKE_BUILD_TYPE=Release -D BOOST_ROOT=/usr/local . && \
169-
make -j 4 VERBOSE=1
170118

171119
### Compiles the stain normalization algorithm ###
120+
ADD . ./WSICS/
121+
RUN cd WSICS && \
122+
cmake \
123+
-DCMAKE_BUILD_TYPE=Release \
124+
-DBOOST_ROOT=/usr/ \
125+
-DASAP_INCLUDE_DIRS=/usr/include/ \
126+
-DASAP_LIB_DIRS=/usr/lib/ \
127+
. && \
128+
make -j 4 && \
129+
make install && \
130+
cd .. && \
131+
rm WSICS -r
172132

173-
### Cleans up all junk ###
133+
### Sets the entrypoint ###
134+
RUN rm /libraries/ -r
135+
WORKDIR /usr/bin/
136+
ENTRYPOINT [ "wsics" ]
137+
CMD []

readme.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ The normalization process requires that a template image is converted to a CSV f
2727

2828
## Docker ##
2929

30-
The containerized version of WSICS relies on volumes to access the required files and images. WSICS statically utilizes the /mount/ folder as its mount location.
30+
The containerized version of WSICS relies on volumes to access the required files and images. In order to access images and export results, a volume must be mounted through the "-v" option for docker. An example can be seen below:
3131
```
32-
docker run -v [host_directory:/mount/] [WSICS parameters]
32+
docker run -v [local directory]:/data/ wsics --input /data/[image] --template_output /data/[template name]
3333
```
34+
It is possible for the algorithm to utilize a large amount of memory, which can result in a segfault error for Docker. To resolve this, the required training size can be diminished, or the pool of memory increased for Docker.
35+
3436

3537
## Input and Output ##
3638

@@ -87,6 +89,9 @@ The training pixels are selected from tiles that contain little to no background
8789
--background_threshold [positive float]
8890
```
8991

92+
Additionally, the amount of detected ellipses are also considered when selecting tiles to extract pixels from. Normally this is calculated based on the tile size. However, it can also be set through the **min_ellipses**
93+
94+
9095
The selection of Hematoxylin colored pixels is done by detecting ellipses within the tissue and then calculating the mean red density value of the HSD color space. The **hema_percentile** parameter then defines which ellipse mean is selected to serve as threshold for the selection of Hematoxylin pixels.
9196

9297
```

0 commit comments

Comments
 (0)