Skip to content

Commit 5155890

Browse files
LeengitLee Newberg
andauthored
5 update readme.md, wrapping, include files in response to code review (#6)
* Issue 3: Flesh out README.rst * DOC: Removing itkMinimalStandardRandomVariateGenerator * DOC: Doxygen comments and fixes for variable names. Removal of cache for input image. * DOC: Installation, Usage section. Touch ups. * DOC: In response to review by thewtex * DOC: In response to review by dzenanz Co-authored-by: Lee Newberg <[email protected]>
1 parent 20da7e8 commit 5155890

10 files changed

+279
-356
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.10.2)
22
project(StructurePreservingColorNormalization)
33
set(CMAKE_CXX_STANDARD 11)
44

5-
set(StructurePreservingColorNormalization_LIBRARIES StructurePreservingColorNormalization)
6-
75
if(NOT ITK_SOURCE_DIR)
86
find_package(ITK REQUIRED)
97
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})

README.rst

Lines changed: 97 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ITKColorNormalization
1414
Overview
1515
--------
1616

17-
This performs "Structure Preserving Color Normalization" on an H&E image using a reference image.
17+
This image filter performs *Structure Preserving Color Normalization* on an H&E image using a reference image.
1818

1919
H&E (hematoxylin and eosin) are stains used to color parts of cells in a histological image, often for medical diagnosis.
2020
Hematoxylin is a compound that stains cell nuclei a purple-blue color. Eosin is a compound that stains extracellular matrix
@@ -33,20 +33,105 @@ absorption characteristics using a technique mimicking that presented in [AGHMMS
3333
finds a good solution for a non-negative matrix factorization by first transforming it to the problem of finding a convex
3434
hull for a set of points in a cloud.
3535

36+
The lead developer of InsightSoftwareConsortium/ITKColorNormalization is `Lee Newberg <https://github.com/Leengit)>`_.
37+
38+
Installation for python
39+
-----------------------
40+
41+
From the web page https://github.com/InsightSoftwareConsortium/ITKColorNormalization/actions, click on a recently
42+
successfully built workflow. This takes you to a page of \"Build, test, package\" and a list of Artifacts, such as
43+
WindowWheel3.8, WindowWheel3.7, WindowWheel3.6, WindowWheel3.5, MacOSWheels, LinuxWheel38, LinuxWheel37, LinuxWheel36, and
44+
LinuxWheel35. Click on the artifact that matches your operating system and version of python, to download a zip file. Find
45+
the downloaded zip file, perhaps within your Downloads folder, and unzip it. This gives you a file with a name like
46+
itk_spcn-0.1.0-cp38-cp38-manylinux1_x86_64.whl.
47+
48+
In a terminal session, create a python virtual environment with a command like
49+
50+
.. code-block:: shell
51+
52+
python -m venv /tmp/venv
53+
54+
Make your current terminal session use the virtual environment with a command like the following. Note that the line begins
55+
with a single \".\" followed by a space.
56+
57+
.. code-block:: shell
58+
59+
. /tmp/venv/bin/activate
60+
61+
Install the wheel in the virtual environment with a command like
62+
63+
.. code-block:: shell
64+
65+
/tmp/venv/bin/pip install itk_spcn-0.1.0-cp38-cp38-manylinux1_x86_64.whl
66+
67+
You can stop using the virtual environment in your terminal session with the following command.
68+
69+
.. code-block:: shell
70+
71+
deactivate
72+
73+
Usage
74+
-----
75+
76+
If you have not done so already, make your current terminal session use the previously created virtual environment with a
77+
command like the following. Note that the line begins with a single \".\" followed by a space.
78+
79+
.. code-block:: shell
80+
81+
. /tmp/venv/bin/activate
82+
83+
Launch python using your virtual environment with \`python\` or \`python3\`. In python, type the following to load the itk
84+
package and two images:
85+
86+
.. code-block:: python
87+
88+
import itk
89+
input_image = itk.imread('path/to/input_file.mha')
90+
reference_image = itk.imread('path/to/reference_file.mha')
91+
92+
You can use the eager interface for ITK. The input_image and reference_image are processed to produce normalized_image,
93+
which is the input_image with the color scheme of the reference_image. The color_index_suppressed_by_hematoxylin and
94+
color_index_suppressed_by_eosin arguments are optional if the input_image pixel type is RGB or RGBA. Here you are indicating
95+
that the color channel most suppressed by hematoxylin is 0 (which is red for RGB and RGBA pixels) and that the color most
96+
suppressed by eosin is 1 (which is green for RGB and RGBA pixels)\; these are the defaults for RGB and RGBA pixels.
97+
98+
.. code-block:: python
99+
100+
normalized_image = itk.structure_preserving_color_normalization_filter(
101+
input_image,
102+
reference_image,
103+
color_index_suppressed_by_hematoxylin=0,
104+
color_index_suppressed_by_eosin=1)
105+
106+
Alternatively, create a pipeline. The function itk.StructurePreservingColorNormalizationFilter.New() uses its argument to
107+
determine the pixel type for the filter\; the actual image is not used in the first line of the following. As above, the
108+
calls to SetColorIndexSuppressedByHematoxylin and SetColorIndexSuppressedByEosin are optional if the pixel type is RGB or
109+
RGBA.
110+
111+
.. code-block:: python
112+
113+
spcn_filter = itk.StructurePreservingColorNormalizationFilter.New(input_image)
114+
spcn_filter.SetColorIndexSuppressedByHematoxylin(0)
115+
spcn_filter.SetColorIndexSuppressedByEosin(1)
116+
spcn_filter.SetInput(0, input_image)
117+
spcn_filter.SetInput(1, reference_image)
118+
spcn_filter.SetOutput(normalized_image)
119+
spcn_filter.Update()
120+
36121
Bibliography
37122
------------
38123

39-
.. [AGHMMSWZ2013] Arora S, Ge R, Halpern Y, Mimno D, Moitra A, Sontag D, Wu Y, Zhu M. A Practical Algorithm for Topic
40-
Modeling with Provable Guarantees. Proceedings of the 30th International Conference on Machine Learning, PMLR
41-
28(2):280-288, 2013.
124+
.. [AGHMMSWZ2013] Arora S, Ge R, Halpern Y, Mimno D, Moitra A, Sontag D, Wu Y, Zhu M. A Practical Algorithm for Topic
125+
Modeling with Provable Guarantees. *Proceedings of the 30th International Conference on Machine Learning*, `PMLR 2013\;
126+
28(2):280-288 <http://proceedings.mlr.press/v28/arora13.html>`_.
42127
43-
.. [NCKZ2018] Newberg LA, Chen X, Kodira CD, Zavodszky MI. Computational de novo discovery of distinguishing genes for
44-
biological processes and cell types in complex tissues. PLoS One. 2018;13(3):e0193067. Published 2018
45-
Mar 1. doi:10.1371/journal.pone.0193067
128+
.. [NCKZ2018] Newberg LA, Chen X, Kodira CD, Zavodszky MI. Computational de novo discovery of distinguishing genes for
129+
biological processes and cell types in complex tissues. *PLoS One*, 2018\; 13(3):e0193067.
130+
`doi:10.1371/journal.pone.0193067 <https://doi.org/10.1371/journal.pone.0193067>`_.
46131
47-
.. [RAS2019] Ramakrishnan G, Anand D, Sethi A. Fast GPU-Enabled Color Normalization for Digital Pathology.
48-
arXiv:1901.03088. 2019 Jan.
132+
.. [RAS2019] Ramakrishnan G, Anand D, Sethi A. Fast GPU-Enabled Color Normalization for Digital Pathology. `arXiv 2019\;
133+
1901.03088 <https://arxiv.org/abs/1901.03088>`_.
49134
50-
.. [VPSAWBSSEN2016] Vahadane A, Peng T, Sethi A, Albarqouni S, Wang L, Baust M, Steiger K, Schlitter AM, Esposito I,
51-
Navab N. Structure-Preserving Color Normalization and Sparse Stain Separation for Histological Images. IEEE Trans Med
52-
Imaging. 2016 Aug;35(8):1962-71. doi: 10.1109/TMI.2016.2529665. Epub 2016 Apr 27. PMID: 27164577.
135+
.. [VPSAWBSSEN2016] Vahadane A, Peng T, Sethi A, Albarqouni S, Wang L, Baust M, Steiger K, Schlitter AM, Esposito I, Navab N.
136+
Structure-Preserving Color Normalization and Sparse Stain Separation for Histological Images. *IEEE Trans Med Imaging*,
137+
2016\; 35(8):1962-71. `doi:10.1109/TMI.2016.2529665 <https://doi.org/10.1109/TMI.2016.2529665>`_.

include/itkMinimalStandardRandomVariateGenerator.h

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)