|
a |
|
b/docs/index.html |
|
|
1 |
|
|
|
2 |
|
|
|
3 |
<!DOCTYPE html> |
|
|
4 |
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> |
|
|
5 |
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> |
|
|
6 |
<head> |
|
|
7 |
<meta charset="utf-8"> |
|
|
8 |
|
|
|
9 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
10 |
|
|
|
11 |
<title>Welcome to PathFlowAI’s documentation! — PathFlowAI 0.1 documentation</title> |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
<script type="text/javascript" src="_static/js/modernizr.min.js"></script> |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> |
|
|
24 |
<script type="text/javascript" src="_static/jquery.js"></script> |
|
|
25 |
<script type="text/javascript" src="_static/underscore.js"></script> |
|
|
26 |
<script type="text/javascript" src="_static/doctools.js"></script> |
|
|
27 |
<script type="text/javascript" src="_static/language_data.js"></script> |
|
|
28 |
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> |
|
|
29 |
|
|
|
30 |
<script type="text/javascript" src="_static/js/theme.js"></script> |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> |
|
|
36 |
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> |
|
|
37 |
<link rel="index" title="Index" href="genindex.html" /> |
|
|
38 |
<link rel="search" title="Search" href="search.html" /> |
|
|
39 |
</head> |
|
|
40 |
|
|
|
41 |
<body class="wy-body-for-nav"> |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
<div class="wy-grid-for-nav"> |
|
|
45 |
|
|
|
46 |
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
|
|
47 |
<div class="wy-side-scroll"> |
|
|
48 |
<div class="wy-side-nav-search" > |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
<a href="#" class="icon icon-home"> PathFlowAI |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
</a> |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
<div role="search"> |
|
|
65 |
<form id="rtd-search-form" class="wy-form" action="search.html" method="get"> |
|
|
66 |
<input type="text" name="q" placeholder="Search docs" /> |
|
|
67 |
<input type="hidden" name="check_keywords" value="yes" /> |
|
|
68 |
<input type="hidden" name="area" value="default" /> |
|
|
69 |
</form> |
|
|
70 |
</div> |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
</div> |
|
|
74 |
|
|
|
75 |
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
<!-- Local TOC --> |
|
|
83 |
<div class="local-toc"><ul> |
|
|
84 |
<li><a class="reference internal" href="#">Welcome to PathFlowAI’s documentation!</a><ul> |
|
|
85 |
<li><a class="reference internal" href="#pathflowai-preprocess">pathflowai-preprocess</a><ul> |
|
|
86 |
<li><a class="reference internal" href="#pathflowai-preprocess-alter-masks">alter_masks</a></li> |
|
|
87 |
<li><a class="reference internal" href="#pathflowai-preprocess-collapse-annotations">collapse_annotations</a></li> |
|
|
88 |
<li><a class="reference internal" href="#pathflowai-preprocess-preprocess-pipeline">preprocess_pipeline</a></li> |
|
|
89 |
<li><a class="reference internal" href="#pathflowai-preprocess-remove-basename-from-db">remove_basename_from_db</a></li> |
|
|
90 |
</ul> |
|
|
91 |
</li> |
|
|
92 |
<li><a class="reference internal" href="#pathflowai-visualize">pathflowai-visualize</a><ul> |
|
|
93 |
<li><a class="reference internal" href="#pathflowai-visualize-extract-patch">extract_patch</a></li> |
|
|
94 |
<li><a class="reference internal" href="#pathflowai-visualize-overlay-new-annotations">overlay_new_annotations</a></li> |
|
|
95 |
<li><a class="reference internal" href="#pathflowai-visualize-plot-embeddings">plot_embeddings</a></li> |
|
|
96 |
<li><a class="reference internal" href="#pathflowai-visualize-plot-image">plot_image</a></li> |
|
|
97 |
<li><a class="reference internal" href="#pathflowai-visualize-plot-image-umap-embeddings">plot_image_umap_embeddings</a></li> |
|
|
98 |
<li><a class="reference internal" href="#pathflowai-visualize-plot-predictions">plot_predictions</a></li> |
|
|
99 |
<li><a class="reference internal" href="#pathflowai-visualize-shapley-plot">shapley_plot</a></li> |
|
|
100 |
</ul> |
|
|
101 |
</li> |
|
|
102 |
<li><a class="reference internal" href="#pathflowai-monitor">pathflowai-monitor</a><ul> |
|
|
103 |
<li><a class="reference internal" href="#pathflowai-monitor-monitor-usage">monitor_usage</a></li> |
|
|
104 |
</ul> |
|
|
105 |
</li> |
|
|
106 |
<li><a class="reference internal" href="#datasets-py">datasets.py</a></li> |
|
|
107 |
<li><a class="reference internal" href="#losses-py">losses.py</a><ul> |
|
|
108 |
</ul> |
|
|
109 |
</li> |
|
|
110 |
<li><a class="reference internal" href="#sampler-py">sampler.py</a></li> |
|
|
111 |
<li><a class="reference internal" href="#schedulers-py">schedulers.py</a><ul> |
|
|
112 |
</ul> |
|
|
113 |
</li> |
|
|
114 |
<li><a class="reference internal" href="#visualize-py">visualize.py</a><ul> |
|
|
115 |
</ul> |
|
|
116 |
</li> |
|
|
117 |
<li><a class="reference internal" href="#utils-py">utils.py</a></li> |
|
|
118 |
</ul> |
|
|
119 |
</li> |
|
|
120 |
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li> |
|
|
121 |
</ul> |
|
|
122 |
</div> |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
</div> |
|
|
126 |
</div> |
|
|
127 |
</nav> |
|
|
128 |
|
|
|
129 |
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
<nav class="wy-nav-top" aria-label="top navigation"> |
|
|
133 |
|
|
|
134 |
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
|
|
135 |
<a href="#">PathFlowAI</a> |
|
|
136 |
|
|
|
137 |
</nav> |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
<div class="wy-nav-content"> |
|
|
141 |
|
|
|
142 |
<div class="rst-content"> |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
<div role="navigation" aria-label="breadcrumbs navigation"> |
|
|
161 |
|
|
|
162 |
<ul class="wy-breadcrumbs"> |
|
|
163 |
|
|
|
164 |
<li><a href="#">Docs</a> »</li> |
|
|
165 |
|
|
|
166 |
<li>Welcome to PathFlowAI’s documentation!</li> |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
<li class="wy-breadcrumbs-aside"> |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a> |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
</li> |
|
|
176 |
|
|
|
177 |
</ul> |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
<hr/> |
|
|
181 |
</div> |
|
|
182 |
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
|
|
183 |
<div itemprop="articleBody"> |
|
|
184 |
|
|
|
185 |
<div class="section" id="welcome-to-pathflowai-s-documentation"> |
|
|
186 |
<h1>Welcome to PathFlowAI’s documentation!<a class="headerlink" href="#welcome-to-pathflowai-s-documentation" title="Permalink to this headline">¶</a></h1> |
|
|
187 |
<div class="toctree-wrapper compound"> |
|
|
188 |
</div> |
|
|
189 |
<a class="reference internal image-reference" href="_images/1.jpeg"><img alt="Download" class="align-center" src="_images/1.jpeg" style="width: 480.0px; height: 360.0px;" /></a> |
|
|
190 |
<a class="reference internal image-reference" href="_images/2.jpeg"><img alt="Download" class="align-center" src="_images/2.jpeg" style="width: 480.0px; height: 360.0px;" /></a> |
|
|
191 |
<a class="reference internal image-reference" href="_images/3.jpeg"><img alt="Download" class="align-center" src="_images/3.jpeg" style="width: 480.0px; height: 360.0px;" /></a> |
|
|
192 |
<a class="reference internal image-reference" href="_images/4.jpeg"><img alt="Download" class="align-center" src="_images/4.jpeg" style="width: 480.0px; height: 360.0px;" /></a> |
|
|
193 |
<div class="section" id="pathflowai-preprocess"> |
|
|
194 |
<h2>pathflowai-preprocess<a class="headerlink" href="#pathflowai-preprocess" title="Permalink to this headline">¶</a></h2> |
|
|
195 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-preprocess <span class="o">[</span>OPTIONS<span class="o">]</span> COMMAND <span class="o">[</span>ARGS<span class="o">]</span>... |
|
|
196 |
</pre></div> |
|
|
197 |
</div> |
|
|
198 |
<p class="rubric">Options</p> |
|
|
199 |
<dl class="option"> |
|
|
200 |
<dt id="cmdoption-pathflowai-preprocess-version"> |
|
|
201 |
<code class="sig-name descname">--version</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-version" title="Permalink to this definition">¶</a></dt> |
|
|
202 |
<dd><p>Show the version and exit.</p> |
|
|
203 |
</dd></dl> |
|
|
204 |
|
|
|
205 |
<div class="section" id="pathflowai-preprocess-alter-masks"> |
|
|
206 |
<h3>alter_masks<a class="headerlink" href="#pathflowai-preprocess-alter-masks" title="Permalink to this headline">¶</a></h3> |
|
|
207 |
<p>Map list of values to other values in mask.</p> |
|
|
208 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-preprocess alter_masks <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
209 |
</pre></div> |
|
|
210 |
</div> |
|
|
211 |
<p class="rubric">Options</p> |
|
|
212 |
<dl class="option"> |
|
|
213 |
<dt id="cmdoption-pathflowai-preprocess-alter-masks-i"> |
|
|
214 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--mask_dir</code><code class="sig-prename descclassname"> <mask_dir></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-alter-masks-i" title="Permalink to this definition">¶</a></dt> |
|
|
215 |
<dd><p>Input directory for masks. [default: ./inputs/]</p> |
|
|
216 |
</dd></dl> |
|
|
217 |
|
|
|
218 |
<dl class="option"> |
|
|
219 |
<dt id="cmdoption-pathflowai-preprocess-alter-masks-o"> |
|
|
220 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--output_dir</code><code class="sig-prename descclassname"> <output_dir></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-alter-masks-o" title="Permalink to this definition">¶</a></dt> |
|
|
221 |
<dd><p>Output directory for new masks. [default: ./outputs/]</p> |
|
|
222 |
</dd></dl> |
|
|
223 |
|
|
|
224 |
<dl class="option"> |
|
|
225 |
<dt id="cmdoption-pathflowai-preprocess-alter-masks-fr"> |
|
|
226 |
<code class="sig-name descname">-fr</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--from_annotations</code><code class="sig-prename descclassname"> <from_annotations></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-alter-masks-fr" title="Permalink to this definition">¶</a></dt> |
|
|
227 |
<dd><p>Annotations to switch from. [default: ]</p> |
|
|
228 |
</dd></dl> |
|
|
229 |
|
|
|
230 |
<dl class="option"> |
|
|
231 |
<dt id="cmdoption-pathflowai-preprocess-alter-masks-to"> |
|
|
232 |
<code class="sig-name descname">-to</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--to_annotations</code><code class="sig-prename descclassname"> <to_annotations></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-alter-masks-to" title="Permalink to this definition">¶</a></dt> |
|
|
233 |
<dd><p>Annotations to switch to. [default: ]</p> |
|
|
234 |
</dd></dl> |
|
|
235 |
|
|
|
236 |
</div> |
|
|
237 |
<div class="section" id="pathflowai-preprocess-collapse-annotations"> |
|
|
238 |
<h3>collapse_annotations<a class="headerlink" href="#pathflowai-preprocess-collapse-annotations" title="Permalink to this headline">¶</a></h3> |
|
|
239 |
<p>Adds annotation classes areas to other annotation classes in SQL DB when getting rid of some annotation classes.</p> |
|
|
240 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-preprocess collapse_annotations <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
241 |
</pre></div> |
|
|
242 |
</div> |
|
|
243 |
<p class="rubric">Options</p> |
|
|
244 |
<dl class="option"> |
|
|
245 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-i"> |
|
|
246 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_patch_db</code><code class="sig-prename descclassname"> <input_patch_db></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-i" title="Permalink to this definition">¶</a></dt> |
|
|
247 |
<dd><p>Input db. [default: patch_info_input.db]</p> |
|
|
248 |
</dd></dl> |
|
|
249 |
|
|
|
250 |
<dl class="option"> |
|
|
251 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-o"> |
|
|
252 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--output_patch_db</code><code class="sig-prename descclassname"> <output_patch_db></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-o" title="Permalink to this definition">¶</a></dt> |
|
|
253 |
<dd><p>Output db. [default: patch_info_output.db]</p> |
|
|
254 |
</dd></dl> |
|
|
255 |
|
|
|
256 |
<dl class="option"> |
|
|
257 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-fr"> |
|
|
258 |
<code class="sig-name descname">-fr</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--from_annotations</code><code class="sig-prename descclassname"> <from_annotations></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-fr" title="Permalink to this definition">¶</a></dt> |
|
|
259 |
<dd><p>Annotations to switch from. [default: ]</p> |
|
|
260 |
</dd></dl> |
|
|
261 |
|
|
|
262 |
<dl class="option"> |
|
|
263 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-to"> |
|
|
264 |
<code class="sig-name descname">-to</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--to_annotations</code><code class="sig-prename descclassname"> <to_annotations></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-to" title="Permalink to this definition">¶</a></dt> |
|
|
265 |
<dd><p>Annotations to switch to. [default: ]</p> |
|
|
266 |
</dd></dl> |
|
|
267 |
|
|
|
268 |
<dl class="option"> |
|
|
269 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-ps"> |
|
|
270 |
<code class="sig-name descname">-ps</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_size</code><code class="sig-prename descclassname"> <patch_size></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-ps" title="Permalink to this definition">¶</a></dt> |
|
|
271 |
<dd><p>Patch size. [default: 224]</p> |
|
|
272 |
</dd></dl> |
|
|
273 |
|
|
|
274 |
<dl class="option"> |
|
|
275 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-rb"> |
|
|
276 |
<code class="sig-name descname">-rb</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--remove_background_annotation</code><code class="sig-prename descclassname"> <remove_background_annotation></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-rb" title="Permalink to this definition">¶</a></dt> |
|
|
277 |
<dd><p>If selected, removes 100% background patches based on this annotation. [default: ]</p> |
|
|
278 |
</dd></dl> |
|
|
279 |
|
|
|
280 |
<dl class="option"> |
|
|
281 |
<dt id="cmdoption-pathflowai-preprocess-collapse-annotations-ma"> |
|
|
282 |
<code class="sig-name descname">-ma</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--max_background_area</code><code class="sig-prename descclassname"> <max_background_area></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-collapse-annotations-ma" title="Permalink to this definition">¶</a></dt> |
|
|
283 |
<dd><p>Max background area before exclusion. [default: 0.05]</p> |
|
|
284 |
</dd></dl> |
|
|
285 |
|
|
|
286 |
</div> |
|
|
287 |
<div class="section" id="pathflowai-preprocess-preprocess-pipeline"> |
|
|
288 |
<h3>preprocess_pipeline<a class="headerlink" href="#pathflowai-preprocess-preprocess-pipeline" title="Permalink to this headline">¶</a></h3> |
|
|
289 |
<p>Preprocessing pipeline that accomplishes 3 things. 1: storage into ZARR format, 2: optional mask adjustment, 3: storage of patch-level information into SQL DB</p> |
|
|
290 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-preprocess preprocess_pipeline <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
291 |
</pre></div> |
|
|
292 |
</div> |
|
|
293 |
<p class="rubric">Options</p> |
|
|
294 |
<dl class="option"> |
|
|
295 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-npy"> |
|
|
296 |
<code class="sig-name descname">-npy</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--img2npy</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-npy" title="Permalink to this definition">¶</a></dt> |
|
|
297 |
<dd><p>Image to numpy for faster read. [default: False]</p> |
|
|
298 |
</dd></dl> |
|
|
299 |
|
|
|
300 |
<dl class="option"> |
|
|
301 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-b"> |
|
|
302 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-b" title="Permalink to this definition">¶</a></dt> |
|
|
303 |
<dd><p>Basename of patches. [default: A01]</p> |
|
|
304 |
</dd></dl> |
|
|
305 |
|
|
|
306 |
<dl class="option"> |
|
|
307 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-i"> |
|
|
308 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_dir</code><code class="sig-prename descclassname"> <input_dir></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-i" title="Permalink to this definition">¶</a></dt> |
|
|
309 |
<dd><p>Input directory for patches. [default: ./inputs/]</p> |
|
|
310 |
</dd></dl> |
|
|
311 |
|
|
|
312 |
<dl class="option"> |
|
|
313 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-a"> |
|
|
314 |
<code class="sig-name descname">-a</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--annotations</code><code class="sig-prename descclassname"> <annotations></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-a" title="Permalink to this definition">¶</a></dt> |
|
|
315 |
<dd><p>Annotations in image in order. [default: ]</p> |
|
|
316 |
</dd></dl> |
|
|
317 |
|
|
|
318 |
<dl class="option"> |
|
|
319 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-pr"> |
|
|
320 |
<code class="sig-name descname">-pr</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--preprocess</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-pr" title="Permalink to this definition">¶</a></dt> |
|
|
321 |
<dd><p>Run preprocessing pipeline. [default: False]</p> |
|
|
322 |
</dd></dl> |
|
|
323 |
|
|
|
324 |
<dl class="option"> |
|
|
325 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-pa"> |
|
|
326 |
<code class="sig-name descname">-pa</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patches</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-pa" title="Permalink to this definition">¶</a></dt> |
|
|
327 |
<dd><p>Add patches to SQL. [default: False]</p> |
|
|
328 |
</dd></dl> |
|
|
329 |
|
|
|
330 |
<dl class="option"> |
|
|
331 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-t"> |
|
|
332 |
<code class="sig-name descname">-t</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--threshold</code><code class="sig-prename descclassname"> <threshold></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-t" title="Permalink to this definition">¶</a></dt> |
|
|
333 |
<dd><p>Threshold to remove non-purple slides. [default: 0.05]</p> |
|
|
334 |
</dd></dl> |
|
|
335 |
|
|
|
336 |
<dl class="option"> |
|
|
337 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-ps"> |
|
|
338 |
<code class="sig-name descname">-ps</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_size</code><code class="sig-prename descclassname"> <patch_size></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-ps" title="Permalink to this definition">¶</a></dt> |
|
|
339 |
<dd><p>Patch size. [default: 224]</p> |
|
|
340 |
</dd></dl> |
|
|
341 |
|
|
|
342 |
<dl class="option"> |
|
|
343 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-it"> |
|
|
344 |
<code class="sig-name descname">-it</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--intensity_threshold</code><code class="sig-prename descclassname"> <intensity_threshold></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-it" title="Permalink to this definition">¶</a></dt> |
|
|
345 |
<dd><p>Intensity threshold to rate a pixel as non-white. [default: 100.0]</p> |
|
|
346 |
</dd></dl> |
|
|
347 |
|
|
|
348 |
<dl class="option"> |
|
|
349 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-g"> |
|
|
350 |
<code class="sig-name descname">-g</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--generate_finetune_segmentation</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-g" title="Permalink to this definition">¶</a></dt> |
|
|
351 |
<dd><p>Generate patches for one segmentation mask class for targeted finetuning. [default: False]</p> |
|
|
352 |
</dd></dl> |
|
|
353 |
|
|
|
354 |
<dl class="option"> |
|
|
355 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-tc"> |
|
|
356 |
<code class="sig-name descname">-tc</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--target_segmentation_class</code><code class="sig-prename descclassname"> <target_segmentation_class></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-tc" title="Permalink to this definition">¶</a></dt> |
|
|
357 |
<dd><p>Segmentation Class to finetune on, output patches to another db. [default: 0]</p> |
|
|
358 |
</dd></dl> |
|
|
359 |
|
|
|
360 |
<dl class="option"> |
|
|
361 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-tt"> |
|
|
362 |
<code class="sig-name descname">-tt</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--target_threshold</code><code class="sig-prename descclassname"> <target_threshold></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-tt" title="Permalink to this definition">¶</a></dt> |
|
|
363 |
<dd><p>Threshold to include target for segmentation if saving one class. [default: 0.0]</p> |
|
|
364 |
</dd></dl> |
|
|
365 |
|
|
|
366 |
<dl class="option"> |
|
|
367 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-odb"> |
|
|
368 |
<code class="sig-name descname">-odb</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--out_db</code><code class="sig-prename descclassname"> <out_db></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-odb" title="Permalink to this definition">¶</a></dt> |
|
|
369 |
<dd><p>Output patch database. [default: ./patch_info.db]</p> |
|
|
370 |
</dd></dl> |
|
|
371 |
|
|
|
372 |
<dl class="option"> |
|
|
373 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-am"> |
|
|
374 |
<code class="sig-name descname">-am</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--adjust_mask</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-am" title="Permalink to this definition">¶</a></dt> |
|
|
375 |
<dd><p>Remove additional background regions from annotation mask. [default: False]</p> |
|
|
376 |
</dd></dl> |
|
|
377 |
|
|
|
378 |
<dl class="option"> |
|
|
379 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-nn"> |
|
|
380 |
<code class="sig-name descname">-nn</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_neighbors</code><code class="sig-prename descclassname"> <n_neighbors></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-nn" title="Permalink to this definition">¶</a></dt> |
|
|
381 |
<dd><p>If adjusting mask, number of neighbors connectivity to remove. [default: 5]</p> |
|
|
382 |
</dd></dl> |
|
|
383 |
|
|
|
384 |
<dl class="option"> |
|
|
385 |
<dt id="cmdoption-pathflowai-preprocess-preprocess-pipeline-bp"> |
|
|
386 |
<code class="sig-name descname">-bp</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basic_preprocess</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-preprocess-pipeline-bp" title="Permalink to this definition">¶</a></dt> |
|
|
387 |
<dd><p>Basic preprocessing pipeline, annotation areas are not saved. Used for benchmarking tool against comparable pipelines [default: False]</p> |
|
|
388 |
</dd></dl> |
|
|
389 |
|
|
|
390 |
</div> |
|
|
391 |
<div class="section" id="pathflowai-preprocess-remove-basename-from-db"> |
|
|
392 |
<h3>remove_basename_from_db<a class="headerlink" href="#pathflowai-preprocess-remove-basename-from-db" title="Permalink to this headline">¶</a></h3> |
|
|
393 |
<p>Removes basename/ID from SQL DB.</p> |
|
|
394 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-preprocess remove_basename_from_db <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
395 |
</pre></div> |
|
|
396 |
</div> |
|
|
397 |
<p class="rubric">Options</p> |
|
|
398 |
<dl class="option"> |
|
|
399 |
<dt id="cmdoption-pathflowai-preprocess-remove-basename-from-db-i"> |
|
|
400 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_patch_db</code><code class="sig-prename descclassname"> <input_patch_db></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-remove-basename-from-db-i" title="Permalink to this definition">¶</a></dt> |
|
|
401 |
<dd><p>Input db. [default: patch_info_input.db]</p> |
|
|
402 |
</dd></dl> |
|
|
403 |
|
|
|
404 |
<dl class="option"> |
|
|
405 |
<dt id="cmdoption-pathflowai-preprocess-remove-basename-from-db-o"> |
|
|
406 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--output_patch_db</code><code class="sig-prename descclassname"> <output_patch_db></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-remove-basename-from-db-o" title="Permalink to this definition">¶</a></dt> |
|
|
407 |
<dd><p>Output db. [default: patch_info_output.db]</p> |
|
|
408 |
</dd></dl> |
|
|
409 |
|
|
|
410 |
<dl class="option"> |
|
|
411 |
<dt id="cmdoption-pathflowai-preprocess-remove-basename-from-db-b"> |
|
|
412 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-remove-basename-from-db-b" title="Permalink to this definition">¶</a></dt> |
|
|
413 |
<dd><p>Basename. [default: A01]</p> |
|
|
414 |
</dd></dl> |
|
|
415 |
|
|
|
416 |
<dl class="option"> |
|
|
417 |
<dt id="cmdoption-pathflowai-preprocess-remove-basename-from-db-ps"> |
|
|
418 |
<code class="sig-name descname">-ps</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_size</code><code class="sig-prename descclassname"> <patch_size></code><a class="headerlink" href="#cmdoption-pathflowai-preprocess-remove-basename-from-db-ps" title="Permalink to this definition">¶</a></dt> |
|
|
419 |
<dd><p>Patch size. [default: 224]</p> |
|
|
420 |
</dd></dl> |
|
|
421 |
|
|
|
422 |
</div> |
|
|
423 |
</div> |
|
|
424 |
<div class="section" id="pathflowai-visualize"> |
|
|
425 |
<h2>pathflowai-visualize<a class="headerlink" href="#pathflowai-visualize" title="Permalink to this headline">¶</a></h2> |
|
|
426 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize <span class="o">[</span>OPTIONS<span class="o">]</span> COMMAND <span class="o">[</span>ARGS<span class="o">]</span>... |
|
|
427 |
</pre></div> |
|
|
428 |
</div> |
|
|
429 |
<p class="rubric">Options</p> |
|
|
430 |
<dl class="option"> |
|
|
431 |
<dt id="cmdoption-pathflowai-visualize-version"> |
|
|
432 |
<code class="sig-name descname">--version</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-version" title="Permalink to this definition">¶</a></dt> |
|
|
433 |
<dd><p>Show the version and exit.</p> |
|
|
434 |
</dd></dl> |
|
|
435 |
|
|
|
436 |
<div class="section" id="pathflowai-visualize-extract-patch"> |
|
|
437 |
<h3>extract_patch<a class="headerlink" href="#pathflowai-visualize-extract-patch" title="Permalink to this headline">¶</a></h3> |
|
|
438 |
<p>Extract image of patch of any size/location and output to image file</p> |
|
|
439 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize extract_patch <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
440 |
</pre></div> |
|
|
441 |
</div> |
|
|
442 |
<p class="rubric">Options</p> |
|
|
443 |
<dl class="option"> |
|
|
444 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-i"> |
|
|
445 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_dir</code><code class="sig-prename descclassname"> <input_dir></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-i" title="Permalink to this definition">¶</a></dt> |
|
|
446 |
<dd><p>Input directory for patches. [default: ./inputs/]</p> |
|
|
447 |
</dd></dl> |
|
|
448 |
|
|
|
449 |
<dl class="option"> |
|
|
450 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-b"> |
|
|
451 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-b" title="Permalink to this definition">¶</a></dt> |
|
|
452 |
<dd><p>Basename of patches. [default: A01]</p> |
|
|
453 |
</dd></dl> |
|
|
454 |
|
|
|
455 |
<dl class="option"> |
|
|
456 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-p"> |
|
|
457 |
<code class="sig-name descname">-p</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_info_file</code><code class="sig-prename descclassname"> <patch_info_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-p" title="Permalink to this definition">¶</a></dt> |
|
|
458 |
<dd><p>Datbase containing all patches [default: patch_info.db]</p> |
|
|
459 |
</dd></dl> |
|
|
460 |
|
|
|
461 |
<dl class="option"> |
|
|
462 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-ps"> |
|
|
463 |
<code class="sig-name descname">-ps</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_size</code><code class="sig-prename descclassname"> <patch_size></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-ps" title="Permalink to this definition">¶</a></dt> |
|
|
464 |
<dd><p>Patch size. [default: 224]</p> |
|
|
465 |
</dd></dl> |
|
|
466 |
|
|
|
467 |
<dl class="option"> |
|
|
468 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-x"> |
|
|
469 |
<code class="sig-name descname">-x</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--x</code><code class="sig-prename descclassname"> <x></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-x" title="Permalink to this definition">¶</a></dt> |
|
|
470 |
<dd><p>X Coordinate of patch. [default: 0]</p> |
|
|
471 |
</dd></dl> |
|
|
472 |
|
|
|
473 |
<dl class="option"> |
|
|
474 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-y"> |
|
|
475 |
<code class="sig-name descname">-y</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--y</code><code class="sig-prename descclassname"> <y></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-y" title="Permalink to this definition">¶</a></dt> |
|
|
476 |
<dd><p>Y coordinate of patch. [default: 0]</p> |
|
|
477 |
</dd></dl> |
|
|
478 |
|
|
|
479 |
<dl class="option"> |
|
|
480 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-o"> |
|
|
481 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfname</code><code class="sig-prename descclassname"> <outputfname></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-o" title="Permalink to this definition">¶</a></dt> |
|
|
482 |
<dd><p>Output extracted image. [default: ./output_image.png]</p> |
|
|
483 |
</dd></dl> |
|
|
484 |
|
|
|
485 |
<dl class="option"> |
|
|
486 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-s"> |
|
|
487 |
<code class="sig-name descname">-s</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--segmentation</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-s" title="Permalink to this definition">¶</a></dt> |
|
|
488 |
<dd><p>Plot segmentations. [default: False]</p> |
|
|
489 |
</dd></dl> |
|
|
490 |
|
|
|
491 |
<dl class="option"> |
|
|
492 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-sc"> |
|
|
493 |
<code class="sig-name descname">-sc</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_segmentation_classes</code><code class="sig-prename descclassname"> <n_segmentation_classes></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-sc" title="Permalink to this definition">¶</a></dt> |
|
|
494 |
<dd><p>Number segmentation classes [default: 4]</p> |
|
|
495 |
</dd></dl> |
|
|
496 |
|
|
|
497 |
<dl class="option"> |
|
|
498 |
<dt id="cmdoption-pathflowai-visualize-extract-patch-c"> |
|
|
499 |
<code class="sig-name descname">-c</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--custom_segmentation</code><code class="sig-prename descclassname"> <custom_segmentation></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-extract-patch-c" title="Permalink to this definition">¶</a></dt> |
|
|
500 |
<dd><p>Add custom segmentation map from prediction, in npy [default: ]</p> |
|
|
501 |
</dd></dl> |
|
|
502 |
|
|
|
503 |
</div> |
|
|
504 |
<div class="section" id="pathflowai-visualize-overlay-new-annotations"> |
|
|
505 |
<h3>overlay_new_annotations<a class="headerlink" href="#pathflowai-visualize-overlay-new-annotations" title="Permalink to this headline">¶</a></h3> |
|
|
506 |
<p>Custom annotations, in format [Point: x, y, Point: x, y … ] one line like this per polygon, overlap these polygons on top of WSI.</p> |
|
|
507 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize overlay_new_annotations <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
508 |
</pre></div> |
|
|
509 |
</div> |
|
|
510 |
<p class="rubric">Options</p> |
|
|
511 |
<dl class="option"> |
|
|
512 |
<dt id="cmdoption-pathflowai-visualize-overlay-new-annotations-i"> |
|
|
513 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--img_file</code><code class="sig-prename descclassname"> <img_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-overlay-new-annotations-i" title="Permalink to this definition">¶</a></dt> |
|
|
514 |
<dd><p>Input image. [default: image.txt]</p> |
|
|
515 |
</dd></dl> |
|
|
516 |
|
|
|
517 |
<dl class="option"> |
|
|
518 |
<dt id="cmdoption-pathflowai-visualize-overlay-new-annotations-a"> |
|
|
519 |
<code class="sig-name descname">-a</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--annotation_txt</code><code class="sig-prename descclassname"> <annotation_txt></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-overlay-new-annotations-a" title="Permalink to this definition">¶</a></dt> |
|
|
520 |
<dd><p>Column of annotations [default: annotation.txt]</p> |
|
|
521 |
</dd></dl> |
|
|
522 |
|
|
|
523 |
<dl class="option"> |
|
|
524 |
<dt id="cmdoption-pathflowai-visualize-overlay-new-annotations-ocf"> |
|
|
525 |
<code class="sig-name descname">-ocf</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--original_compression_factor</code><code class="sig-prename descclassname"> <original_compression_factor></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-overlay-new-annotations-ocf" title="Permalink to this definition">¶</a></dt> |
|
|
526 |
<dd><p>How much compress image. [default: 1.0]</p> |
|
|
527 |
</dd></dl> |
|
|
528 |
|
|
|
529 |
<dl class="option"> |
|
|
530 |
<dt id="cmdoption-pathflowai-visualize-overlay-new-annotations-cf"> |
|
|
531 |
<code class="sig-name descname">-cf</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--compression_factor</code><code class="sig-prename descclassname"> <compression_factor></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-overlay-new-annotations-cf" title="Permalink to this definition">¶</a></dt> |
|
|
532 |
<dd><p>How much compress image. [default: 3.0]</p> |
|
|
533 |
</dd></dl> |
|
|
534 |
|
|
|
535 |
<dl class="option"> |
|
|
536 |
<dt id="cmdoption-pathflowai-visualize-overlay-new-annotations-o"> |
|
|
537 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfilename</code><code class="sig-prename descclassname"> <outputfilename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-overlay-new-annotations-o" title="Permalink to this definition">¶</a></dt> |
|
|
538 |
<dd><p>Output extracted image. [default: ./output_image.png]</p> |
|
|
539 |
</dd></dl> |
|
|
540 |
|
|
|
541 |
</div> |
|
|
542 |
<div class="section" id="pathflowai-visualize-plot-embeddings"> |
|
|
543 |
<h3>plot_embeddings<a class="headerlink" href="#pathflowai-visualize-plot-embeddings" title="Permalink to this headline">¶</a></h3> |
|
|
544 |
<p>Perform UMAP embeddings of patches and plot using plotly.</p> |
|
|
545 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize plot_embeddings <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
546 |
</pre></div> |
|
|
547 |
</div> |
|
|
548 |
<p class="rubric">Options</p> |
|
|
549 |
<dl class="option"> |
|
|
550 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-i"> |
|
|
551 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--embeddings_file</code><code class="sig-prename descclassname"> <embeddings_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-i" title="Permalink to this definition">¶</a></dt> |
|
|
552 |
<dd><p>Embeddings. [default: predictions/embeddings.pkl]</p> |
|
|
553 |
</dd></dl> |
|
|
554 |
|
|
|
555 |
<dl class="option"> |
|
|
556 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-o"> |
|
|
557 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--plotly_output_file</code><code class="sig-prename descclassname"> <plotly_output_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-o" title="Permalink to this definition">¶</a></dt> |
|
|
558 |
<dd><p>Plotly output file. [default: predictions/embeddings.html]</p> |
|
|
559 |
</dd></dl> |
|
|
560 |
|
|
|
561 |
<dl class="option"> |
|
|
562 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-a"> |
|
|
563 |
<code class="sig-name descname">-a</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--annotations</code><code class="sig-prename descclassname"> <annotations></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-a" title="Permalink to this definition">¶</a></dt> |
|
|
564 |
<dd><p>Multiple annotations to color image. [default: ]</p> |
|
|
565 |
</dd></dl> |
|
|
566 |
|
|
|
567 |
<dl class="option"> |
|
|
568 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-rb"> |
|
|
569 |
<code class="sig-name descname">-rb</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--remove_background_annotation</code><code class="sig-prename descclassname"> <remove_background_annotation></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-rb" title="Permalink to this definition">¶</a></dt> |
|
|
570 |
<dd><p>If selected, removes 100% background patches based on this annotation. [default: ]</p> |
|
|
571 |
</dd></dl> |
|
|
572 |
|
|
|
573 |
<dl class="option"> |
|
|
574 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-ma"> |
|
|
575 |
<code class="sig-name descname">-ma</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--max_background_area</code><code class="sig-prename descclassname"> <max_background_area></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-ma" title="Permalink to this definition">¶</a></dt> |
|
|
576 |
<dd><p>Max background area before exclusion. [default: 0.05]</p> |
|
|
577 |
</dd></dl> |
|
|
578 |
|
|
|
579 |
<dl class="option"> |
|
|
580 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-b"> |
|
|
581 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-b" title="Permalink to this definition">¶</a></dt> |
|
|
582 |
<dd><p>Basename of patches. [default: ]</p> |
|
|
583 |
</dd></dl> |
|
|
584 |
|
|
|
585 |
<dl class="option"> |
|
|
586 |
<dt id="cmdoption-pathflowai-visualize-plot-embeddings-nn"> |
|
|
587 |
<code class="sig-name descname">-nn</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_neighbors</code><code class="sig-prename descclassname"> <n_neighbors></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-embeddings-nn" title="Permalink to this definition">¶</a></dt> |
|
|
588 |
<dd><p>Number nearest neighbors. [default: 8]</p> |
|
|
589 |
</dd></dl> |
|
|
590 |
|
|
|
591 |
</div> |
|
|
592 |
<div class="section" id="pathflowai-visualize-plot-image"> |
|
|
593 |
<h3>plot_image<a class="headerlink" href="#pathflowai-visualize-plot-image" title="Permalink to this headline">¶</a></h3> |
|
|
594 |
<p>Plots the whole slide image supplied.</p> |
|
|
595 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize plot_image <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
596 |
</pre></div> |
|
|
597 |
</div> |
|
|
598 |
<p class="rubric">Options</p> |
|
|
599 |
<dl class="option"> |
|
|
600 |
<dt id="cmdoption-pathflowai-visualize-plot-image-i"> |
|
|
601 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--image_file</code><code class="sig-prename descclassname"> <image_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-i" title="Permalink to this definition">¶</a></dt> |
|
|
602 |
<dd><p>Input image file. [default: ./inputs/a.svs]</p> |
|
|
603 |
</dd></dl> |
|
|
604 |
|
|
|
605 |
<dl class="option"> |
|
|
606 |
<dt id="cmdoption-pathflowai-visualize-plot-image-cf"> |
|
|
607 |
<code class="sig-name descname">-cf</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--compression_factor</code><code class="sig-prename descclassname"> <compression_factor></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-cf" title="Permalink to this definition">¶</a></dt> |
|
|
608 |
<dd><p>How much compress image. [default: 3.0]</p> |
|
|
609 |
</dd></dl> |
|
|
610 |
|
|
|
611 |
<dl class="option"> |
|
|
612 |
<dt id="cmdoption-pathflowai-visualize-plot-image-o"> |
|
|
613 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfname</code><code class="sig-prename descclassname"> <outputfname></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-o" title="Permalink to this definition">¶</a></dt> |
|
|
614 |
<dd><p>Output extracted image. [default: ./output_image.png]</p> |
|
|
615 |
</dd></dl> |
|
|
616 |
|
|
|
617 |
</div> |
|
|
618 |
<div class="section" id="pathflowai-visualize-plot-image-umap-embeddings"> |
|
|
619 |
<h3>plot_image_umap_embeddings<a class="headerlink" href="#pathflowai-visualize-plot-image-umap-embeddings" title="Permalink to this headline">¶</a></h3> |
|
|
620 |
<p>Plots a UMAP embedding with each point as its corresponding patch image.</p> |
|
|
621 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize plot_image_umap_embeddings <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
622 |
</pre></div> |
|
|
623 |
</div> |
|
|
624 |
<p class="rubric">Options</p> |
|
|
625 |
<dl class="option"> |
|
|
626 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-i"> |
|
|
627 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_dir</code><code class="sig-prename descclassname"> <input_dir></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-i" title="Permalink to this definition">¶</a></dt> |
|
|
628 |
<dd><p>Input directory for patches. [default: ./inputs/]</p> |
|
|
629 |
</dd></dl> |
|
|
630 |
|
|
|
631 |
<dl class="option"> |
|
|
632 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-e"> |
|
|
633 |
<code class="sig-name descname">-e</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--embeddings_file</code><code class="sig-prename descclassname"> <embeddings_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-e" title="Permalink to this definition">¶</a></dt> |
|
|
634 |
<dd><p>Embeddings. [default: predictions/embeddings.pkl]</p> |
|
|
635 |
</dd></dl> |
|
|
636 |
|
|
|
637 |
<dl class="option"> |
|
|
638 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-b"> |
|
|
639 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-b" title="Permalink to this definition">¶</a></dt> |
|
|
640 |
<dd><p>Basename of patches. [default: ]</p> |
|
|
641 |
</dd></dl> |
|
|
642 |
|
|
|
643 |
<dl class="option"> |
|
|
644 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-o"> |
|
|
645 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfilename</code><code class="sig-prename descclassname"> <outputfilename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-o" title="Permalink to this definition">¶</a></dt> |
|
|
646 |
<dd><p>Embedding visualization. [default: predictions/shap_plots.png]</p> |
|
|
647 |
</dd></dl> |
|
|
648 |
|
|
|
649 |
<dl class="option"> |
|
|
650 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-mpl"> |
|
|
651 |
<code class="sig-name descname">-mpl</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--mpl_scatter</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-mpl" title="Permalink to this definition">¶</a></dt> |
|
|
652 |
<dd><p>Plot segmentations. [default: False]</p> |
|
|
653 |
</dd></dl> |
|
|
654 |
|
|
|
655 |
<dl class="option"> |
|
|
656 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-rb"> |
|
|
657 |
<code class="sig-name descname">-rb</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--remove_background_annotation</code><code class="sig-prename descclassname"> <remove_background_annotation></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-rb" title="Permalink to this definition">¶</a></dt> |
|
|
658 |
<dd><p>If selected, removes 100% background patches based on this annotation. [default: ]</p> |
|
|
659 |
</dd></dl> |
|
|
660 |
|
|
|
661 |
<dl class="option"> |
|
|
662 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-ma"> |
|
|
663 |
<code class="sig-name descname">-ma</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--max_background_area</code><code class="sig-prename descclassname"> <max_background_area></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-ma" title="Permalink to this definition">¶</a></dt> |
|
|
664 |
<dd><p>Max background area before exclusion. [default: 0.05]</p> |
|
|
665 |
</dd></dl> |
|
|
666 |
|
|
|
667 |
<dl class="option"> |
|
|
668 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-z"> |
|
|
669 |
<code class="sig-name descname">-z</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--zoom</code><code class="sig-prename descclassname"> <zoom></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-z" title="Permalink to this definition">¶</a></dt> |
|
|
670 |
<dd><p>Size of images. [default: 0.05]</p> |
|
|
671 |
</dd></dl> |
|
|
672 |
|
|
|
673 |
<dl class="option"> |
|
|
674 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-nn"> |
|
|
675 |
<code class="sig-name descname">-nn</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_neighbors</code><code class="sig-prename descclassname"> <n_neighbors></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-nn" title="Permalink to this definition">¶</a></dt> |
|
|
676 |
<dd><p>Number nearest neighbors. [default: 8]</p> |
|
|
677 |
</dd></dl> |
|
|
678 |
|
|
|
679 |
<dl class="option"> |
|
|
680 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-sc"> |
|
|
681 |
<code class="sig-name descname">-sc</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--sort_col</code><code class="sig-prename descclassname"> <sort_col></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-sc" title="Permalink to this definition">¶</a></dt> |
|
|
682 |
<dd><p>Sort samples on this column. [default: ]</p> |
|
|
683 |
</dd></dl> |
|
|
684 |
|
|
|
685 |
<dl class="option"> |
|
|
686 |
<dt id="cmdoption-pathflowai-visualize-plot-image-umap-embeddings-sm"> |
|
|
687 |
<code class="sig-name descname">-sm</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--sort_mode</code><code class="sig-prename descclassname"> <sort_mode></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-image-umap-embeddings-sm" title="Permalink to this definition">¶</a></dt> |
|
|
688 |
<dd><p>Sort ascending or descending. [default: asc]</p> |
|
|
689 |
<dl class="field-list simple"> |
|
|
690 |
<dt class="field-odd">Options</dt> |
|
|
691 |
<dd class="field-odd"><p>asc|desc</p> |
|
|
692 |
</dd> |
|
|
693 |
</dl> |
|
|
694 |
</dd></dl> |
|
|
695 |
|
|
|
696 |
</div> |
|
|
697 |
<div class="section" id="pathflowai-visualize-plot-predictions"> |
|
|
698 |
<h3>plot_predictions<a class="headerlink" href="#pathflowai-visualize-plot-predictions" title="Permalink to this headline">¶</a></h3> |
|
|
699 |
<p>Overlays classification, regression and segmentation patch level predictions on top of whole slide image.</p> |
|
|
700 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize plot_predictions <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
701 |
</pre></div> |
|
|
702 |
</div> |
|
|
703 |
<p class="rubric">Options</p> |
|
|
704 |
<dl class="option"> |
|
|
705 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-i"> |
|
|
706 |
<code class="sig-name descname">-i</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--input_dir</code><code class="sig-prename descclassname"> <input_dir></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-i" title="Permalink to this definition">¶</a></dt> |
|
|
707 |
<dd><p>Input directory for patches. [default: ./inputs/]</p> |
|
|
708 |
</dd></dl> |
|
|
709 |
|
|
|
710 |
<dl class="option"> |
|
|
711 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-b"> |
|
|
712 |
<code class="sig-name descname">-b</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--basename</code><code class="sig-prename descclassname"> <basename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-b" title="Permalink to this definition">¶</a></dt> |
|
|
713 |
<dd><p>Basename of patches. [default: A01]</p> |
|
|
714 |
</dd></dl> |
|
|
715 |
|
|
|
716 |
<dl class="option"> |
|
|
717 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-p"> |
|
|
718 |
<code class="sig-name descname">-p</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_info_file</code><code class="sig-prename descclassname"> <patch_info_file></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-p" title="Permalink to this definition">¶</a></dt> |
|
|
719 |
<dd><p>Datbase containing all patches [default: patch_info.db]</p> |
|
|
720 |
</dd></dl> |
|
|
721 |
|
|
|
722 |
<dl class="option"> |
|
|
723 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-ps"> |
|
|
724 |
<code class="sig-name descname">-ps</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--patch_size</code><code class="sig-prename descclassname"> <patch_size></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-ps" title="Permalink to this definition">¶</a></dt> |
|
|
725 |
<dd><p>Patch size. [default: 224]</p> |
|
|
726 |
</dd></dl> |
|
|
727 |
|
|
|
728 |
<dl class="option"> |
|
|
729 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-o"> |
|
|
730 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfname</code><code class="sig-prename descclassname"> <outputfname></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-o" title="Permalink to this definition">¶</a></dt> |
|
|
731 |
<dd><p>Output extracted image. [default: ./output_image.png]</p> |
|
|
732 |
</dd></dl> |
|
|
733 |
|
|
|
734 |
<dl class="option"> |
|
|
735 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-an"> |
|
|
736 |
<code class="sig-name descname">-an</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--annotations</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-an" title="Permalink to this definition">¶</a></dt> |
|
|
737 |
<dd><p>Plot annotations instead of predictions. [default: False]</p> |
|
|
738 |
</dd></dl> |
|
|
739 |
|
|
|
740 |
<dl class="option"> |
|
|
741 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-cf"> |
|
|
742 |
<code class="sig-name descname">-cf</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--compression_factor</code><code class="sig-prename descclassname"> <compression_factor></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-cf" title="Permalink to this definition">¶</a></dt> |
|
|
743 |
<dd><p>How much compress image. [default: 3.0]</p> |
|
|
744 |
</dd></dl> |
|
|
745 |
|
|
|
746 |
<dl class="option"> |
|
|
747 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-al"> |
|
|
748 |
<code class="sig-name descname">-al</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--alpha</code><code class="sig-prename descclassname"> <alpha></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-al" title="Permalink to this definition">¶</a></dt> |
|
|
749 |
<dd><p>How much to give annotations/predictions versus original image. [default: 0.8]</p> |
|
|
750 |
</dd></dl> |
|
|
751 |
|
|
|
752 |
<dl class="option"> |
|
|
753 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-s"> |
|
|
754 |
<code class="sig-name descname">-s</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--segmentation</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-s" title="Permalink to this definition">¶</a></dt> |
|
|
755 |
<dd><p>Plot segmentations. [default: False]</p> |
|
|
756 |
</dd></dl> |
|
|
757 |
|
|
|
758 |
<dl class="option"> |
|
|
759 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-sc"> |
|
|
760 |
<code class="sig-name descname">-sc</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_segmentation_classes</code><code class="sig-prename descclassname"> <n_segmentation_classes></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-sc" title="Permalink to this definition">¶</a></dt> |
|
|
761 |
<dd><p>Number segmentation classes [default: 4]</p> |
|
|
762 |
</dd></dl> |
|
|
763 |
|
|
|
764 |
<dl class="option"> |
|
|
765 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-c"> |
|
|
766 |
<code class="sig-name descname">-c</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--custom_segmentation</code><code class="sig-prename descclassname"> <custom_segmentation></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-c" title="Permalink to this definition">¶</a></dt> |
|
|
767 |
<dd><p>Add custom segmentation map from prediction, npy format. [default: ]</p> |
|
|
768 |
</dd></dl> |
|
|
769 |
|
|
|
770 |
<dl class="option"> |
|
|
771 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-ac"> |
|
|
772 |
<code class="sig-name descname">-ac</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--annotation_col</code><code class="sig-prename descclassname"> <annotation_col></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-ac" title="Permalink to this definition">¶</a></dt> |
|
|
773 |
<dd><p>Column of annotations [default: annotation]</p> |
|
|
774 |
</dd></dl> |
|
|
775 |
|
|
|
776 |
<dl class="option"> |
|
|
777 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-sf"> |
|
|
778 |
<code class="sig-name descname">-sf</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--scaling_factor</code><code class="sig-prename descclassname"> <scaling_factor></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-sf" title="Permalink to this definition">¶</a></dt> |
|
|
779 |
<dd><p>Multiply all prediction scores by this amount. [default: 1.0]</p> |
|
|
780 |
</dd></dl> |
|
|
781 |
|
|
|
782 |
<dl class="option"> |
|
|
783 |
<dt id="cmdoption-pathflowai-visualize-plot-predictions-tif"> |
|
|
784 |
<code class="sig-name descname">-tif</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--tif_file</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-plot-predictions-tif" title="Permalink to this definition">¶</a></dt> |
|
|
785 |
<dd><p>Write to tiff file. [default: False]</p> |
|
|
786 |
</dd></dl> |
|
|
787 |
|
|
|
788 |
</div> |
|
|
789 |
<div class="section" id="pathflowai-visualize-shapley-plot"> |
|
|
790 |
<h3>shapley_plot<a class="headerlink" href="#pathflowai-visualize-shapley-plot" title="Permalink to this headline">¶</a></h3> |
|
|
791 |
<p>Run SHAPley attribution method on patches after classification task to see where model made prediction based on.</p> |
|
|
792 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-visualize shapley_plot <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
793 |
</pre></div> |
|
|
794 |
</div> |
|
|
795 |
<p class="rubric">Options</p> |
|
|
796 |
<dl class="option"> |
|
|
797 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-m"> |
|
|
798 |
<code class="sig-name descname">-m</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--model_pkl</code><code class="sig-prename descclassname"> <model_pkl></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-m" title="Permalink to this definition">¶</a></dt> |
|
|
799 |
<dd><p>Plotly output file. [default: ]</p> |
|
|
800 |
</dd></dl> |
|
|
801 |
|
|
|
802 |
<dl class="option"> |
|
|
803 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-bs"> |
|
|
804 |
<code class="sig-name descname">-bs</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--batch_size</code><code class="sig-prename descclassname"> <batch_size></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-bs" title="Permalink to this definition">¶</a></dt> |
|
|
805 |
<dd><p>Batch size. [default: 32]</p> |
|
|
806 |
</dd></dl> |
|
|
807 |
|
|
|
808 |
<dl class="option"> |
|
|
809 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-o"> |
|
|
810 |
<code class="sig-name descname">-o</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--outputfilename</code><code class="sig-prename descclassname"> <outputfilename></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-o" title="Permalink to this definition">¶</a></dt> |
|
|
811 |
<dd><p>SHAPley visualization. [default: predictions/shap_plots.png]</p> |
|
|
812 |
</dd></dl> |
|
|
813 |
|
|
|
814 |
<dl class="option"> |
|
|
815 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-mth"> |
|
|
816 |
<code class="sig-name descname">-mth</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--method</code><code class="sig-prename descclassname"> <method></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-mth" title="Permalink to this definition">¶</a></dt> |
|
|
817 |
<dd><p>Method of explaining. [default: deep]</p> |
|
|
818 |
<dl class="field-list simple"> |
|
|
819 |
<dt class="field-odd">Options</dt> |
|
|
820 |
<dd class="field-odd"><p>deep|gradient</p> |
|
|
821 |
</dd> |
|
|
822 |
</dl> |
|
|
823 |
</dd></dl> |
|
|
824 |
|
|
|
825 |
<dl class="option"> |
|
|
826 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-l"> |
|
|
827 |
<code class="sig-name descname">-l</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--local_smoothing</code><code class="sig-prename descclassname"> <local_smoothing></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-l" title="Permalink to this definition">¶</a></dt> |
|
|
828 |
<dd><p>Local smoothing of SHAP scores. [default: 0.0]</p> |
|
|
829 |
</dd></dl> |
|
|
830 |
|
|
|
831 |
<dl class="option"> |
|
|
832 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-ns"> |
|
|
833 |
<code class="sig-name descname">-ns</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--n_samples</code><code class="sig-prename descclassname"> <n_samples></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-ns" title="Permalink to this definition">¶</a></dt> |
|
|
834 |
<dd><p>Number shapley samples for shapley regression (gradient explainer). [default: 32]</p> |
|
|
835 |
</dd></dl> |
|
|
836 |
|
|
|
837 |
<dl class="option"> |
|
|
838 |
<dt id="cmdoption-pathflowai-visualize-shapley-plot-p"> |
|
|
839 |
<code class="sig-name descname">-p</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--pred_out</code><code class="sig-prename descclassname"> <pred_out></code><a class="headerlink" href="#cmdoption-pathflowai-visualize-shapley-plot-p" title="Permalink to this definition">¶</a></dt> |
|
|
840 |
<dd><p>If not none, output prediction as shap label. [default: none]</p> |
|
|
841 |
<dl class="field-list simple"> |
|
|
842 |
<dt class="field-odd">Options</dt> |
|
|
843 |
<dd class="field-odd"><p>none|sigmoid|softmax</p> |
|
|
844 |
</dd> |
|
|
845 |
</dl> |
|
|
846 |
</dd></dl> |
|
|
847 |
|
|
|
848 |
</div> |
|
|
849 |
</div> |
|
|
850 |
<div class="section" id="pathflowai-monitor"> |
|
|
851 |
<h2>pathflowai-monitor<a class="headerlink" href="#pathflowai-monitor" title="Permalink to this headline">¶</a></h2> |
|
|
852 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-monitor <span class="o">[</span>OPTIONS<span class="o">]</span> COMMAND <span class="o">[</span>ARGS<span class="o">]</span>... |
|
|
853 |
</pre></div> |
|
|
854 |
</div> |
|
|
855 |
<p class="rubric">Options</p> |
|
|
856 |
<dl class="option"> |
|
|
857 |
<dt id="cmdoption-pathflowai-monitor-version"> |
|
|
858 |
<code class="sig-name descname">--version</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pathflowai-monitor-version" title="Permalink to this definition">¶</a></dt> |
|
|
859 |
<dd><p>Show the version and exit.</p> |
|
|
860 |
</dd></dl> |
|
|
861 |
|
|
|
862 |
<div class="section" id="pathflowai-monitor-monitor-usage"> |
|
|
863 |
<h3>monitor_usage<a class="headerlink" href="#pathflowai-monitor-monitor-usage" title="Permalink to this headline">¶</a></h3> |
|
|
864 |
<p>Monitor Usage over Time Interval.</p> |
|
|
865 |
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pathflowai-monitor monitor_usage <span class="o">[</span>OPTIONS<span class="o">]</span> |
|
|
866 |
</pre></div> |
|
|
867 |
</div> |
|
|
868 |
<p class="rubric">Options</p> |
|
|
869 |
<dl class="option"> |
|
|
870 |
<dt id="cmdoption-pathflowai-monitor-monitor-usage-csv"> |
|
|
871 |
<code class="sig-name descname">-csv</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--records_output_csv</code><code class="sig-prename descclassname"> <records_output_csv></code><a class="headerlink" href="#cmdoption-pathflowai-monitor-monitor-usage-csv" title="Permalink to this definition">¶</a></dt> |
|
|
872 |
<dd><p>Where to store records. [default: records.csv]</p> |
|
|
873 |
</dd></dl> |
|
|
874 |
|
|
|
875 |
<dl class="option"> |
|
|
876 |
<dt id="cmdoption-pathflowai-monitor-monitor-usage-tt"> |
|
|
877 |
<code class="sig-name descname">-tt</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--total_time</code><code class="sig-prename descclassname"> <total_time></code><a class="headerlink" href="#cmdoption-pathflowai-monitor-monitor-usage-tt" title="Permalink to this definition">¶</a></dt> |
|
|
878 |
<dd><p>Total time to monitor for in minutes. [default: 1.0]</p> |
|
|
879 |
</dd></dl> |
|
|
880 |
|
|
|
881 |
<dl class="option"> |
|
|
882 |
<dt id="cmdoption-pathflowai-monitor-monitor-usage-dt"> |
|
|
883 |
<code class="sig-name descname">-dt</code><code class="sig-prename descclassname"></code><code class="sig-prename descclassname">, </code><code class="sig-name descname">--delay_time</code><code class="sig-prename descclassname"> <delay_time></code><a class="headerlink" href="#cmdoption-pathflowai-monitor-monitor-usage-dt" title="Permalink to this definition">¶</a></dt> |
|
|
884 |
<dd><p>Time between samples, in seconds. [default: 1.0]</p> |
|
|
885 |
</dd></dl> |
|
|
886 |
|
|
|
887 |
</div> |
|
|
888 |
</div> |
|
|
889 |
<span class="target" id="module-pathflowai.datasets"></span><div class="section" id="datasets-py"> |
|
|
890 |
<h2>datasets.py<a class="headerlink" href="#datasets-py" title="Permalink to this headline">¶</a></h2> |
|
|
891 |
<p>Houses the DynamicImageDataset class, also functions to help with image color channel normalization, transformers, etc..</p> |
|
|
892 |
<dl class="class"> |
|
|
893 |
<dt id="pathflowai.datasets.DynamicImageDataset"> |
|
|
894 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">DynamicImageDataset</code><span class="sig-paren">(</span><em class="sig-param">dataset_df</em>, <em class="sig-param">set</em>, <em class="sig-param">patch_info_file</em>, <em class="sig-param">transformers</em>, <em class="sig-param">input_dir</em>, <em class="sig-param">target_names</em>, <em class="sig-param">pos_annotation_class</em>, <em class="sig-param">other_annotations=[]</em>, <em class="sig-param">segmentation=False</em>, <em class="sig-param">patch_size=224</em>, <em class="sig-param">fix_names=True</em>, <em class="sig-param">target_segmentation_class=-1</em>, <em class="sig-param">target_threshold=0.0</em>, <em class="sig-param">oversampling_factor=1.0</em>, <em class="sig-param">n_segmentation_classes=4</em>, <em class="sig-param">gdl=False</em>, <em class="sig-param">mt_bce=False</em>, <em class="sig-param">classify_annotations=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset" title="Permalink to this definition">¶</a></dt> |
|
|
895 |
<dd><p>Generate image dataset that accesses images and annotations via dask.</p> |
|
|
896 |
<dl class="field-list simple"> |
|
|
897 |
<dt class="field-odd">Parameters</dt> |
|
|
898 |
<dd class="field-odd"><dl class="simple"> |
|
|
899 |
<dt><strong>dataset_df:dataframe</strong></dt><dd><p>Dataframe with WSI, which set it is in (train/test/val) and corresponding WSI labels if applicable.</p> |
|
|
900 |
</dd> |
|
|
901 |
<dt><strong>set:str</strong></dt><dd><p>Whether train, test, val or pass (normalization) set.</p> |
|
|
902 |
</dd> |
|
|
903 |
<dt><strong>patch_info_file:str</strong></dt><dd><p>SQL db with positional and annotation information on each slide.</p> |
|
|
904 |
</dd> |
|
|
905 |
<dt><strong>transformers:dict</strong></dt><dd><p>Contains transformers to apply on images.</p> |
|
|
906 |
</dd> |
|
|
907 |
<dt><strong>input_dir:str</strong></dt><dd><p>Directory where images comes from.</p> |
|
|
908 |
</dd> |
|
|
909 |
<dt><strong>target_names:list/str</strong></dt><dd><p>Names of initial targets, which may be modified.</p> |
|
|
910 |
</dd> |
|
|
911 |
<dt><strong>pos_annotation_class:str</strong></dt><dd><p>If selected and predicting on WSI, this class is labeled as a positive from the WSI, while the other classes are not.</p> |
|
|
912 |
</dd> |
|
|
913 |
<dt><strong>other_annotations:list</strong></dt><dd><p>Other annotations to consider from patch info db.</p> |
|
|
914 |
</dd> |
|
|
915 |
<dt><strong>segmentation:bool</strong></dt><dd><p>Conducting segmentation task?</p> |
|
|
916 |
</dd> |
|
|
917 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
918 |
</dd> |
|
|
919 |
<dt><strong>fix_names:bool</strong></dt><dd><p>Whether to change the names of dataset_df.</p> |
|
|
920 |
</dd> |
|
|
921 |
<dt><strong>target_segmentation_class:list</strong></dt><dd><p>Now can be used for classification as well, matched with two below options, samples images only from this class. Can specify this and below two options multiple times.</p> |
|
|
922 |
</dd> |
|
|
923 |
<dt><strong>target_threshold:list</strong></dt><dd><p>Sampled only if above this threshold of occurence in the patches.</p> |
|
|
924 |
</dd> |
|
|
925 |
<dt><strong>oversampling_factor:list</strong></dt><dd><p>Over sample them at this amount.</p> |
|
|
926 |
</dd> |
|
|
927 |
<dt><strong>n_segmentation_classes:int</strong></dt><dd><p>Number classes to segment.</p> |
|
|
928 |
</dd> |
|
|
929 |
<dt><strong>gdl:bool</strong></dt><dd><p>Using generalized dice loss?</p> |
|
|
930 |
</dd> |
|
|
931 |
<dt><strong>mt_bce:bool</strong></dt><dd><p>For multi-target prediction tasks.</p> |
|
|
932 |
</dd> |
|
|
933 |
<dt><strong>classify_annotations:bool</strong></dt><dd><p>For classifying annotations.</p> |
|
|
934 |
</dd> |
|
|
935 |
</dl> |
|
|
936 |
</dd> |
|
|
937 |
</dl> |
|
|
938 |
<p class="rubric">Methods</p> |
|
|
939 |
<table class="longtable docutils align-default"> |
|
|
940 |
<colgroup> |
|
|
941 |
<col style="width: 10%" /> |
|
|
942 |
<col style="width: 90%" /> |
|
|
943 |
</colgroup> |
|
|
944 |
<tbody> |
|
|
945 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.binarize_annotations" title="pathflowai.datasets.DynamicImageDataset.binarize_annotations"><code class="xref py py-obj docutils literal notranslate"><span class="pre">binarize_annotations</span></code></a>(self[, binarizer, …])</p></td> |
|
|
946 |
<td><p>Label binarize some annotations or threshold them if classifying slide annotations.</p></td> |
|
|
947 |
</tr> |
|
|
948 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.concat" title="pathflowai.datasets.DynamicImageDataset.concat"><code class="xref py py-obj docutils literal notranslate"><span class="pre">concat</span></code></a>(self, other_dataset)</p></td> |
|
|
949 |
<td><p>Concatenate this dataset with others.</p></td> |
|
|
950 |
</tr> |
|
|
951 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.get_class_weights" title="pathflowai.datasets.DynamicImageDataset.get_class_weights"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_class_weights</span></code></a>(self[, i])</p></td> |
|
|
952 |
<td><p>Weight loss function with weights inversely proportional to the class appearence.</p></td> |
|
|
953 |
</tr> |
|
|
954 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.retain_ID" title="pathflowai.datasets.DynamicImageDataset.retain_ID"><code class="xref py py-obj docutils literal notranslate"><span class="pre">retain_ID</span></code></a>(self, ID)</p></td> |
|
|
955 |
<td><p>Reduce the sample set to just images from one ID.</p></td> |
|
|
956 |
</tr> |
|
|
957 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.split_by_ID" title="pathflowai.datasets.DynamicImageDataset.split_by_ID"><code class="xref py py-obj docutils literal notranslate"><span class="pre">split_by_ID</span></code></a>(self)</p></td> |
|
|
958 |
<td><p>Generator similar to groupby, but splits up by ID, generates (ID,data) using retain_ID.</p></td> |
|
|
959 |
</tr> |
|
|
960 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.datasets.DynamicImageDataset.subsample" title="pathflowai.datasets.DynamicImageDataset.subsample"><code class="xref py py-obj docutils literal notranslate"><span class="pre">subsample</span></code></a>(self, p)</p></td> |
|
|
961 |
<td><p>Sample subset of dataset.</p></td> |
|
|
962 |
</tr> |
|
|
963 |
</tbody> |
|
|
964 |
</table> |
|
|
965 |
<dl class="method"> |
|
|
966 |
<dt id="pathflowai.datasets.DynamicImageDataset.binarize_annotations"> |
|
|
967 |
<code class="sig-name descname">binarize_annotations</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">binarizer=None</em>, <em class="sig-param">num_targets=1</em>, <em class="sig-param">binary_threshold=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.binarize_annotations"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.binarize_annotations" title="Permalink to this definition">¶</a></dt> |
|
|
968 |
<dd><p>Label binarize some annotations or threshold them if classifying slide annotations.</p> |
|
|
969 |
<dl class="field-list simple"> |
|
|
970 |
<dt class="field-odd">Parameters</dt> |
|
|
971 |
<dd class="field-odd"><dl class="simple"> |
|
|
972 |
<dt><strong>binarizer:LabelBinarizer</strong></dt><dd><p>Binarizes the labels of a column(s)</p> |
|
|
973 |
</dd> |
|
|
974 |
<dt><strong>num_targets:int</strong></dt><dd><p>Number of desired targets to preidict on.</p> |
|
|
975 |
</dd> |
|
|
976 |
<dt><strong>binary_threshold:float</strong></dt><dd><p>Amount of annotation in patch before positive annotation.</p> |
|
|
977 |
</dd> |
|
|
978 |
</dl> |
|
|
979 |
</dd> |
|
|
980 |
<dt class="field-even">Returns</dt> |
|
|
981 |
<dd class="field-even"><dl class="simple"> |
|
|
982 |
<dt>binarizer</dt><dd></dd> |
|
|
983 |
</dl> |
|
|
984 |
</dd> |
|
|
985 |
</dl> |
|
|
986 |
</dd></dl> |
|
|
987 |
|
|
|
988 |
<dl class="method"> |
|
|
989 |
<dt id="pathflowai.datasets.DynamicImageDataset.concat"> |
|
|
990 |
<code class="sig-name descname">concat</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">other_dataset</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.concat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.concat" title="Permalink to this definition">¶</a></dt> |
|
|
991 |
<dd><p>Concatenate this dataset with others. Updates its own internal attributes.</p> |
|
|
992 |
<dl class="field-list simple"> |
|
|
993 |
<dt class="field-odd">Parameters</dt> |
|
|
994 |
<dd class="field-odd"><dl class="simple"> |
|
|
995 |
<dt><strong>other_dataset:DynamicImageDataset</strong></dt><dd><p>Other image dataset.</p> |
|
|
996 |
</dd> |
|
|
997 |
</dl> |
|
|
998 |
</dd> |
|
|
999 |
</dl> |
|
|
1000 |
</dd></dl> |
|
|
1001 |
|
|
|
1002 |
<dl class="method"> |
|
|
1003 |
<dt id="pathflowai.datasets.DynamicImageDataset.get_class_weights"> |
|
|
1004 |
<code class="sig-name descname">get_class_weights</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">i=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.get_class_weights"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.get_class_weights" title="Permalink to this definition">¶</a></dt> |
|
|
1005 |
<dd><p>Weight loss function with weights inversely proportional to the class appearence.</p> |
|
|
1006 |
<dl class="field-list simple"> |
|
|
1007 |
<dt class="field-odd">Parameters</dt> |
|
|
1008 |
<dd class="field-odd"><dl class="simple"> |
|
|
1009 |
<dt><strong>i:int</strong></dt><dd><p>If multi-target, class used for weighting.</p> |
|
|
1010 |
</dd> |
|
|
1011 |
</dl> |
|
|
1012 |
</dd> |
|
|
1013 |
<dt class="field-even">Returns</dt> |
|
|
1014 |
<dd class="field-even"><dl class="simple"> |
|
|
1015 |
<dt>self</dt><dd><p>Dataset.</p> |
|
|
1016 |
</dd> |
|
|
1017 |
</dl> |
|
|
1018 |
</dd> |
|
|
1019 |
</dl> |
|
|
1020 |
</dd></dl> |
|
|
1021 |
|
|
|
1022 |
<dl class="method"> |
|
|
1023 |
<dt id="pathflowai.datasets.DynamicImageDataset.retain_ID"> |
|
|
1024 |
<code class="sig-name descname">retain_ID</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">ID</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.retain_ID"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.retain_ID" title="Permalink to this definition">¶</a></dt> |
|
|
1025 |
<dd><p>Reduce the sample set to just images from one ID.</p> |
|
|
1026 |
<dl class="field-list simple"> |
|
|
1027 |
<dt class="field-odd">Parameters</dt> |
|
|
1028 |
<dd class="field-odd"><dl class="simple"> |
|
|
1029 |
<dt><strong>ID:str</strong></dt><dd><p>Basename/ID to predict on.</p> |
|
|
1030 |
</dd> |
|
|
1031 |
</dl> |
|
|
1032 |
</dd> |
|
|
1033 |
<dt class="field-even">Returns</dt> |
|
|
1034 |
<dd class="field-even"><dl class="simple"> |
|
|
1035 |
<dt>self</dt><dd></dd> |
|
|
1036 |
</dl> |
|
|
1037 |
</dd> |
|
|
1038 |
</dl> |
|
|
1039 |
</dd></dl> |
|
|
1040 |
|
|
|
1041 |
<dl class="method"> |
|
|
1042 |
<dt id="pathflowai.datasets.DynamicImageDataset.split_by_ID"> |
|
|
1043 |
<code class="sig-name descname">split_by_ID</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.split_by_ID"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.split_by_ID" title="Permalink to this definition">¶</a></dt> |
|
|
1044 |
<dd><p>Generator similar to groupby, but splits up by ID, generates (ID,data) using retain_ID.</p> |
|
|
1045 |
<dl class="field-list simple"> |
|
|
1046 |
<dt class="field-odd">Returns</dt> |
|
|
1047 |
<dd class="field-odd"><dl class="simple"> |
|
|
1048 |
<dt>generator</dt><dd><p>ID, DynamicDataset</p> |
|
|
1049 |
</dd> |
|
|
1050 |
</dl> |
|
|
1051 |
</dd> |
|
|
1052 |
</dl> |
|
|
1053 |
</dd></dl> |
|
|
1054 |
|
|
|
1055 |
<dl class="method"> |
|
|
1056 |
<dt id="pathflowai.datasets.DynamicImageDataset.subsample"> |
|
|
1057 |
<code class="sig-name descname">subsample</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#DynamicImageDataset.subsample"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.DynamicImageDataset.subsample" title="Permalink to this definition">¶</a></dt> |
|
|
1058 |
<dd><p>Sample subset of dataset.</p> |
|
|
1059 |
<dl class="field-list simple"> |
|
|
1060 |
<dt class="field-odd">Parameters</dt> |
|
|
1061 |
<dd class="field-odd"><dl class="simple"> |
|
|
1062 |
<dt><strong>p:float</strong></dt><dd><p>Fraction to subsample.</p> |
|
|
1063 |
</dd> |
|
|
1064 |
</dl> |
|
|
1065 |
</dd> |
|
|
1066 |
</dl> |
|
|
1067 |
</dd></dl> |
|
|
1068 |
|
|
|
1069 |
</dd></dl> |
|
|
1070 |
|
|
|
1071 |
<dl class="function"> |
|
|
1072 |
<dt id="pathflowai.datasets.RandomRotate90"> |
|
|
1073 |
<code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">RandomRotate90</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#RandomRotate90"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.RandomRotate90" title="Permalink to this definition">¶</a></dt> |
|
|
1074 |
<dd><p>Transformer for random 90 degree rotation image.</p> |
|
|
1075 |
<dl class="field-list simple"> |
|
|
1076 |
<dt class="field-odd">Returns</dt> |
|
|
1077 |
<dd class="field-odd"><dl class="simple"> |
|
|
1078 |
<dt>function</dt><dd><p>Transformer function for operation.</p> |
|
|
1079 |
</dd> |
|
|
1080 |
</dl> |
|
|
1081 |
</dd> |
|
|
1082 |
</dl> |
|
|
1083 |
</dd></dl> |
|
|
1084 |
|
|
|
1085 |
<dl class="function"> |
|
|
1086 |
<dt id="pathflowai.datasets.create_transforms"> |
|
|
1087 |
<code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">create_transforms</code><span class="sig-paren">(</span><em class="sig-param">mean</em>, <em class="sig-param">std</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#create_transforms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.create_transforms" title="Permalink to this definition">¶</a></dt> |
|
|
1088 |
<dd><p>Create transformers.</p> |
|
|
1089 |
<dl class="field-list simple"> |
|
|
1090 |
<dt class="field-odd">Parameters</dt> |
|
|
1091 |
<dd class="field-odd"><dl class="simple"> |
|
|
1092 |
<dt><strong>mean:list</strong></dt><dd><p>See get_data_transforms.</p> |
|
|
1093 |
</dd> |
|
|
1094 |
<dt><strong>std:list</strong></dt><dd><p>See get_data_transforms.</p> |
|
|
1095 |
</dd> |
|
|
1096 |
</dl> |
|
|
1097 |
</dd> |
|
|
1098 |
<dt class="field-even">Returns</dt> |
|
|
1099 |
<dd class="field-even"><dl class="simple"> |
|
|
1100 |
<dt>dict</dt><dd><p>Transformers.</p> |
|
|
1101 |
</dd> |
|
|
1102 |
</dl> |
|
|
1103 |
</dd> |
|
|
1104 |
</dl> |
|
|
1105 |
</dd></dl> |
|
|
1106 |
|
|
|
1107 |
<dl class="function"> |
|
|
1108 |
<dt id="pathflowai.datasets.get_data_transforms"> |
|
|
1109 |
<code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">get_data_transforms</code><span class="sig-paren">(</span><em class="sig-param">patch_size=None</em>, <em class="sig-param">mean=[]</em>, <em class="sig-param">std=[]</em>, <em class="sig-param">resize=False</em>, <em class="sig-param">transform_platform='torch'</em>, <em class="sig-param">elastic=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#get_data_transforms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.get_data_transforms" title="Permalink to this definition">¶</a></dt> |
|
|
1110 |
<dd><p>Get data transformers for training test and validation sets.</p> |
|
|
1111 |
<dl class="field-list simple"> |
|
|
1112 |
<dt class="field-odd">Parameters</dt> |
|
|
1113 |
<dd class="field-odd"><dl class="simple"> |
|
|
1114 |
<dt><strong>patch_size:int</strong></dt><dd><p>Original patch size being transformed.</p> |
|
|
1115 |
</dd> |
|
|
1116 |
<dt><strong>mean:list of float</strong></dt><dd><p>Mean RGB</p> |
|
|
1117 |
</dd> |
|
|
1118 |
<dt><strong>std:list of float</strong></dt><dd><p>Std RGB</p> |
|
|
1119 |
</dd> |
|
|
1120 |
<dt><strong>resize:int</strong></dt><dd><p>Which patch size to resize to.</p> |
|
|
1121 |
</dd> |
|
|
1122 |
<dt><strong>transform_platform:str</strong></dt><dd><p>Use pytorch or albumentation transforms.</p> |
|
|
1123 |
</dd> |
|
|
1124 |
<dt><strong>elastic:bool</strong></dt><dd><p>Whether to add elastic deformations from albumentations.</p> |
|
|
1125 |
</dd> |
|
|
1126 |
</dl> |
|
|
1127 |
</dd> |
|
|
1128 |
<dt class="field-even">Returns</dt> |
|
|
1129 |
<dd class="field-even"><dl class="simple"> |
|
|
1130 |
<dt>dict</dt><dd><p>Transformers.</p> |
|
|
1131 |
</dd> |
|
|
1132 |
</dl> |
|
|
1133 |
</dd> |
|
|
1134 |
</dl> |
|
|
1135 |
</dd></dl> |
|
|
1136 |
|
|
|
1137 |
<dl class="function"> |
|
|
1138 |
<dt id="pathflowai.datasets.get_normalizer"> |
|
|
1139 |
<code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">get_normalizer</code><span class="sig-paren">(</span><em class="sig-param">normalization_file</em>, <em class="sig-param">dataset_opts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#get_normalizer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.get_normalizer" title="Permalink to this definition">¶</a></dt> |
|
|
1140 |
<dd><p>Find mean and standard deviation of images in batches.</p> |
|
|
1141 |
<dl class="field-list simple"> |
|
|
1142 |
<dt class="field-odd">Parameters</dt> |
|
|
1143 |
<dd class="field-odd"><dl class="simple"> |
|
|
1144 |
<dt><strong>normalization_file:str</strong></dt><dd><p>File to store normalization information.</p> |
|
|
1145 |
</dd> |
|
|
1146 |
<dt><strong>dataset_opts:type</strong></dt><dd><p>Dictionary storing information to create DynamicDataset class.</p> |
|
|
1147 |
</dd> |
|
|
1148 |
</dl> |
|
|
1149 |
</dd> |
|
|
1150 |
<dt class="field-even">Returns</dt> |
|
|
1151 |
<dd class="field-even"><dl class="simple"> |
|
|
1152 |
<dt>dict</dt><dd><p>Stores RGB mean, stdev.</p> |
|
|
1153 |
</dd> |
|
|
1154 |
</dl> |
|
|
1155 |
</dd> |
|
|
1156 |
</dl> |
|
|
1157 |
</dd></dl> |
|
|
1158 |
|
|
|
1159 |
<dl class="function"> |
|
|
1160 |
<dt id="pathflowai.datasets.segmentation_transform"> |
|
|
1161 |
<code class="sig-prename descclassname">pathflowai.datasets.</code><code class="sig-name descname">segmentation_transform</code><span class="sig-paren">(</span><em class="sig-param">img</em>, <em class="sig-param">mask</em>, <em class="sig-param">transformer</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/datasets.html#segmentation_transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.datasets.segmentation_transform" title="Permalink to this definition">¶</a></dt> |
|
|
1162 |
<dd><p>Run albumentations and return an image and its segmentation mask.</p> |
|
|
1163 |
<dl class="field-list simple"> |
|
|
1164 |
<dt class="field-odd">Parameters</dt> |
|
|
1165 |
<dd class="field-odd"><dl class="simple"> |
|
|
1166 |
<dt><strong>img:array</strong></dt><dd><p>Image as array</p> |
|
|
1167 |
</dd> |
|
|
1168 |
<dt><strong>mask:array</strong></dt><dd><p>Categorical pixel by pixel.</p> |
|
|
1169 |
</dd> |
|
|
1170 |
<dt><strong>transformer :</strong></dt><dd><p>Transformation object.</p> |
|
|
1171 |
</dd> |
|
|
1172 |
</dl> |
|
|
1173 |
</dd> |
|
|
1174 |
<dt class="field-even">Returns</dt> |
|
|
1175 |
<dd class="field-even"><dl class="simple"> |
|
|
1176 |
<dt>tuple arrays</dt><dd><p>Image and mask array.</p> |
|
|
1177 |
</dd> |
|
|
1178 |
</dl> |
|
|
1179 |
</dd> |
|
|
1180 |
</dl> |
|
|
1181 |
</dd></dl> |
|
|
1182 |
|
|
|
1183 |
</div> |
|
|
1184 |
<span class="target" id="module-pathflowai.losses"></span><div class="section" id="losses-py"> |
|
|
1185 |
<h2>losses.py<a class="headerlink" href="#losses-py" title="Permalink to this headline">¶</a></h2> |
|
|
1186 |
<p>Some additional loss functions that can be called using the pipeline, some of which still to be implemented.</p> |
|
|
1187 |
<dl class="class"> |
|
|
1188 |
<dt id="pathflowai.losses.FocalLoss"> |
|
|
1189 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">FocalLoss</code><span class="sig-paren">(</span><em class="sig-param">num_class</em>, <em class="sig-param">alpha=None</em>, <em class="sig-param">gamma=2</em>, <em class="sig-param">balance_index=-1</em>, <em class="sig-param">smooth=None</em>, <em class="sig-param">size_average=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#FocalLoss"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.FocalLoss" title="Permalink to this definition">¶</a></dt> |
|
|
1190 |
<dd><p># <a class="reference external" href="https://raw.githubusercontent.com/Hsuxu/Loss_ToolBox-PyTorch/master/FocalLoss/FocalLoss.py">https://raw.githubusercontent.com/Hsuxu/Loss_ToolBox-PyTorch/master/FocalLoss/FocalLoss.py</a> |
|
|
1191 |
This is a implementation of Focal Loss with smooth label cross entropy supported which is proposed in |
|
|
1192 |
‘Focal Loss for Dense Object Detection. (<a class="reference external" href="https://arxiv.org/abs/1708.02002">https://arxiv.org/abs/1708.02002</a>)’</p> |
|
|
1193 |
<blockquote> |
|
|
1194 |
<div><p>Focal_Loss= -1*alpha*(1-pt)*log(pt)</p> |
|
|
1195 |
</div></blockquote> |
|
|
1196 |
<dl class="field-list simple"> |
|
|
1197 |
<dt class="field-odd">Parameters</dt> |
|
|
1198 |
<dd class="field-odd"><ul class="simple"> |
|
|
1199 |
<li><p><strong>num_class</strong> – </p></li> |
|
|
1200 |
<li><p><strong>alpha</strong> – (tensor) 3D or 4D the scalar factor for this criterion</p></li> |
|
|
1201 |
<li><p><strong>gamma</strong> – (float,double) gamma > 0 reduces the relative loss for well-classified examples (p>0.5) putting more |
|
|
1202 |
focus on hard misclassified example</p></li> |
|
|
1203 |
<li><p><strong>smooth</strong> – (float,double) smooth value when cross entropy</p></li> |
|
|
1204 |
<li><p><strong>balance_index</strong> – (int) balance class index, should be specific when alpha is float</p></li> |
|
|
1205 |
<li><p><strong>size_average</strong> – (bool, optional) By default, the losses are averaged over each loss element in the batch.</p></li> |
|
|
1206 |
</ul> |
|
|
1207 |
</dd> |
|
|
1208 |
</dl> |
|
|
1209 |
<p class="rubric">Methods</p> |
|
|
1210 |
<table class="longtable docutils align-default"> |
|
|
1211 |
<colgroup> |
|
|
1212 |
<col style="width: 10%" /> |
|
|
1213 |
<col style="width: 90%" /> |
|
|
1214 |
</colgroup> |
|
|
1215 |
<tbody> |
|
|
1216 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">__call__</span></code>(self, \*input, \*\*kwargs)</p></td> |
|
|
1217 |
<td><p>Call self as a function.</p></td> |
|
|
1218 |
</tr> |
|
|
1219 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_module</span></code>(self, name, module)</p></td> |
|
|
1220 |
<td><p>Adds a child module to the current module.</p></td> |
|
|
1221 |
</tr> |
|
|
1222 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">apply</span></code>(self, fn)</p></td> |
|
|
1223 |
<td><p>Applies <code class="docutils literal notranslate"><span class="pre">fn</span></code> recursively to every submodule (as returned by <code class="docutils literal notranslate"><span class="pre">.children()</span></code>) as well as self.</p></td> |
|
|
1224 |
</tr> |
|
|
1225 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">buffers</span></code>(self[, recurse])</p></td> |
|
|
1226 |
<td><p>Returns an iterator over module buffers.</p></td> |
|
|
1227 |
</tr> |
|
|
1228 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">children</span></code>(self)</p></td> |
|
|
1229 |
<td><p>Returns an iterator over immediate children modules.</p></td> |
|
|
1230 |
</tr> |
|
|
1231 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">cpu</span></code>(self)</p></td> |
|
|
1232 |
<td><p>Moves all model parameters and buffers to the CPU.</p></td> |
|
|
1233 |
</tr> |
|
|
1234 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">cuda</span></code>(self[, device])</p></td> |
|
|
1235 |
<td><p>Moves all model parameters and buffers to the GPU.</p></td> |
|
|
1236 |
</tr> |
|
|
1237 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">double</span></code>(self)</p></td> |
|
|
1238 |
<td><p>Casts all floating point parameters and buffers to <code class="docutils literal notranslate"><span class="pre">double</span></code> datatype.</p></td> |
|
|
1239 |
</tr> |
|
|
1240 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval</span></code>(self)</p></td> |
|
|
1241 |
<td><p>Sets the module in evaluation mode.</p></td> |
|
|
1242 |
</tr> |
|
|
1243 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">extra_repr</span></code>(self)</p></td> |
|
|
1244 |
<td><p>Set the extra representation of the module</p></td> |
|
|
1245 |
</tr> |
|
|
1246 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">float</span></code>(self)</p></td> |
|
|
1247 |
<td><p>Casts all floating point parameters and buffers to float datatype.</p></td> |
|
|
1248 |
</tr> |
|
|
1249 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.losses.FocalLoss.forward" title="pathflowai.losses.FocalLoss.forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">forward</span></code></a>(self, logit, target)</p></td> |
|
|
1250 |
<td><p>Defines the computation performed at every call.</p></td> |
|
|
1251 |
</tr> |
|
|
1252 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">half</span></code>(self)</p></td> |
|
|
1253 |
<td><p>Casts all floating point parameters and buffers to <code class="docutils literal notranslate"><span class="pre">half</span></code> datatype.</p></td> |
|
|
1254 |
</tr> |
|
|
1255 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">load_state_dict</span></code>(self, state_dict[, strict])</p></td> |
|
|
1256 |
<td><p>Copies parameters and buffers from <code class="xref py py-attr docutils literal notranslate"><span class="pre">state_dict</span></code> into this module and its descendants.</p></td> |
|
|
1257 |
</tr> |
|
|
1258 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">modules</span></code>(self)</p></td> |
|
|
1259 |
<td><p>Returns an iterator over all modules in the network.</p></td> |
|
|
1260 |
</tr> |
|
|
1261 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_buffers</span></code>(self[, prefix, recurse])</p></td> |
|
|
1262 |
<td><p>Returns an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.</p></td> |
|
|
1263 |
</tr> |
|
|
1264 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_children</span></code>(self)</p></td> |
|
|
1265 |
<td><p>Returns an iterator over immediate children modules, yielding both the name of the module as well as the module itself.</p></td> |
|
|
1266 |
</tr> |
|
|
1267 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_modules</span></code>(self[, memo, prefix])</p></td> |
|
|
1268 |
<td><p>Returns an iterator over all modules in the network, yielding both the name of the module as well as the module itself.</p></td> |
|
|
1269 |
</tr> |
|
|
1270 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_parameters</span></code>(self[, prefix, recurse])</p></td> |
|
|
1271 |
<td><p>Returns an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.</p></td> |
|
|
1272 |
</tr> |
|
|
1273 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">parameters</span></code>(self[, recurse])</p></td> |
|
|
1274 |
<td><p>Returns an iterator over module parameters.</p></td> |
|
|
1275 |
</tr> |
|
|
1276 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_backward_hook</span></code>(self, hook)</p></td> |
|
|
1277 |
<td><p>Registers a backward hook on the module.</p></td> |
|
|
1278 |
</tr> |
|
|
1279 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_buffer</span></code>(self, name, tensor)</p></td> |
|
|
1280 |
<td><p>Adds a persistent buffer to the module.</p></td> |
|
|
1281 |
</tr> |
|
|
1282 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_forward_hook</span></code>(self, hook)</p></td> |
|
|
1283 |
<td><p>Registers a forward hook on the module.</p></td> |
|
|
1284 |
</tr> |
|
|
1285 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_forward_pre_hook</span></code>(self, hook)</p></td> |
|
|
1286 |
<td><p>Registers a forward pre-hook on the module.</p></td> |
|
|
1287 |
</tr> |
|
|
1288 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_parameter</span></code>(self, name, param)</p></td> |
|
|
1289 |
<td><p>Adds a parameter to the module.</p></td> |
|
|
1290 |
</tr> |
|
|
1291 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_dict</span></code>(self[, destination, prefix, …])</p></td> |
|
|
1292 |
<td><p>Returns a dictionary containing a whole state of the module.</p></td> |
|
|
1293 |
</tr> |
|
|
1294 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">to</span></code>(self, \*args, \*\*kwargs)</p></td> |
|
|
1295 |
<td><p>Moves and/or casts the parameters and buffers.</p></td> |
|
|
1296 |
</tr> |
|
|
1297 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">train</span></code>(self[, mode])</p></td> |
|
|
1298 |
<td><p>Sets the module in training mode.</p></td> |
|
|
1299 |
</tr> |
|
|
1300 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">type</span></code>(self, dst_type)</p></td> |
|
|
1301 |
<td><p>Casts all parameters and buffers to <code class="xref py py-attr docutils literal notranslate"><span class="pre">dst_type</span></code>.</p></td> |
|
|
1302 |
</tr> |
|
|
1303 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">zero_grad</span></code>(self)</p></td> |
|
|
1304 |
<td><p>Sets gradients of all model parameters to zero.</p></td> |
|
|
1305 |
</tr> |
|
|
1306 |
</tbody> |
|
|
1307 |
</table> |
|
|
1308 |
<table class="docutils align-default"> |
|
|
1309 |
<colgroup> |
|
|
1310 |
<col style="width: 62%" /> |
|
|
1311 |
<col style="width: 38%" /> |
|
|
1312 |
</colgroup> |
|
|
1313 |
<tbody> |
|
|
1314 |
<tr class="row-odd"><td><p><strong>share_memory</strong></p></td> |
|
|
1315 |
<td></td> |
|
|
1316 |
</tr> |
|
|
1317 |
</tbody> |
|
|
1318 |
</table> |
|
|
1319 |
<dl class="method"> |
|
|
1320 |
<dt id="pathflowai.losses.FocalLoss.forward"> |
|
|
1321 |
<code class="sig-name descname">forward</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">logit</em>, <em class="sig-param">target</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#FocalLoss.forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.FocalLoss.forward" title="Permalink to this definition">¶</a></dt> |
|
|
1322 |
<dd><p>Defines the computation performed at every call.</p> |
|
|
1323 |
<p>Should be overridden by all subclasses.</p> |
|
|
1324 |
<div class="admonition note"> |
|
|
1325 |
<p class="admonition-title">Note</p> |
|
|
1326 |
<p>Although the recipe for forward pass needs to be defined within |
|
|
1327 |
this function, one should call the <code class="xref py py-class docutils literal notranslate"><span class="pre">Module</span></code> instance afterwards |
|
|
1328 |
instead of this since the former takes care of running the |
|
|
1329 |
registered hooks while the latter silently ignores them.</p> |
|
|
1330 |
</div> |
|
|
1331 |
</dd></dl> |
|
|
1332 |
|
|
|
1333 |
</dd></dl> |
|
|
1334 |
|
|
|
1335 |
<dl class="class"> |
|
|
1336 |
<dt id="pathflowai.losses.GeneralizedDice"> |
|
|
1337 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">GeneralizedDice</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#GeneralizedDice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.GeneralizedDice" title="Permalink to this definition">¶</a></dt> |
|
|
1338 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/losses.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/losses.py</a></p> |
|
|
1339 |
<p class="rubric">Methods</p> |
|
|
1340 |
<table class="longtable docutils align-default"> |
|
|
1341 |
<colgroup> |
|
|
1342 |
<col style="width: 10%" /> |
|
|
1343 |
<col style="width: 90%" /> |
|
|
1344 |
</colgroup> |
|
|
1345 |
<tbody> |
|
|
1346 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">__call__</span></code>(self, probs, target, _)</p></td> |
|
|
1347 |
<td><p>Call self as a function.</p></td> |
|
|
1348 |
</tr> |
|
|
1349 |
</tbody> |
|
|
1350 |
</table> |
|
|
1351 |
</dd></dl> |
|
|
1352 |
|
|
|
1353 |
<dl class="class"> |
|
|
1354 |
<dt id="pathflowai.losses.GeneralizedDiceLoss"> |
|
|
1355 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">GeneralizedDiceLoss</code><span class="sig-paren">(</span><em class="sig-param">weight=None</em>, <em class="sig-param">channelwise=False</em>, <em class="sig-param">eps=1e-06</em>, <em class="sig-param">add_softmax=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#GeneralizedDiceLoss"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.GeneralizedDiceLoss" title="Permalink to this definition">¶</a></dt> |
|
|
1356 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/extensions/criteria/set_similarity_measures.py">https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/extensions/criteria/set_similarity_measures.py</a> |
|
|
1357 |
Computes the scalar Generalized Dice Loss defined in <a class="reference external" href="https://arxiv.org/abs/1707.03237">https://arxiv.org/abs/1707.03237</a></p> |
|
|
1358 |
<p>This version works for multiple classes and expects predictions for every class (e.g. softmax output) and |
|
|
1359 |
one-hot targets for every class.</p> |
|
|
1360 |
<p class="rubric">Methods</p> |
|
|
1361 |
<table class="longtable docutils align-default"> |
|
|
1362 |
<colgroup> |
|
|
1363 |
<col style="width: 10%" /> |
|
|
1364 |
<col style="width: 90%" /> |
|
|
1365 |
</colgroup> |
|
|
1366 |
<tbody> |
|
|
1367 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">__call__</span></code>(self, \*input, \*\*kwargs)</p></td> |
|
|
1368 |
<td><p>Call self as a function.</p></td> |
|
|
1369 |
</tr> |
|
|
1370 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_module</span></code>(self, name, module)</p></td> |
|
|
1371 |
<td><p>Adds a child module to the current module.</p></td> |
|
|
1372 |
</tr> |
|
|
1373 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">apply</span></code>(self, fn)</p></td> |
|
|
1374 |
<td><p>Applies <code class="docutils literal notranslate"><span class="pre">fn</span></code> recursively to every submodule (as returned by <code class="docutils literal notranslate"><span class="pre">.children()</span></code>) as well as self.</p></td> |
|
|
1375 |
</tr> |
|
|
1376 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">buffers</span></code>(self[, recurse])</p></td> |
|
|
1377 |
<td><p>Returns an iterator over module buffers.</p></td> |
|
|
1378 |
</tr> |
|
|
1379 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">children</span></code>(self)</p></td> |
|
|
1380 |
<td><p>Returns an iterator over immediate children modules.</p></td> |
|
|
1381 |
</tr> |
|
|
1382 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">cpu</span></code>(self)</p></td> |
|
|
1383 |
<td><p>Moves all model parameters and buffers to the CPU.</p></td> |
|
|
1384 |
</tr> |
|
|
1385 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">cuda</span></code>(self[, device])</p></td> |
|
|
1386 |
<td><p>Moves all model parameters and buffers to the GPU.</p></td> |
|
|
1387 |
</tr> |
|
|
1388 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">double</span></code>(self)</p></td> |
|
|
1389 |
<td><p>Casts all floating point parameters and buffers to <code class="docutils literal notranslate"><span class="pre">double</span></code> datatype.</p></td> |
|
|
1390 |
</tr> |
|
|
1391 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval</span></code>(self)</p></td> |
|
|
1392 |
<td><p>Sets the module in evaluation mode.</p></td> |
|
|
1393 |
</tr> |
|
|
1394 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">extra_repr</span></code>(self)</p></td> |
|
|
1395 |
<td><p>Set the extra representation of the module</p></td> |
|
|
1396 |
</tr> |
|
|
1397 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">float</span></code>(self)</p></td> |
|
|
1398 |
<td><p>Casts all floating point parameters and buffers to float datatype.</p></td> |
|
|
1399 |
</tr> |
|
|
1400 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.losses.GeneralizedDiceLoss.forward" title="pathflowai.losses.GeneralizedDiceLoss.forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">forward</span></code></a>(self, input, target)</p></td> |
|
|
1401 |
<td><p>input: torch.FloatTensor or torch.cuda.FloatTensor target: torch.FloatTensor or torch.cuda.FloatTensor</p></td> |
|
|
1402 |
</tr> |
|
|
1403 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">half</span></code>(self)</p></td> |
|
|
1404 |
<td><p>Casts all floating point parameters and buffers to <code class="docutils literal notranslate"><span class="pre">half</span></code> datatype.</p></td> |
|
|
1405 |
</tr> |
|
|
1406 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">load_state_dict</span></code>(self, state_dict[, strict])</p></td> |
|
|
1407 |
<td><p>Copies parameters and buffers from <code class="xref py py-attr docutils literal notranslate"><span class="pre">state_dict</span></code> into this module and its descendants.</p></td> |
|
|
1408 |
</tr> |
|
|
1409 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">modules</span></code>(self)</p></td> |
|
|
1410 |
<td><p>Returns an iterator over all modules in the network.</p></td> |
|
|
1411 |
</tr> |
|
|
1412 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_buffers</span></code>(self[, prefix, recurse])</p></td> |
|
|
1413 |
<td><p>Returns an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.</p></td> |
|
|
1414 |
</tr> |
|
|
1415 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_children</span></code>(self)</p></td> |
|
|
1416 |
<td><p>Returns an iterator over immediate children modules, yielding both the name of the module as well as the module itself.</p></td> |
|
|
1417 |
</tr> |
|
|
1418 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_modules</span></code>(self[, memo, prefix])</p></td> |
|
|
1419 |
<td><p>Returns an iterator over all modules in the network, yielding both the name of the module as well as the module itself.</p></td> |
|
|
1420 |
</tr> |
|
|
1421 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">named_parameters</span></code>(self[, prefix, recurse])</p></td> |
|
|
1422 |
<td><p>Returns an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.</p></td> |
|
|
1423 |
</tr> |
|
|
1424 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">parameters</span></code>(self[, recurse])</p></td> |
|
|
1425 |
<td><p>Returns an iterator over module parameters.</p></td> |
|
|
1426 |
</tr> |
|
|
1427 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_backward_hook</span></code>(self, hook)</p></td> |
|
|
1428 |
<td><p>Registers a backward hook on the module.</p></td> |
|
|
1429 |
</tr> |
|
|
1430 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_buffer</span></code>(self, name, tensor)</p></td> |
|
|
1431 |
<td><p>Adds a persistent buffer to the module.</p></td> |
|
|
1432 |
</tr> |
|
|
1433 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_forward_hook</span></code>(self, hook)</p></td> |
|
|
1434 |
<td><p>Registers a forward hook on the module.</p></td> |
|
|
1435 |
</tr> |
|
|
1436 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_forward_pre_hook</span></code>(self, hook)</p></td> |
|
|
1437 |
<td><p>Registers a forward pre-hook on the module.</p></td> |
|
|
1438 |
</tr> |
|
|
1439 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_parameter</span></code>(self, name, param)</p></td> |
|
|
1440 |
<td><p>Adds a parameter to the module.</p></td> |
|
|
1441 |
</tr> |
|
|
1442 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_dict</span></code>(self[, destination, prefix, …])</p></td> |
|
|
1443 |
<td><p>Returns a dictionary containing a whole state of the module.</p></td> |
|
|
1444 |
</tr> |
|
|
1445 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">to</span></code>(self, \*args, \*\*kwargs)</p></td> |
|
|
1446 |
<td><p>Moves and/or casts the parameters and buffers.</p></td> |
|
|
1447 |
</tr> |
|
|
1448 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">train</span></code>(self[, mode])</p></td> |
|
|
1449 |
<td><p>Sets the module in training mode.</p></td> |
|
|
1450 |
</tr> |
|
|
1451 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">type</span></code>(self, dst_type)</p></td> |
|
|
1452 |
<td><p>Casts all parameters and buffers to <code class="xref py py-attr docutils literal notranslate"><span class="pre">dst_type</span></code>.</p></td> |
|
|
1453 |
</tr> |
|
|
1454 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">zero_grad</span></code>(self)</p></td> |
|
|
1455 |
<td><p>Sets gradients of all model parameters to zero.</p></td> |
|
|
1456 |
</tr> |
|
|
1457 |
</tbody> |
|
|
1458 |
</table> |
|
|
1459 |
<table class="docutils align-default"> |
|
|
1460 |
<colgroup> |
|
|
1461 |
<col style="width: 62%" /> |
|
|
1462 |
<col style="width: 38%" /> |
|
|
1463 |
</colgroup> |
|
|
1464 |
<tbody> |
|
|
1465 |
<tr class="row-odd"><td><p><strong>share_memory</strong></p></td> |
|
|
1466 |
<td></td> |
|
|
1467 |
</tr> |
|
|
1468 |
</tbody> |
|
|
1469 |
</table> |
|
|
1470 |
<dl class="method"> |
|
|
1471 |
<dt id="pathflowai.losses.GeneralizedDiceLoss.forward"> |
|
|
1472 |
<code class="sig-name descname">forward</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">input</em>, <em class="sig-param">target</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#GeneralizedDiceLoss.forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.GeneralizedDiceLoss.forward" title="Permalink to this definition">¶</a></dt> |
|
|
1473 |
<dd><p>input: torch.FloatTensor or torch.cuda.FloatTensor |
|
|
1474 |
target: torch.FloatTensor or torch.cuda.FloatTensor</p> |
|
|
1475 |
<dl class="simple"> |
|
|
1476 |
<dt>Expected shape of the inputs:</dt><dd><ul class="simple"> |
|
|
1477 |
<li><p>if not channelwise: (batch_size, nb_classes, …)</p></li> |
|
|
1478 |
<li><p>if channelwise: (batch_size, nb_channels, nb_classes, …)</p></li> |
|
|
1479 |
</ul> |
|
|
1480 |
</dd> |
|
|
1481 |
</dl> |
|
|
1482 |
</dd></dl> |
|
|
1483 |
|
|
|
1484 |
</dd></dl> |
|
|
1485 |
|
|
|
1486 |
<dl class="exception"> |
|
|
1487 |
<dt id="pathflowai.losses.ShapeError"> |
|
|
1488 |
<em class="property">exception </em><code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">ShapeError</code><a class="reference internal" href="_modules/pathflowai/losses.html#ShapeError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.ShapeError" title="Permalink to this definition">¶</a></dt> |
|
|
1489 |
<dd></dd></dl> |
|
|
1490 |
|
|
|
1491 |
<dl class="class"> |
|
|
1492 |
<dt id="pathflowai.losses.SurfaceLoss"> |
|
|
1493 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">SurfaceLoss</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#SurfaceLoss"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.SurfaceLoss" title="Permalink to this definition">¶</a></dt> |
|
|
1494 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/losses.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/losses.py</a></p> |
|
|
1495 |
<p class="rubric">Methods</p> |
|
|
1496 |
<table class="longtable docutils align-default"> |
|
|
1497 |
<colgroup> |
|
|
1498 |
<col style="width: 10%" /> |
|
|
1499 |
<col style="width: 90%" /> |
|
|
1500 |
</colgroup> |
|
|
1501 |
<tbody> |
|
|
1502 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">__call__</span></code>(self, probs, dist_maps, _)</p></td> |
|
|
1503 |
<td><p>Call self as a function.</p></td> |
|
|
1504 |
</tr> |
|
|
1505 |
</tbody> |
|
|
1506 |
</table> |
|
|
1507 |
</dd></dl> |
|
|
1508 |
|
|
|
1509 |
<dl class="function"> |
|
|
1510 |
<dt id="pathflowai.losses.assert_"> |
|
|
1511 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">assert_</code><span class="sig-paren">(</span><em class="sig-param">condition</em>, <em class="sig-param">message=''</em>, <em class="sig-param">exception_type=<class 'AssertionError'></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#assert_"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.assert_" title="Permalink to this definition">¶</a></dt> |
|
|
1512 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/utils/exceptions.py">https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/utils/exceptions.py</a> |
|
|
1513 |
Like assert, but with arbitrary exception types.</p> |
|
|
1514 |
</dd></dl> |
|
|
1515 |
|
|
|
1516 |
<dl class="function"> |
|
|
1517 |
<dt id="pathflowai.losses.class2one_hot"> |
|
|
1518 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">class2one_hot</code><span class="sig-paren">(</span><em class="sig-param">seg:torch.Tensor</em>, <em class="sig-param">C:int</em><span class="sig-paren">)</span> → torch.Tensor<a class="reference internal" href="_modules/pathflowai/losses.html#class2one_hot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.class2one_hot" title="Permalink to this definition">¶</a></dt> |
|
|
1519 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1520 |
</dd></dl> |
|
|
1521 |
|
|
|
1522 |
<dl class="function"> |
|
|
1523 |
<dt id="pathflowai.losses.eq"> |
|
|
1524 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">eq</code><span class="sig-paren">(</span><em class="sig-param">a:torch.Tensor</em>, <em class="sig-param">b</em><span class="sig-paren">)</span> → bool<a class="reference internal" href="_modules/pathflowai/losses.html#eq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.eq" title="Permalink to this definition">¶</a></dt> |
|
|
1525 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1526 |
</dd></dl> |
|
|
1527 |
|
|
|
1528 |
<dl class="function"> |
|
|
1529 |
<dt id="pathflowai.losses.flatten_samples"> |
|
|
1530 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">flatten_samples</code><span class="sig-paren">(</span><em class="sig-param">input_</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/losses.html#flatten_samples"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.flatten_samples" title="Permalink to this definition">¶</a></dt> |
|
|
1531 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/utils/torch_utils.py">https://raw.githubusercontent.com/inferno-pytorch/inferno/0561e8a95cde6bfc5e10a3609841b7b0ca5b03ca/inferno/utils/torch_utils.py</a> |
|
|
1532 |
Flattens a tensor or a variable such that the channel axis is first and the sample axis |
|
|
1533 |
is second. The shapes are transformed as follows:</p> |
|
|
1534 |
<blockquote> |
|
|
1535 |
<div><p>(N, C, H, W) –> (C, N * H * W) |
|
|
1536 |
(N, C, D, H, W) –> (C, N * D * H * W) |
|
|
1537 |
(N, C) –> (C, N)</p> |
|
|
1538 |
</div></blockquote> |
|
|
1539 |
<p>The input must be atleast 2d.</p> |
|
|
1540 |
</dd></dl> |
|
|
1541 |
|
|
|
1542 |
<dl class="function"> |
|
|
1543 |
<dt id="pathflowai.losses.one_hot"> |
|
|
1544 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">one_hot</code><span class="sig-paren">(</span><em class="sig-param">t:torch.Tensor</em>, <em class="sig-param">axis=1</em><span class="sig-paren">)</span> → bool<a class="reference internal" href="_modules/pathflowai/losses.html#one_hot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.one_hot" title="Permalink to this definition">¶</a></dt> |
|
|
1545 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1546 |
</dd></dl> |
|
|
1547 |
|
|
|
1548 |
<dl class="function"> |
|
|
1549 |
<dt id="pathflowai.losses.one_hot2dist"> |
|
|
1550 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">one_hot2dist</code><span class="sig-paren">(</span><em class="sig-param">seg:numpy.ndarray</em><span class="sig-paren">)</span> → numpy.ndarray<a class="reference internal" href="_modules/pathflowai/losses.html#one_hot2dist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.one_hot2dist" title="Permalink to this definition">¶</a></dt> |
|
|
1551 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1552 |
</dd></dl> |
|
|
1553 |
|
|
|
1554 |
<dl class="function"> |
|
|
1555 |
<dt id="pathflowai.losses.simplex"> |
|
|
1556 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">simplex</code><span class="sig-paren">(</span><em class="sig-param">t:torch.Tensor</em>, <em class="sig-param">axis=1</em><span class="sig-paren">)</span> → bool<a class="reference internal" href="_modules/pathflowai/losses.html#simplex"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.simplex" title="Permalink to this definition">¶</a></dt> |
|
|
1557 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1558 |
</dd></dl> |
|
|
1559 |
|
|
|
1560 |
<dl class="function"> |
|
|
1561 |
<dt id="pathflowai.losses.sset"> |
|
|
1562 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">sset</code><span class="sig-paren">(</span><em class="sig-param">a:torch.Tensor</em>, <em class="sig-param">sub:Iterable</em><span class="sig-paren">)</span> → bool<a class="reference internal" href="_modules/pathflowai/losses.html#sset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.sset" title="Permalink to this definition">¶</a></dt> |
|
|
1563 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1564 |
</dd></dl> |
|
|
1565 |
|
|
|
1566 |
<dl class="function"> |
|
|
1567 |
<dt id="pathflowai.losses.uniq"> |
|
|
1568 |
<code class="sig-prename descclassname">pathflowai.losses.</code><code class="sig-name descname">uniq</code><span class="sig-paren">(</span><em class="sig-param">a:torch.Tensor</em><span class="sig-paren">)</span> → Set<a class="reference internal" href="_modules/pathflowai/losses.html#uniq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.losses.uniq" title="Permalink to this definition">¶</a></dt> |
|
|
1569 |
<dd><p><a class="reference external" href="https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py">https://raw.githubusercontent.com/LIVIAETS/surface-loss/master/utils.py</a></p> |
|
|
1570 |
</dd></dl> |
|
|
1571 |
|
|
|
1572 |
</div> |
|
|
1573 |
<span class="target" id="module-pathflowai.sampler"></span><div class="section" id="sampler-py"> |
|
|
1574 |
<h2>sampler.py<a class="headerlink" href="#sampler-py" title="Permalink to this headline">¶</a></h2> |
|
|
1575 |
<p>Balanced sampling based on one of the columns of the patch information.</p> |
|
|
1576 |
<dl class="class"> |
|
|
1577 |
<dt id="pathflowai.sampler.ImbalancedDatasetSampler"> |
|
|
1578 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.sampler.</code><code class="sig-name descname">ImbalancedDatasetSampler</code><span class="sig-paren">(</span><em class="sig-param">dataset</em>, <em class="sig-param">indices=None</em>, <em class="sig-param">num_samples=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/sampler.html#ImbalancedDatasetSampler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.sampler.ImbalancedDatasetSampler" title="Permalink to this definition">¶</a></dt> |
|
|
1579 |
<dd><p>Samples elements randomly from a given list of indices for imbalanced dataset |
|
|
1580 |
<a class="reference external" href="https://raw.githubusercontent.com/ufoym/imbalanced-dataset-sampler/master/sampler.py">https://raw.githubusercontent.com/ufoym/imbalanced-dataset-sampler/master/sampler.py</a> |
|
|
1581 |
Arguments:</p> |
|
|
1582 |
<blockquote> |
|
|
1583 |
<div><p>indices (list, optional): a list of indices |
|
|
1584 |
num_samples (int, optional): number of samples to draw</p> |
|
|
1585 |
</div></blockquote> |
|
|
1586 |
</dd></dl> |
|
|
1587 |
|
|
|
1588 |
</div> |
|
|
1589 |
<span class="target" id="module-pathflowai.schedulers"></span><div class="section" id="schedulers-py"> |
|
|
1590 |
<h2>schedulers.py<a class="headerlink" href="#schedulers-py" title="Permalink to this headline">¶</a></h2> |
|
|
1591 |
<p>Modulates the learning rate during the training process.</p> |
|
|
1592 |
<dl class="class"> |
|
|
1593 |
<dt id="pathflowai.schedulers.CosineAnnealingWithRestartsLR"> |
|
|
1594 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.schedulers.</code><code class="sig-name descname">CosineAnnealingWithRestartsLR</code><span class="sig-paren">(</span><em class="sig-param">optimizer</em>, <em class="sig-param">T_max</em>, <em class="sig-param">eta_min=0</em>, <em class="sig-param">last_epoch=-1</em>, <em class="sig-param">T_mult=1.0</em>, <em class="sig-param">alpha_decay=1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/schedulers.html#CosineAnnealingWithRestartsLR"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.schedulers.CosineAnnealingWithRestartsLR" title="Permalink to this definition">¶</a></dt> |
|
|
1595 |
<dd><p>Set the learning rate of each parameter group using a cosine annealing |
|
|
1596 |
schedule, where <span class="math notranslate nohighlight">\(\eta_{max}\)</span> is set to the initial lr and |
|
|
1597 |
<span class="math notranslate nohighlight">\(T_{cur}\)</span> is the number of epochs since the last restart in SGDR:</p> |
|
|
1598 |
<blockquote> |
|
|
1599 |
<div><div class="math notranslate nohighlight"> |
|
|
1600 |
\[\eta_t = \eta_{min} + \frac{1}{2}(\eta_{max} - \eta_{min})(1 + |
|
|
1601 |
\cos(\frac{T_{cur}}{T_{max}}\pi))\]</div> |
|
|
1602 |
<p>When last_epoch=-1, sets initial lr as lr. |
|
|
1603 |
It has been proposed in</p> |
|
|
1604 |
</div></blockquote> |
|
|
1605 |
<p><a class="reference external" href="https://arxiv.org/abs/1608.03983">SGDR: Stochastic Gradient Descent with Warm Restarts</a>. This implements |
|
|
1606 |
the cosine annealing part of SGDR, the restarts and number of iterations multiplier.</p> |
|
|
1607 |
<blockquote> |
|
|
1608 |
<div><dl class="simple"> |
|
|
1609 |
<dt>Args:</dt><dd><p>optimizer (Optimizer): Wrapped optimizer. |
|
|
1610 |
T_max (int): Maximum number of iterations. |
|
|
1611 |
T_mult (float): Multiply T_max by this number after each restart. Default: 1. |
|
|
1612 |
eta_min (float): Minimum learning rate. Default: 0. |
|
|
1613 |
last_epoch (int): The index of last epoch. Default: -1.</p> |
|
|
1614 |
</dd> |
|
|
1615 |
</dl> |
|
|
1616 |
</div></blockquote> |
|
|
1617 |
<dl class="field-list simple"> |
|
|
1618 |
<dt class="field-odd">Attributes</dt> |
|
|
1619 |
<dd class="field-odd"><dl class="simple"> |
|
|
1620 |
<dt><strong>step_n</strong></dt><dd></dd> |
|
|
1621 |
</dl> |
|
|
1622 |
</dd> |
|
|
1623 |
</dl> |
|
|
1624 |
<p class="rubric">Methods</p> |
|
|
1625 |
<table class="longtable docutils align-default"> |
|
|
1626 |
<colgroup> |
|
|
1627 |
<col style="width: 10%" /> |
|
|
1628 |
<col style="width: 90%" /> |
|
|
1629 |
</colgroup> |
|
|
1630 |
<tbody> |
|
|
1631 |
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">load_state_dict</span></code>(self, state_dict)</p></td> |
|
|
1632 |
<td><p>Loads the schedulers state.</p></td> |
|
|
1633 |
</tr> |
|
|
1634 |
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_dict</span></code>(self)</p></td> |
|
|
1635 |
<td><p>Returns the state of the scheduler as a <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>.</p></td> |
|
|
1636 |
</tr> |
|
|
1637 |
</tbody> |
|
|
1638 |
</table> |
|
|
1639 |
<table class="docutils align-default"> |
|
|
1640 |
<colgroup> |
|
|
1641 |
<col style="width: 52%" /> |
|
|
1642 |
<col style="width: 48%" /> |
|
|
1643 |
</colgroup> |
|
|
1644 |
<tbody> |
|
|
1645 |
<tr class="row-odd"><td><p><strong>cosine</strong></p></td> |
|
|
1646 |
<td></td> |
|
|
1647 |
</tr> |
|
|
1648 |
<tr class="row-even"><td><p><strong>get_lr</strong></p></td> |
|
|
1649 |
<td></td> |
|
|
1650 |
</tr> |
|
|
1651 |
<tr class="row-odd"><td><p><strong>restart</strong></p></td> |
|
|
1652 |
<td></td> |
|
|
1653 |
</tr> |
|
|
1654 |
<tr class="row-even"><td><p><strong>step</strong></p></td> |
|
|
1655 |
<td></td> |
|
|
1656 |
</tr> |
|
|
1657 |
</tbody> |
|
|
1658 |
</table> |
|
|
1659 |
</dd></dl> |
|
|
1660 |
|
|
|
1661 |
<dl class="class"> |
|
|
1662 |
<dt id="pathflowai.schedulers.Scheduler"> |
|
|
1663 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.schedulers.</code><code class="sig-name descname">Scheduler</code><span class="sig-paren">(</span><em class="sig-param">optimizer=None</em>, <em class="sig-param">opts={'T_max': 10</em>, <em class="sig-param">'T_mult': 2</em>, <em class="sig-param">'eta_min': 5e-08</em>, <em class="sig-param">'lr_scheduler_decay': 0.5</em>, <em class="sig-param">'scheduler': 'null'}</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/schedulers.html#Scheduler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.schedulers.Scheduler" title="Permalink to this definition">¶</a></dt> |
|
|
1664 |
<dd><p>Scheduler class that modulates learning rate of torch optimizers over epochs.</p> |
|
|
1665 |
<dl class="field-list simple"> |
|
|
1666 |
<dt class="field-odd">Parameters</dt> |
|
|
1667 |
<dd class="field-odd"><dl class="simple"> |
|
|
1668 |
<dt><strong>optimizer</strong><span class="classifier">type</span></dt><dd><p>torch.Optimizer object</p> |
|
|
1669 |
</dd> |
|
|
1670 |
<dt><strong>opts</strong><span class="classifier">type</span></dt><dd><p>Options of setting the learning rate scheduler, see default.</p> |
|
|
1671 |
</dd> |
|
|
1672 |
</dl> |
|
|
1673 |
</dd> |
|
|
1674 |
<dt class="field-even">Attributes</dt> |
|
|
1675 |
<dd class="field-even"><dl class="simple"> |
|
|
1676 |
<dt><strong>schedulers</strong><span class="classifier">type</span></dt><dd><p>Different types of schedulers to choose from.</p> |
|
|
1677 |
</dd> |
|
|
1678 |
<dt><strong>scheduler_step_fn</strong><span class="classifier">type</span></dt><dd><p>How scheduler updates learning rate.</p> |
|
|
1679 |
</dd> |
|
|
1680 |
<dt><strong>initial_lr</strong><span class="classifier">type</span></dt><dd><p>Initial set learning rate.</p> |
|
|
1681 |
</dd> |
|
|
1682 |
<dt><strong>scheduler_choice</strong><span class="classifier">type</span></dt><dd><p>What scheduler type was chosen.</p> |
|
|
1683 |
</dd> |
|
|
1684 |
<dt><strong>scheduler</strong><span class="classifier">type</span></dt><dd><p>Scheduler object chosen that will more directly update optimizer LR.</p> |
|
|
1685 |
</dd> |
|
|
1686 |
</dl> |
|
|
1687 |
</dd> |
|
|
1688 |
</dl> |
|
|
1689 |
<p class="rubric">Methods</p> |
|
|
1690 |
<table class="longtable docutils align-default"> |
|
|
1691 |
<colgroup> |
|
|
1692 |
<col style="width: 10%" /> |
|
|
1693 |
<col style="width: 90%" /> |
|
|
1694 |
</colgroup> |
|
|
1695 |
<tbody> |
|
|
1696 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.schedulers.Scheduler.get_lr" title="pathflowai.schedulers.Scheduler.get_lr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_lr</span></code></a>(self)</p></td> |
|
|
1697 |
<td><p>Return current learning rate.</p></td> |
|
|
1698 |
</tr> |
|
|
1699 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.schedulers.Scheduler.step" title="pathflowai.schedulers.Scheduler.step"><code class="xref py py-obj docutils literal notranslate"><span class="pre">step</span></code></a>(self)</p></td> |
|
|
1700 |
<td><p>Update optimizer learning rate</p></td> |
|
|
1701 |
</tr> |
|
|
1702 |
</tbody> |
|
|
1703 |
</table> |
|
|
1704 |
<dl class="method"> |
|
|
1705 |
<dt id="pathflowai.schedulers.Scheduler.get_lr"> |
|
|
1706 |
<code class="sig-name descname">get_lr</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/schedulers.html#Scheduler.get_lr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.schedulers.Scheduler.get_lr" title="Permalink to this definition">¶</a></dt> |
|
|
1707 |
<dd><p>Return current learning rate.</p> |
|
|
1708 |
<dl class="field-list simple"> |
|
|
1709 |
<dt class="field-odd">Returns</dt> |
|
|
1710 |
<dd class="field-odd"><dl class="simple"> |
|
|
1711 |
<dt>float</dt><dd><p>Current learning rate.</p> |
|
|
1712 |
</dd> |
|
|
1713 |
</dl> |
|
|
1714 |
</dd> |
|
|
1715 |
</dl> |
|
|
1716 |
</dd></dl> |
|
|
1717 |
|
|
|
1718 |
<dl class="method"> |
|
|
1719 |
<dt id="pathflowai.schedulers.Scheduler.step"> |
|
|
1720 |
<code class="sig-name descname">step</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/schedulers.html#Scheduler.step"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.schedulers.Scheduler.step" title="Permalink to this definition">¶</a></dt> |
|
|
1721 |
<dd><p>Update optimizer learning rate</p> |
|
|
1722 |
</dd></dl> |
|
|
1723 |
|
|
|
1724 |
</dd></dl> |
|
|
1725 |
|
|
|
1726 |
</div> |
|
|
1727 |
<span class="target" id="module-pathflowai.visualize"></span><div class="section" id="visualize-py"> |
|
|
1728 |
<h2>visualize.py<a class="headerlink" href="#visualize-py" title="Permalink to this headline">¶</a></h2> |
|
|
1729 |
<p>Plots SHAP outputs, UMAP embeddings, and overlays predictions on top of WSI.</p> |
|
|
1730 |
<dl class="class"> |
|
|
1731 |
<dt id="pathflowai.visualize.PlotlyPlot"> |
|
|
1732 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">PlotlyPlot</code><a class="reference internal" href="_modules/pathflowai/visualize.html#PlotlyPlot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PlotlyPlot" title="Permalink to this definition">¶</a></dt> |
|
|
1733 |
<dd><p>Creates plotly html plots.</p> |
|
|
1734 |
<p class="rubric">Methods</p> |
|
|
1735 |
<table class="longtable docutils align-default"> |
|
|
1736 |
<colgroup> |
|
|
1737 |
<col style="width: 10%" /> |
|
|
1738 |
<col style="width: 90%" /> |
|
|
1739 |
</colgroup> |
|
|
1740 |
<tbody> |
|
|
1741 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.visualize.PlotlyPlot.add_plot" title="pathflowai.visualize.PlotlyPlot.add_plot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_plot</span></code></a>(self, t_data_df[, G, color_col, …])</p></td> |
|
|
1742 |
<td><p>Adds plotting data to be plotted.</p></td> |
|
|
1743 |
</tr> |
|
|
1744 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.visualize.PlotlyPlot.plot" title="pathflowai.visualize.PlotlyPlot.plot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">plot</span></code></a>(self, output_fname[, axes_off])</p></td> |
|
|
1745 |
<td><p>Plot embedding of patches to html file.</p></td> |
|
|
1746 |
</tr> |
|
|
1747 |
</tbody> |
|
|
1748 |
</table> |
|
|
1749 |
<dl class="method"> |
|
|
1750 |
<dt id="pathflowai.visualize.PlotlyPlot.add_plot"> |
|
|
1751 |
<code class="sig-name descname">add_plot</code><span class="sig-paren">(</span><em class="sig-param">self, t_data_df, G=None, color_col='color', name_col='name', xyz_cols=['x', 'y', 'z'], size=2, opacity=1.0, custom_colors=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PlotlyPlot.add_plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PlotlyPlot.add_plot" title="Permalink to this definition">¶</a></dt> |
|
|
1752 |
<dd><p>Adds plotting data to be plotted.</p> |
|
|
1753 |
<dl class="field-list simple"> |
|
|
1754 |
<dt class="field-odd">Parameters</dt> |
|
|
1755 |
<dd class="field-odd"><dl class="simple"> |
|
|
1756 |
<dt><strong>t_data_df:dataframe</strong></dt><dd><p>3-D transformed dataframe.</p> |
|
|
1757 |
</dd> |
|
|
1758 |
<dt><strong>G:nx.Graph</strong></dt><dd><p>Networkx graph.</p> |
|
|
1759 |
</dd> |
|
|
1760 |
<dt><strong>color_col:str</strong></dt><dd><p>Column to use to color points.</p> |
|
|
1761 |
</dd> |
|
|
1762 |
<dt><strong>name_col:str</strong></dt><dd><p>Column to use to name points.</p> |
|
|
1763 |
</dd> |
|
|
1764 |
<dt><strong>xyz_cols:list</strong></dt><dd><p>3 columns that denote x,y,z coords.</p> |
|
|
1765 |
</dd> |
|
|
1766 |
<dt><strong>size:int</strong></dt><dd><p>Marker size.</p> |
|
|
1767 |
</dd> |
|
|
1768 |
<dt><strong>opacity:float</strong></dt><dd><p>Marker opacity.</p> |
|
|
1769 |
</dd> |
|
|
1770 |
<dt><strong>custom_colors:list</strong></dt><dd><p>Custom colors to supply.</p> |
|
|
1771 |
</dd> |
|
|
1772 |
</dl> |
|
|
1773 |
</dd> |
|
|
1774 |
</dl> |
|
|
1775 |
</dd></dl> |
|
|
1776 |
|
|
|
1777 |
<dl class="method"> |
|
|
1778 |
<dt id="pathflowai.visualize.PlotlyPlot.plot"> |
|
|
1779 |
<code class="sig-name descname">plot</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">output_fname</em>, <em class="sig-param">axes_off=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PlotlyPlot.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PlotlyPlot.plot" title="Permalink to this definition">¶</a></dt> |
|
|
1780 |
<dd><p>Plot embedding of patches to html file.</p> |
|
|
1781 |
<dl class="field-list simple"> |
|
|
1782 |
<dt class="field-odd">Parameters</dt> |
|
|
1783 |
<dd class="field-odd"><dl class="simple"> |
|
|
1784 |
<dt><strong>output_fname:str</strong></dt><dd><p>Output html file.</p> |
|
|
1785 |
</dd> |
|
|
1786 |
<dt><strong>axes_off:bool</strong></dt><dd><p>Remove axes.</p> |
|
|
1787 |
</dd> |
|
|
1788 |
</dl> |
|
|
1789 |
</dd> |
|
|
1790 |
</dl> |
|
|
1791 |
</dd></dl> |
|
|
1792 |
|
|
|
1793 |
</dd></dl> |
|
|
1794 |
|
|
|
1795 |
<dl class="class"> |
|
|
1796 |
<dt id="pathflowai.visualize.PredictionPlotter"> |
|
|
1797 |
<em class="property">class </em><code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">PredictionPlotter</code><span class="sig-paren">(</span><em class="sig-param">dask_arr_dict</em>, <em class="sig-param">patch_info_db</em>, <em class="sig-param">compression_factor=3</em>, <em class="sig-param">alpha=0.5</em>, <em class="sig-param">patch_size=224</em>, <em class="sig-param">no_db=False</em>, <em class="sig-param">plot_annotation=False</em>, <em class="sig-param">segmentation=False</em>, <em class="sig-param">n_segmentation_classes=4</em>, <em class="sig-param">input_dir=''</em>, <em class="sig-param">annotation_col='annotation'</em>, <em class="sig-param">scaling_factor=1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PredictionPlotter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PredictionPlotter" title="Permalink to this definition">¶</a></dt> |
|
|
1798 |
<dd><p>Plots predictions over entire image.</p> |
|
|
1799 |
<dl class="field-list simple"> |
|
|
1800 |
<dt class="field-odd">Parameters</dt> |
|
|
1801 |
<dd class="field-odd"><dl class="simple"> |
|
|
1802 |
<dt><strong>dask_arr_dict:dict</strong></dt><dd><p>Stores all dask arrays corresponding to all of the images.</p> |
|
|
1803 |
</dd> |
|
|
1804 |
<dt><strong>patch_info_db:str</strong></dt><dd><p>Patch level information, eg. prediction.</p> |
|
|
1805 |
</dd> |
|
|
1806 |
<dt><strong>compression_factor:float</strong></dt><dd><p>How much to compress image by.</p> |
|
|
1807 |
</dd> |
|
|
1808 |
<dt><strong>alpha:float</strong></dt><dd><p>Low value assigns higher weight to prediction over original image.</p> |
|
|
1809 |
</dd> |
|
|
1810 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
1811 |
</dd> |
|
|
1812 |
<dt><strong>no_db:bool</strong></dt><dd><p>Don’t use patch information.</p> |
|
|
1813 |
</dd> |
|
|
1814 |
<dt><strong>plot_annotation:bool</strong></dt><dd><p>Plot annotations from patch information.</p> |
|
|
1815 |
</dd> |
|
|
1816 |
<dt><strong>segmentation:bool</strong></dt><dd><p>Plot segmentation mask.</p> |
|
|
1817 |
</dd> |
|
|
1818 |
<dt><strong>n_segmentation_classes:int</strong></dt><dd><p>Number segmentation classes.</p> |
|
|
1819 |
</dd> |
|
|
1820 |
<dt><strong>input_dir:str</strong></dt><dd><p>Input directory.</p> |
|
|
1821 |
</dd> |
|
|
1822 |
<dt><strong>annotation_col:str</strong></dt><dd><p>Annotation column to plot.</p> |
|
|
1823 |
</dd> |
|
|
1824 |
<dt><strong>scaling_factor:float</strong></dt><dd><p>Multiplies the prediction scores to make them appear darker on the images when predicting.</p> |
|
|
1825 |
</dd> |
|
|
1826 |
</dl> |
|
|
1827 |
</dd> |
|
|
1828 |
</dl> |
|
|
1829 |
<p class="rubric">Methods</p> |
|
|
1830 |
<table class="longtable docutils align-default"> |
|
|
1831 |
<colgroup> |
|
|
1832 |
<col style="width: 10%" /> |
|
|
1833 |
<col style="width: 90%" /> |
|
|
1834 |
</colgroup> |
|
|
1835 |
<tbody> |
|
|
1836 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.visualize.PredictionPlotter.add_custom_segmentation" title="pathflowai.visualize.PredictionPlotter.add_custom_segmentation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_custom_segmentation</span></code></a>(self, basename, npy)</p></td> |
|
|
1837 |
<td><p>Replace segmentation mask with new custom segmentation.</p></td> |
|
|
1838 |
</tr> |
|
|
1839 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.visualize.PredictionPlotter.generate_image" title="pathflowai.visualize.PredictionPlotter.generate_image"><code class="xref py py-obj docutils literal notranslate"><span class="pre">generate_image</span></code></a>(self, ID)</p></td> |
|
|
1840 |
<td><p>Generate the image array for the whole slide image with predictions overlaid.</p></td> |
|
|
1841 |
</tr> |
|
|
1842 |
<tr class="row-odd"><td><p><a class="reference internal" href="#pathflowai.visualize.PredictionPlotter.output_image" title="pathflowai.visualize.PredictionPlotter.output_image"><code class="xref py py-obj docutils literal notranslate"><span class="pre">output_image</span></code></a>(self, img, filename[, tif])</p></td> |
|
|
1843 |
<td><p>Output calculated image to file.</p></td> |
|
|
1844 |
</tr> |
|
|
1845 |
<tr class="row-even"><td><p><a class="reference internal" href="#pathflowai.visualize.PredictionPlotter.return_patch" title="pathflowai.visualize.PredictionPlotter.return_patch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">return_patch</span></code></a>(self, ID, x, y, patch_size)</p></td> |
|
|
1846 |
<td><p>Return one single patch instead of entire image.</p></td> |
|
|
1847 |
</tr> |
|
|
1848 |
</tbody> |
|
|
1849 |
</table> |
|
|
1850 |
<dl class="method"> |
|
|
1851 |
<dt id="pathflowai.visualize.PredictionPlotter.add_custom_segmentation"> |
|
|
1852 |
<code class="sig-name descname">add_custom_segmentation</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">basename</em>, <em class="sig-param">npy</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PredictionPlotter.add_custom_segmentation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PredictionPlotter.add_custom_segmentation" title="Permalink to this definition">¶</a></dt> |
|
|
1853 |
<dd><p>Replace segmentation mask with new custom segmentation.</p> |
|
|
1854 |
<dl class="field-list simple"> |
|
|
1855 |
<dt class="field-odd">Parameters</dt> |
|
|
1856 |
<dd class="field-odd"><dl class="simple"> |
|
|
1857 |
<dt><strong>basename:str</strong></dt><dd><p>Patient ID</p> |
|
|
1858 |
</dd> |
|
|
1859 |
<dt><strong>npy:str</strong></dt><dd><p>Numpy mask.</p> |
|
|
1860 |
</dd> |
|
|
1861 |
</dl> |
|
|
1862 |
</dd> |
|
|
1863 |
</dl> |
|
|
1864 |
</dd></dl> |
|
|
1865 |
|
|
|
1866 |
<dl class="method"> |
|
|
1867 |
<dt id="pathflowai.visualize.PredictionPlotter.generate_image"> |
|
|
1868 |
<code class="sig-name descname">generate_image</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">ID</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PredictionPlotter.generate_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PredictionPlotter.generate_image" title="Permalink to this definition">¶</a></dt> |
|
|
1869 |
<dd><p>Generate the image array for the whole slide image with predictions overlaid.</p> |
|
|
1870 |
<dl class="field-list simple"> |
|
|
1871 |
<dt class="field-odd">Parameters</dt> |
|
|
1872 |
<dd class="field-odd"><dl class="simple"> |
|
|
1873 |
<dt><strong>ID:str</strong></dt><dd><p>patient ID.</p> |
|
|
1874 |
</dd> |
|
|
1875 |
</dl> |
|
|
1876 |
</dd> |
|
|
1877 |
<dt class="field-even">Returns</dt> |
|
|
1878 |
<dd class="field-even"><dl class="simple"> |
|
|
1879 |
<dt>array</dt><dd><p>Resulting overlaid whole slide image.</p> |
|
|
1880 |
</dd> |
|
|
1881 |
</dl> |
|
|
1882 |
</dd> |
|
|
1883 |
</dl> |
|
|
1884 |
</dd></dl> |
|
|
1885 |
|
|
|
1886 |
<dl class="method"> |
|
|
1887 |
<dt id="pathflowai.visualize.PredictionPlotter.output_image"> |
|
|
1888 |
<code class="sig-name descname">output_image</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">img</em>, <em class="sig-param">filename</em>, <em class="sig-param">tif=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PredictionPlotter.output_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PredictionPlotter.output_image" title="Permalink to this definition">¶</a></dt> |
|
|
1889 |
<dd><p>Output calculated image to file.</p> |
|
|
1890 |
<dl class="field-list simple"> |
|
|
1891 |
<dt class="field-odd">Parameters</dt> |
|
|
1892 |
<dd class="field-odd"><dl class="simple"> |
|
|
1893 |
<dt><strong>img:array</strong></dt><dd><p>Image.</p> |
|
|
1894 |
</dd> |
|
|
1895 |
<dt><strong>filename:str</strong></dt><dd><p>Output file name.</p> |
|
|
1896 |
</dd> |
|
|
1897 |
<dt><strong>tif:bool</strong></dt><dd><p>Store in TIF format?</p> |
|
|
1898 |
</dd> |
|
|
1899 |
</dl> |
|
|
1900 |
</dd> |
|
|
1901 |
</dl> |
|
|
1902 |
</dd></dl> |
|
|
1903 |
|
|
|
1904 |
<dl class="method"> |
|
|
1905 |
<dt id="pathflowai.visualize.PredictionPlotter.return_patch"> |
|
|
1906 |
<code class="sig-name descname">return_patch</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">ID</em>, <em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">patch_size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#PredictionPlotter.return_patch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.PredictionPlotter.return_patch" title="Permalink to this definition">¶</a></dt> |
|
|
1907 |
<dd><p>Return one single patch instead of entire image.</p> |
|
|
1908 |
<dl class="field-list simple"> |
|
|
1909 |
<dt class="field-odd">Parameters</dt> |
|
|
1910 |
<dd class="field-odd"><dl class="simple"> |
|
|
1911 |
<dt><strong>ID:str</strong></dt><dd><p>Patient ID</p> |
|
|
1912 |
</dd> |
|
|
1913 |
<dt><strong>x:int</strong></dt><dd><p>X coordinate.</p> |
|
|
1914 |
</dd> |
|
|
1915 |
<dt><strong>y:int</strong></dt><dd><p>Y coordinate.</p> |
|
|
1916 |
</dd> |
|
|
1917 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
1918 |
</dd> |
|
|
1919 |
</dl> |
|
|
1920 |
</dd> |
|
|
1921 |
<dt class="field-even">Returns</dt> |
|
|
1922 |
<dd class="field-even"><dl class="simple"> |
|
|
1923 |
<dt>array</dt><dd><p>Image.</p> |
|
|
1924 |
</dd> |
|
|
1925 |
</dl> |
|
|
1926 |
</dd> |
|
|
1927 |
</dl> |
|
|
1928 |
</dd></dl> |
|
|
1929 |
|
|
|
1930 |
</dd></dl> |
|
|
1931 |
|
|
|
1932 |
<dl class="function"> |
|
|
1933 |
<dt id="pathflowai.visualize.annotation2rgb"> |
|
|
1934 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">annotation2rgb</code><span class="sig-paren">(</span><em class="sig-param">i</em>, <em class="sig-param">palette</em>, <em class="sig-param">arr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#annotation2rgb"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.annotation2rgb" title="Permalink to this definition">¶</a></dt> |
|
|
1935 |
<dd><p>Go from annotation of patch to color.</p> |
|
|
1936 |
<dl class="field-list simple"> |
|
|
1937 |
<dt class="field-odd">Parameters</dt> |
|
|
1938 |
<dd class="field-odd"><dl class="simple"> |
|
|
1939 |
<dt><strong>i:int</strong></dt><dd><p>Annotation index.</p> |
|
|
1940 |
</dd> |
|
|
1941 |
<dt><strong>palette:palette</strong></dt><dd><p>Index to color mapping.</p> |
|
|
1942 |
</dd> |
|
|
1943 |
<dt><strong>arr:array</strong></dt><dd><p>Image array.</p> |
|
|
1944 |
</dd> |
|
|
1945 |
</dl> |
|
|
1946 |
</dd> |
|
|
1947 |
<dt class="field-even">Returns</dt> |
|
|
1948 |
<dd class="field-even"><dl class="simple"> |
|
|
1949 |
<dt>array</dt><dd><p>Resulting image.</p> |
|
|
1950 |
</dd> |
|
|
1951 |
</dl> |
|
|
1952 |
</dd> |
|
|
1953 |
</dl> |
|
|
1954 |
</dd></dl> |
|
|
1955 |
|
|
|
1956 |
<dl class="function"> |
|
|
1957 |
<dt id="pathflowai.visualize.blend"> |
|
|
1958 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">blend</code><span class="sig-paren">(</span><em class="sig-param">arr1</em>, <em class="sig-param">arr2</em>, <em class="sig-param">alpha=0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#blend"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.blend" title="Permalink to this definition">¶</a></dt> |
|
|
1959 |
<dd><p>Blend 2 arrays together, mixing with alpha.</p> |
|
|
1960 |
<dl class="field-list simple"> |
|
|
1961 |
<dt class="field-odd">Parameters</dt> |
|
|
1962 |
<dd class="field-odd"><dl class="simple"> |
|
|
1963 |
<dt><strong>arr1:array</strong></dt><dd><p>Image 1.</p> |
|
|
1964 |
</dd> |
|
|
1965 |
<dt><strong>arr2:array</strong></dt><dd><p>Image 2.</p> |
|
|
1966 |
</dd> |
|
|
1967 |
<dt><strong>alpha:float</strong></dt><dd><p>Higher alpha makes image more like image 1.</p> |
|
|
1968 |
</dd> |
|
|
1969 |
</dl> |
|
|
1970 |
</dd> |
|
|
1971 |
<dt class="field-even">Returns</dt> |
|
|
1972 |
<dd class="field-even"><dl class="simple"> |
|
|
1973 |
<dt>array</dt><dd><p>Resulting image.</p> |
|
|
1974 |
</dd> |
|
|
1975 |
</dl> |
|
|
1976 |
</dd> |
|
|
1977 |
</dl> |
|
|
1978 |
</dd></dl> |
|
|
1979 |
|
|
|
1980 |
<dl class="function"> |
|
|
1981 |
<dt id="pathflowai.visualize.plot_image_"> |
|
|
1982 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">plot_image_</code><span class="sig-paren">(</span><em class="sig-param">image_file</em>, <em class="sig-param">compression_factor=2.0</em>, <em class="sig-param">test_image_name='test.png'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#plot_image_"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.plot_image_" title="Permalink to this definition">¶</a></dt> |
|
|
1983 |
<dd><p>Plots entire SVS/other image.</p> |
|
|
1984 |
<dl class="field-list simple"> |
|
|
1985 |
<dt class="field-odd">Parameters</dt> |
|
|
1986 |
<dd class="field-odd"><dl class="simple"> |
|
|
1987 |
<dt><strong>image_file:str</strong></dt><dd><p>Image file.</p> |
|
|
1988 |
</dd> |
|
|
1989 |
<dt><strong>compression_factor:float</strong></dt><dd><p>Amount to shrink each dimension of image.</p> |
|
|
1990 |
</dd> |
|
|
1991 |
<dt><strong>test_image_name:str</strong></dt><dd><p>Output image file.</p> |
|
|
1992 |
</dd> |
|
|
1993 |
</dl> |
|
|
1994 |
</dd> |
|
|
1995 |
</dl> |
|
|
1996 |
</dd></dl> |
|
|
1997 |
|
|
|
1998 |
<dl class="function"> |
|
|
1999 |
<dt id="pathflowai.visualize.plot_shap"> |
|
|
2000 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">plot_shap</code><span class="sig-paren">(</span><em class="sig-param">model</em>, <em class="sig-param">dataset_opts</em>, <em class="sig-param">transform_opts</em>, <em class="sig-param">batch_size</em>, <em class="sig-param">outputfilename</em>, <em class="sig-param">n_outputs=1</em>, <em class="sig-param">method='deep'</em>, <em class="sig-param">local_smoothing=0.0</em>, <em class="sig-param">n_samples=20</em>, <em class="sig-param">pred_out=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#plot_shap"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.plot_shap" title="Permalink to this definition">¶</a></dt> |
|
|
2001 |
<dd><p>Plot shapley attributions overlaid on images for classification tasks.</p> |
|
|
2002 |
<dl class="field-list simple"> |
|
|
2003 |
<dt class="field-odd">Parameters</dt> |
|
|
2004 |
<dd class="field-odd"><dl class="simple"> |
|
|
2005 |
<dt><strong>model:nn.Module</strong></dt><dd><p>Pytorch model.</p> |
|
|
2006 |
</dd> |
|
|
2007 |
<dt><strong>dataset_opts:dict</strong></dt><dd><p>Options used to configure dataset</p> |
|
|
2008 |
</dd> |
|
|
2009 |
<dt><strong>transform_opts:dict</strong></dt><dd><p>Options used to configure transformers.</p> |
|
|
2010 |
</dd> |
|
|
2011 |
<dt><strong>batch_size:int</strong></dt><dd><p>Batch size for training.</p> |
|
|
2012 |
</dd> |
|
|
2013 |
<dt><strong>outputfilename:str</strong></dt><dd><p>Output filename.</p> |
|
|
2014 |
</dd> |
|
|
2015 |
<dt><strong>n_outputs:int</strong></dt><dd><p>Number of top outputs.</p> |
|
|
2016 |
</dd> |
|
|
2017 |
<dt><strong>method:str</strong></dt><dd><p>Gradient or deep explainer.</p> |
|
|
2018 |
</dd> |
|
|
2019 |
<dt><strong>local_smoothing:float</strong></dt><dd><p>How much to smooth shapley map.</p> |
|
|
2020 |
</dd> |
|
|
2021 |
<dt><strong>n_samples:int</strong></dt><dd><p>Number shapley samples to draw.</p> |
|
|
2022 |
</dd> |
|
|
2023 |
<dt><strong>pred_out:bool</strong></dt><dd><p>Label images with binary prediction score?</p> |
|
|
2024 |
</dd> |
|
|
2025 |
</dl> |
|
|
2026 |
</dd> |
|
|
2027 |
</dl> |
|
|
2028 |
</dd></dl> |
|
|
2029 |
|
|
|
2030 |
<dl class="function"> |
|
|
2031 |
<dt id="pathflowai.visualize.plot_umap_images"> |
|
|
2032 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">plot_umap_images</code><span class="sig-paren">(</span><em class="sig-param">dask_arr_dict</em>, <em class="sig-param">embeddings_file</em>, <em class="sig-param">ID=None</em>, <em class="sig-param">cval=1.0</em>, <em class="sig-param">image_res=300.0</em>, <em class="sig-param">outputfname='output_embedding.png'</em>, <em class="sig-param">mpl_scatter=True</em>, <em class="sig-param">remove_background_annotation=''</em>, <em class="sig-param">max_background_area=0.01</em>, <em class="sig-param">zoom=0.05</em>, <em class="sig-param">n_neighbors=10</em>, <em class="sig-param">sort_col=''</em>, <em class="sig-param">sort_mode='asc'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#plot_umap_images"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.plot_umap_images" title="Permalink to this definition">¶</a></dt> |
|
|
2033 |
<dd><p>Make UMAP embedding plot, overlaid with images.</p> |
|
|
2034 |
<dl class="field-list simple"> |
|
|
2035 |
<dt class="field-odd">Parameters</dt> |
|
|
2036 |
<dd class="field-odd"><dl class="simple"> |
|
|
2037 |
<dt><strong>dask_arr_dict:dict</strong></dt><dd><p>Stored dask arrays for each WSI.</p> |
|
|
2038 |
</dd> |
|
|
2039 |
<dt><strong>embeddings_file:str</strong></dt><dd><p>Embeddings pickle file stored from running using after trainign the model.</p> |
|
|
2040 |
</dd> |
|
|
2041 |
<dt><strong>ID:str</strong></dt><dd><p>Patient ID.</p> |
|
|
2042 |
</dd> |
|
|
2043 |
<dt><strong>cval:float</strong></dt><dd><p>Deprecated</p> |
|
|
2044 |
</dd> |
|
|
2045 |
<dt><strong>image_res:float</strong></dt><dd><p>Image resolution.</p> |
|
|
2046 |
</dd> |
|
|
2047 |
<dt><strong>outputfname:str</strong></dt><dd><p>Output image file.</p> |
|
|
2048 |
</dd> |
|
|
2049 |
<dt><strong>mpl_scatter:bool</strong></dt><dd><p>Recommended: Use matplotlib for scatter plot.</p> |
|
|
2050 |
</dd> |
|
|
2051 |
<dt><strong>remove_background_annotation:str</strong></dt><dd><p>Remove the background annotations. Enter for annotation to remove.</p> |
|
|
2052 |
</dd> |
|
|
2053 |
<dt><strong>max_background_area:float</strong></dt><dd><p>Maximum backgrund area in each tile for inclusion.</p> |
|
|
2054 |
</dd> |
|
|
2055 |
<dt><strong>zoom:float</strong></dt><dd><p>How much to zoom in on each patch, less than 1 is zoom out.</p> |
|
|
2056 |
</dd> |
|
|
2057 |
<dt><strong>n_neighbors:int</strong></dt><dd><p>Number of neighbors for UMAP embedding.</p> |
|
|
2058 |
</dd> |
|
|
2059 |
<dt><strong>sort_col:str</strong></dt><dd><p>Patch info column to sort on.</p> |
|
|
2060 |
</dd> |
|
|
2061 |
<dt><strong>sort_mode:str</strong></dt><dd><p>Sort ascending or descending.</p> |
|
|
2062 |
</dd> |
|
|
2063 |
</dl> |
|
|
2064 |
</dd> |
|
|
2065 |
<dt class="field-even">Returns</dt> |
|
|
2066 |
<dd class="field-even"><dl class="simple"> |
|
|
2067 |
<dt>type</dt><dd><p>Description of returned object.</p> |
|
|
2068 |
</dd> |
|
|
2069 |
<dt>Inspired by: <a class="reference external" href="https://gist.github.com/lukemetz/be6123c7ee3b366e333a">https://gist.github.com/lukemetz/be6123c7ee3b366e333a</a></dt><dd></dd> |
|
|
2070 |
<dt>WIP!! Needs testing.</dt><dd></dd> |
|
|
2071 |
</dl> |
|
|
2072 |
</dd> |
|
|
2073 |
</dl> |
|
|
2074 |
</dd></dl> |
|
|
2075 |
|
|
|
2076 |
<dl class="function"> |
|
|
2077 |
<dt id="pathflowai.visualize.prob2rbg"> |
|
|
2078 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">prob2rbg</code><span class="sig-paren">(</span><em class="sig-param">prob</em>, <em class="sig-param">palette</em>, <em class="sig-param">arr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#prob2rbg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.prob2rbg" title="Permalink to this definition">¶</a></dt> |
|
|
2079 |
<dd><p>Convert probability score to rgb image.</p> |
|
|
2080 |
<dl class="field-list simple"> |
|
|
2081 |
<dt class="field-odd">Parameters</dt> |
|
|
2082 |
<dd class="field-odd"><dl class="simple"> |
|
|
2083 |
<dt><strong>prob:float</strong></dt><dd><p>Between 0 and 1 score.</p> |
|
|
2084 |
</dd> |
|
|
2085 |
<dt><strong>palette:palette</strong></dt><dd><p>Pallet converts between prob and color.</p> |
|
|
2086 |
</dd> |
|
|
2087 |
<dt><strong>arr:array</strong></dt><dd><p>Original array.</p> |
|
|
2088 |
</dd> |
|
|
2089 |
</dl> |
|
|
2090 |
</dd> |
|
|
2091 |
<dt class="field-even">Returns</dt> |
|
|
2092 |
<dd class="field-even"><dl class="simple"> |
|
|
2093 |
<dt>array</dt><dd><p>New image colored by prediction score.</p> |
|
|
2094 |
</dd> |
|
|
2095 |
</dl> |
|
|
2096 |
</dd> |
|
|
2097 |
</dl> |
|
|
2098 |
</dd></dl> |
|
|
2099 |
|
|
|
2100 |
<dl class="function"> |
|
|
2101 |
<dt id="pathflowai.visualize.seg2rgb"> |
|
|
2102 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">seg2rgb</code><span class="sig-paren">(</span><em class="sig-param">seg</em>, <em class="sig-param">palette</em>, <em class="sig-param">n_segmentation_classes</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#seg2rgb"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.seg2rgb" title="Permalink to this definition">¶</a></dt> |
|
|
2103 |
<dd><p>Color each pixel by segmentation class.</p> |
|
|
2104 |
<dl class="field-list simple"> |
|
|
2105 |
<dt class="field-odd">Parameters</dt> |
|
|
2106 |
<dd class="field-odd"><dl class="simple"> |
|
|
2107 |
<dt><strong>seg:array</strong></dt><dd><p>Segmentation mask.</p> |
|
|
2108 |
</dd> |
|
|
2109 |
<dt><strong>palette:palette</strong></dt><dd><p>Color to RGB map.</p> |
|
|
2110 |
</dd> |
|
|
2111 |
<dt><strong>n_segmentation_classes:int</strong></dt><dd><p>Total number segmentation classes.</p> |
|
|
2112 |
</dd> |
|
|
2113 |
</dl> |
|
|
2114 |
</dd> |
|
|
2115 |
<dt class="field-even">Returns</dt> |
|
|
2116 |
<dd class="field-even"><dl class="simple"> |
|
|
2117 |
<dt>array</dt><dd><p>Returned segmentation image.</p> |
|
|
2118 |
</dd> |
|
|
2119 |
</dl> |
|
|
2120 |
</dd> |
|
|
2121 |
</dl> |
|
|
2122 |
</dd></dl> |
|
|
2123 |
|
|
|
2124 |
<dl class="function"> |
|
|
2125 |
<dt id="pathflowai.visualize.to_pil"> |
|
|
2126 |
<code class="sig-prename descclassname">pathflowai.visualize.</code><code class="sig-name descname">to_pil</code><span class="sig-paren">(</span><em class="sig-param">arr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/visualize.html#to_pil"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.visualize.to_pil" title="Permalink to this definition">¶</a></dt> |
|
|
2127 |
<dd><p>Numpy array to pil.</p> |
|
|
2128 |
<dl class="field-list simple"> |
|
|
2129 |
<dt class="field-odd">Parameters</dt> |
|
|
2130 |
<dd class="field-odd"><dl class="simple"> |
|
|
2131 |
<dt><strong>arr:array</strong></dt><dd><p>Numpy array.</p> |
|
|
2132 |
</dd> |
|
|
2133 |
</dl> |
|
|
2134 |
</dd> |
|
|
2135 |
<dt class="field-even">Returns</dt> |
|
|
2136 |
<dd class="field-even"><dl class="simple"> |
|
|
2137 |
<dt>Image</dt><dd><p>PIL Image.</p> |
|
|
2138 |
</dd> |
|
|
2139 |
</dl> |
|
|
2140 |
</dd> |
|
|
2141 |
</dl> |
|
|
2142 |
</dd></dl> |
|
|
2143 |
|
|
|
2144 |
</div> |
|
|
2145 |
<span class="target" id="module-pathflowai.utils"></span><div class="section" id="utils-py"> |
|
|
2146 |
<h2>utils.py<a class="headerlink" href="#utils-py" title="Permalink to this headline">¶</a></h2> |
|
|
2147 |
<p>General utilities that still need to be broken up into preprocessing, machine learning input preparation, and output submodules.</p> |
|
|
2148 |
<dl class="function"> |
|
|
2149 |
<dt id="pathflowai.utils.add_purple_mask"> |
|
|
2150 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">add_purple_mask</code><span class="sig-paren">(</span><em class="sig-param">arr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#add_purple_mask"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.add_purple_mask" title="Permalink to this definition">¶</a></dt> |
|
|
2151 |
<dd><p>Optional add intensity mask to the dask array.</p> |
|
|
2152 |
<dl class="field-list simple"> |
|
|
2153 |
<dt class="field-odd">Parameters</dt> |
|
|
2154 |
<dd class="field-odd"><dl class="simple"> |
|
|
2155 |
<dt><strong>arr:dask.array</strong></dt><dd><p>Image data.</p> |
|
|
2156 |
</dd> |
|
|
2157 |
</dl> |
|
|
2158 |
</dd> |
|
|
2159 |
<dt class="field-even">Returns</dt> |
|
|
2160 |
<dd class="field-even"><dl class="simple"> |
|
|
2161 |
<dt>array</dt><dd><p>Image data with intensity added as forth channel.</p> |
|
|
2162 |
</dd> |
|
|
2163 |
</dl> |
|
|
2164 |
</dd> |
|
|
2165 |
</dl> |
|
|
2166 |
</dd></dl> |
|
|
2167 |
|
|
|
2168 |
<dl class="function"> |
|
|
2169 |
<dt id="pathflowai.utils.adjust_mask"> |
|
|
2170 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">adjust_mask</code><span class="sig-paren">(</span><em class="sig-param">mask_file</em>, <em class="sig-param">dask_img_array_file</em>, <em class="sig-param">out_npy</em>, <em class="sig-param">n_neighbors</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#adjust_mask"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.adjust_mask" title="Permalink to this definition">¶</a></dt> |
|
|
2171 |
<dd><p>Fixes segmentation masks to reduce coarse annotations over empty regions.</p> |
|
|
2172 |
<dl class="field-list simple"> |
|
|
2173 |
<dt class="field-odd">Parameters</dt> |
|
|
2174 |
<dd class="field-odd"><dl class="simple"> |
|
|
2175 |
<dt><strong>mask_file:str</strong></dt><dd><p>NPY segmentation mask.</p> |
|
|
2176 |
</dd> |
|
|
2177 |
<dt><strong>dask_img_array_file:str</strong></dt><dd><p>Dask image file.</p> |
|
|
2178 |
</dd> |
|
|
2179 |
<dt><strong>out_npy:str</strong></dt><dd><p>Output numpy file.</p> |
|
|
2180 |
</dd> |
|
|
2181 |
<dt><strong>n_neighbors:int</strong></dt><dd><p>Number nearest neighbors for dilation and erosion of mask from background to not background.</p> |
|
|
2182 |
</dd> |
|
|
2183 |
</dl> |
|
|
2184 |
</dd> |
|
|
2185 |
<dt class="field-even">Returns</dt> |
|
|
2186 |
<dd class="field-even"><dl class="simple"> |
|
|
2187 |
<dt>str</dt><dd><p>Output numpy file.</p> |
|
|
2188 |
</dd> |
|
|
2189 |
</dl> |
|
|
2190 |
</dd> |
|
|
2191 |
</dl> |
|
|
2192 |
</dd></dl> |
|
|
2193 |
|
|
|
2194 |
<dl class="function"> |
|
|
2195 |
<dt id="pathflowai.utils.boxes2interior"> |
|
|
2196 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">boxes2interior</code><span class="sig-paren">(</span><em class="sig-param">img_size</em>, <em class="sig-param">polygons</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#boxes2interior"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.boxes2interior" title="Permalink to this definition">¶</a></dt> |
|
|
2197 |
<dd><p>Deprecated.</p> |
|
|
2198 |
</dd></dl> |
|
|
2199 |
|
|
|
2200 |
<dl class="function"> |
|
|
2201 |
<dt id="pathflowai.utils.create_purple_mask"> |
|
|
2202 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">create_purple_mask</code><span class="sig-paren">(</span><em class="sig-param">arr</em>, <em class="sig-param">img_size=None</em>, <em class="sig-param">sparse=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#create_purple_mask"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.create_purple_mask" title="Permalink to this definition">¶</a></dt> |
|
|
2203 |
<dd><p>Create a gray scale intensity mask. This will be changed soon to support other thresholding QC methods.</p> |
|
|
2204 |
<dl class="field-list simple"> |
|
|
2205 |
<dt class="field-odd">Parameters</dt> |
|
|
2206 |
<dd class="field-odd"><dl class="simple"> |
|
|
2207 |
<dt><strong>arr:dask.array</strong></dt><dd><p>Dask array containing image information.</p> |
|
|
2208 |
</dd> |
|
|
2209 |
<dt><strong>img_size:int</strong></dt><dd><p>Deprecated.</p> |
|
|
2210 |
</dd> |
|
|
2211 |
<dt><strong>sparse:bool</strong></dt><dd><p>Deprecated</p> |
|
|
2212 |
</dd> |
|
|
2213 |
</dl> |
|
|
2214 |
</dd> |
|
|
2215 |
<dt class="field-even">Returns</dt> |
|
|
2216 |
<dd class="field-even"><dl class="simple"> |
|
|
2217 |
<dt>dask.array</dt><dd><p>Intensity, grayscale array over image.</p> |
|
|
2218 |
</dd> |
|
|
2219 |
</dl> |
|
|
2220 |
</dd> |
|
|
2221 |
</dl> |
|
|
2222 |
</dd></dl> |
|
|
2223 |
|
|
|
2224 |
<dl class="function"> |
|
|
2225 |
<dt id="pathflowai.utils.create_sparse_annotation_arrays"> |
|
|
2226 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">create_sparse_annotation_arrays</code><span class="sig-paren">(</span><em class="sig-param">xml_file</em>, <em class="sig-param">img_size</em>, <em class="sig-param">annotations=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#create_sparse_annotation_arrays"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.create_sparse_annotation_arrays" title="Permalink to this definition">¶</a></dt> |
|
|
2227 |
<dd><p>Convert annotation xml to shapely objects and store in dictionary.</p> |
|
|
2228 |
<dl class="field-list simple"> |
|
|
2229 |
<dt class="field-odd">Parameters</dt> |
|
|
2230 |
<dd class="field-odd"><dl class="simple"> |
|
|
2231 |
<dt><strong>xml_file:str</strong></dt><dd><p>XML file containing annotations.</p> |
|
|
2232 |
</dd> |
|
|
2233 |
<dt><strong>img_size:int</strong></dt><dd><p>Deprecated.</p> |
|
|
2234 |
</dd> |
|
|
2235 |
<dt><strong>annotations:list</strong></dt><dd><p>Annotations to look for in xml export.</p> |
|
|
2236 |
</dd> |
|
|
2237 |
</dl> |
|
|
2238 |
</dd> |
|
|
2239 |
<dt class="field-even">Returns</dt> |
|
|
2240 |
<dd class="field-even"><dl class="simple"> |
|
|
2241 |
<dt>dict</dt><dd><p>Dictionary with annotation-shapely object pairs.</p> |
|
|
2242 |
</dd> |
|
|
2243 |
</dl> |
|
|
2244 |
</dd> |
|
|
2245 |
</dl> |
|
|
2246 |
</dd></dl> |
|
|
2247 |
|
|
|
2248 |
<dl class="function"> |
|
|
2249 |
<dt id="pathflowai.utils.create_train_val_test"> |
|
|
2250 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">create_train_val_test</code><span class="sig-paren">(</span><em class="sig-param">train_val_test_pkl</em>, <em class="sig-param">input_info_db</em>, <em class="sig-param">patch_size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#create_train_val_test"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.create_train_val_test" title="Permalink to this definition">¶</a></dt> |
|
|
2251 |
<dd><p>Create dataframe that splits slides into training validation and test.</p> |
|
|
2252 |
<dl class="field-list simple"> |
|
|
2253 |
<dt class="field-odd">Parameters</dt> |
|
|
2254 |
<dd class="field-odd"><dl class="simple"> |
|
|
2255 |
<dt><strong>train_val_test_pkl:str</strong></dt><dd><p>Pickle for training validation and test slides.</p> |
|
|
2256 |
</dd> |
|
|
2257 |
<dt><strong>input_info_db:str</strong></dt><dd><p>Patch information SQL database.</p> |
|
|
2258 |
</dd> |
|
|
2259 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size looking to access.</p> |
|
|
2260 |
</dd> |
|
|
2261 |
</dl> |
|
|
2262 |
</dd> |
|
|
2263 |
<dt class="field-even">Returns</dt> |
|
|
2264 |
<dd class="field-even"><dl class="simple"> |
|
|
2265 |
<dt>dataframe</dt><dd><p>Train test validation splits.</p> |
|
|
2266 |
</dd> |
|
|
2267 |
</dl> |
|
|
2268 |
</dd> |
|
|
2269 |
</dl> |
|
|
2270 |
</dd></dl> |
|
|
2271 |
|
|
|
2272 |
<dl class="function"> |
|
|
2273 |
<dt id="pathflowai.utils.df2sql"> |
|
|
2274 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">df2sql</code><span class="sig-paren">(</span><em class="sig-param">df</em>, <em class="sig-param">sql_file</em>, <em class="sig-param">patch_size</em>, <em class="sig-param">mode='replace'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#df2sql"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.df2sql" title="Permalink to this definition">¶</a></dt> |
|
|
2275 |
<dd><p>Write dataframe containing patch level information to SQL db.</p> |
|
|
2276 |
<dl class="field-list simple"> |
|
|
2277 |
<dt class="field-odd">Parameters</dt> |
|
|
2278 |
<dd class="field-odd"><dl class="simple"> |
|
|
2279 |
<dt><strong>df:dataframe</strong></dt><dd><p>Dataframe containing patch information.</p> |
|
|
2280 |
</dd> |
|
|
2281 |
<dt><strong>sql_file:str</strong></dt><dd><p>SQL database.</p> |
|
|
2282 |
</dd> |
|
|
2283 |
<dt><strong>patch_size:int</strong></dt><dd><p>Size of patches.</p> |
|
|
2284 |
</dd> |
|
|
2285 |
<dt><strong>mode:str</strong></dt><dd><p>Replace or append.</p> |
|
|
2286 |
</dd> |
|
|
2287 |
</dl> |
|
|
2288 |
</dd> |
|
|
2289 |
</dl> |
|
|
2290 |
</dd></dl> |
|
|
2291 |
|
|
|
2292 |
<dl class="function"> |
|
|
2293 |
<dt id="pathflowai.utils.dir2images"> |
|
|
2294 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">dir2images</code><span class="sig-paren">(</span><em class="sig-param">image_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#dir2images"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.dir2images" title="Permalink to this definition">¶</a></dt> |
|
|
2295 |
<dd><p>Deprecated</p> |
|
|
2296 |
</dd></dl> |
|
|
2297 |
|
|
|
2298 |
<dl class="function"> |
|
|
2299 |
<dt id="pathflowai.utils.extract_patch_information"> |
|
|
2300 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">extract_patch_information</code><span class="sig-paren">(</span><em class="sig-param">basename</em>, <em class="sig-param">input_dir='./'</em>, <em class="sig-param">annotations=[]</em>, <em class="sig-param">threshold=0.5</em>, <em class="sig-param">patch_size=224</em>, <em class="sig-param">generate_finetune_segmentation=False</em>, <em class="sig-param">target_class=0</em>, <em class="sig-param">intensity_threshold=100.0</em>, <em class="sig-param">target_threshold=0.0</em>, <em class="sig-param">adj_mask=''</em>, <em class="sig-param">basic_preprocess=False</em>, <em class="sig-param">tries=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#extract_patch_information"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.extract_patch_information" title="Permalink to this definition">¶</a></dt> |
|
|
2301 |
<dd><p>Final step of preprocessing pipeline. Break up image into patches, include if not background and of a certain intensity, find area of each annotation type in patch, spatial information, image ID and dump data to SQL table.</p> |
|
|
2302 |
<dl class="field-list simple"> |
|
|
2303 |
<dt class="field-odd">Parameters</dt> |
|
|
2304 |
<dd class="field-odd"><dl class="simple"> |
|
|
2305 |
<dt><strong>basename:str</strong></dt><dd><p>Patient ID.</p> |
|
|
2306 |
</dd> |
|
|
2307 |
<dt><strong>input_dir:str</strong></dt><dd><p>Input directory.</p> |
|
|
2308 |
</dd> |
|
|
2309 |
<dt><strong>annotations:list</strong></dt><dd><p>List of annotations to record, these can be different tissue types, must correspond with XML labels.</p> |
|
|
2310 |
</dd> |
|
|
2311 |
<dt><strong>threshold:float</strong></dt><dd><p>Value between 0 and 1 that indicates the minimum amount of patch that musn’t be background for inclusion.</p> |
|
|
2312 |
</dd> |
|
|
2313 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size of patches; this will become one of the tables.</p> |
|
|
2314 |
</dd> |
|
|
2315 |
<dt><strong>generate_finetune_segmentation:bool</strong></dt><dd><p>Deprecated.</p> |
|
|
2316 |
</dd> |
|
|
2317 |
<dt><strong>target_class:int</strong></dt><dd><p>Number of segmentation classes desired, from 0th class to target_class-1 will be annotated in SQL.</p> |
|
|
2318 |
</dd> |
|
|
2319 |
<dt><strong>intensity_threshold:float</strong></dt><dd><p>Value between 0 and 255 that represents minimum intensity to not include as background. Will be modified with new transforms.</p> |
|
|
2320 |
</dd> |
|
|
2321 |
<dt><strong>target_threshold:float</strong></dt><dd><p>Deprecated.</p> |
|
|
2322 |
</dd> |
|
|
2323 |
<dt><strong>adj_mask:str</strong></dt><dd><p>Adjusted mask if performed binary opening operations in previous preprocessing step.</p> |
|
|
2324 |
</dd> |
|
|
2325 |
<dt><strong>basic_preprocess:bool</strong></dt><dd><p>Do not store patch level information.</p> |
|
|
2326 |
</dd> |
|
|
2327 |
<dt><strong>tries:int</strong></dt><dd><p>Number of tries in case there is a Dask timeout, run again.</p> |
|
|
2328 |
</dd> |
|
|
2329 |
</dl> |
|
|
2330 |
</dd> |
|
|
2331 |
<dt class="field-even">Returns</dt> |
|
|
2332 |
<dd class="field-even"><dl class="simple"> |
|
|
2333 |
<dt>dataframe</dt><dd><p>Patch information.</p> |
|
|
2334 |
</dd> |
|
|
2335 |
</dl> |
|
|
2336 |
</dd> |
|
|
2337 |
</dl> |
|
|
2338 |
</dd></dl> |
|
|
2339 |
|
|
|
2340 |
<dl class="function"> |
|
|
2341 |
<dt id="pathflowai.utils.fix_name"> |
|
|
2342 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">fix_name</code><span class="sig-paren">(</span><em class="sig-param">basename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#fix_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.fix_name" title="Permalink to this definition">¶</a></dt> |
|
|
2343 |
<dd><p>Fixes illegitimate basename, deprecated.</p> |
|
|
2344 |
</dd></dl> |
|
|
2345 |
|
|
|
2346 |
<dl class="function"> |
|
|
2347 |
<dt id="pathflowai.utils.fix_names"> |
|
|
2348 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">fix_names</code><span class="sig-paren">(</span><em class="sig-param">file_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#fix_names"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.fix_names" title="Permalink to this definition">¶</a></dt> |
|
|
2349 |
<dd><p>Fixes basenames, deprecated.</p> |
|
|
2350 |
</dd></dl> |
|
|
2351 |
|
|
|
2352 |
<dl class="function"> |
|
|
2353 |
<dt id="pathflowai.utils.generate_patch_pipeline"> |
|
|
2354 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">generate_patch_pipeline</code><span class="sig-paren">(</span><em class="sig-param">basename</em>, <em class="sig-param">input_dir='./'</em>, <em class="sig-param">annotations=[]</em>, <em class="sig-param">threshold=0.5</em>, <em class="sig-param">patch_size=224</em>, <em class="sig-param">out_db='patch_info.db'</em>, <em class="sig-param">generate_finetune_segmentation=False</em>, <em class="sig-param">target_class=0</em>, <em class="sig-param">intensity_threshold=100.0</em>, <em class="sig-param">target_threshold=0.0</em>, <em class="sig-param">adj_mask=''</em>, <em class="sig-param">basic_preprocess=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#generate_patch_pipeline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.generate_patch_pipeline" title="Permalink to this definition">¶</a></dt> |
|
|
2355 |
<dd><p>Short summary.</p> |
|
|
2356 |
<dl class="field-list simple"> |
|
|
2357 |
<dt class="field-odd">Parameters</dt> |
|
|
2358 |
<dd class="field-odd"><dl class="simple"> |
|
|
2359 |
<dt><strong>basename:str</strong></dt><dd><p>Patient ID.</p> |
|
|
2360 |
</dd> |
|
|
2361 |
<dt><strong>input_dir:str</strong></dt><dd><p>Input directory.</p> |
|
|
2362 |
</dd> |
|
|
2363 |
<dt><strong>annotations:list</strong></dt><dd><p>List of annotations to record, these can be different tissue types, must correspond with XML labels.</p> |
|
|
2364 |
</dd> |
|
|
2365 |
<dt><strong>threshold:float</strong></dt><dd><p>Value between 0 and 1 that indicates the minimum amount of patch that musn’t be background for inclusion.</p> |
|
|
2366 |
</dd> |
|
|
2367 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size of patches; this will become one of the tables.</p> |
|
|
2368 |
</dd> |
|
|
2369 |
<dt><strong>out_db:str</strong></dt><dd><p>Output SQL database.</p> |
|
|
2370 |
</dd> |
|
|
2371 |
<dt><strong>generate_finetune_segmentation:bool</strong></dt><dd><p>Deprecated.</p> |
|
|
2372 |
</dd> |
|
|
2373 |
<dt><strong>target_class:int</strong></dt><dd><p>Number of segmentation classes desired, from 0th class to target_class-1 will be annotated in SQL.</p> |
|
|
2374 |
</dd> |
|
|
2375 |
<dt><strong>intensity_threshold:float</strong></dt><dd><p>Value between 0 and 255 that represents minimum intensity to not include as background. Will be modified with new transforms.</p> |
|
|
2376 |
</dd> |
|
|
2377 |
<dt><strong>target_threshold:float</strong></dt><dd><p>Deprecated.</p> |
|
|
2378 |
</dd> |
|
|
2379 |
<dt><strong>adj_mask:str</strong></dt><dd><p>Adjusted mask if performed binary opening operations in previous preprocessing step.</p> |
|
|
2380 |
</dd> |
|
|
2381 |
<dt><strong>basic_preprocess:bool</strong></dt><dd><p>Do not store patch level information.</p> |
|
|
2382 |
</dd> |
|
|
2383 |
</dl> |
|
|
2384 |
</dd> |
|
|
2385 |
</dl> |
|
|
2386 |
</dd></dl> |
|
|
2387 |
|
|
|
2388 |
<dl class="function"> |
|
|
2389 |
<dt id="pathflowai.utils.grab_interior_points"> |
|
|
2390 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">grab_interior_points</code><span class="sig-paren">(</span><em class="sig-param">xml_file</em>, <em class="sig-param">img_size</em>, <em class="sig-param">annotations=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#grab_interior_points"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.grab_interior_points" title="Permalink to this definition">¶</a></dt> |
|
|
2391 |
<dd><p>Deprecated.</p> |
|
|
2392 |
</dd></dl> |
|
|
2393 |
|
|
|
2394 |
<dl class="function"> |
|
|
2395 |
<dt id="pathflowai.utils.image2coords"> |
|
|
2396 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">image2coords</code><span class="sig-paren">(</span><em class="sig-param">image_file</em>, <em class="sig-param">output_point=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#image2coords"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.image2coords" title="Permalink to this definition">¶</a></dt> |
|
|
2397 |
<dd><p>Deprecated.</p> |
|
|
2398 |
</dd></dl> |
|
|
2399 |
|
|
|
2400 |
<dl class="function"> |
|
|
2401 |
<dt id="pathflowai.utils.images2coord_dict"> |
|
|
2402 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">images2coord_dict</code><span class="sig-paren">(</span><em class="sig-param">images</em>, <em class="sig-param">output_point=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#images2coord_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.images2coord_dict" title="Permalink to this definition">¶</a></dt> |
|
|
2403 |
<dd><p>Deprecated</p> |
|
|
2404 |
</dd></dl> |
|
|
2405 |
|
|
|
2406 |
<dl class="function"> |
|
|
2407 |
<dt id="pathflowai.utils.img2npy_"> |
|
|
2408 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">img2npy_</code><span class="sig-paren">(</span><em class="sig-param">input_dir</em>, <em class="sig-param">basename</em>, <em class="sig-param">svs_file</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#img2npy_"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.img2npy_" title="Permalink to this definition">¶</a></dt> |
|
|
2409 |
<dd><p>Convert SVS, TIF, TIFF to NPY.</p> |
|
|
2410 |
<dl class="field-list simple"> |
|
|
2411 |
<dt class="field-odd">Parameters</dt> |
|
|
2412 |
<dd class="field-odd"><dl class="simple"> |
|
|
2413 |
<dt><strong>input_dir:str</strong></dt><dd><p>Output file dir.</p> |
|
|
2414 |
</dd> |
|
|
2415 |
<dt><strong>basename:str</strong></dt><dd><p>Basename of output file</p> |
|
|
2416 |
</dd> |
|
|
2417 |
<dt><strong>svs_file:str</strong></dt><dd><p>SVS, TIF, TIFF file input.</p> |
|
|
2418 |
</dd> |
|
|
2419 |
</dl> |
|
|
2420 |
</dd> |
|
|
2421 |
<dt class="field-even">Returns</dt> |
|
|
2422 |
<dd class="field-even"><dl class="simple"> |
|
|
2423 |
<dt>str</dt><dd><p>NPY output file.</p> |
|
|
2424 |
</dd> |
|
|
2425 |
</dl> |
|
|
2426 |
</dd> |
|
|
2427 |
</dl> |
|
|
2428 |
</dd></dl> |
|
|
2429 |
|
|
|
2430 |
<dl class="function"> |
|
|
2431 |
<dt id="pathflowai.utils.is_coords_in_box"> |
|
|
2432 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">is_coords_in_box</code><span class="sig-paren">(</span><em class="sig-param">coords</em>, <em class="sig-param">patch_size</em>, <em class="sig-param">boxes</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#is_coords_in_box"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.is_coords_in_box" title="Permalink to this definition">¶</a></dt> |
|
|
2433 |
<dd><p>Get area of annotation in patch.</p> |
|
|
2434 |
<dl class="field-list simple"> |
|
|
2435 |
<dt class="field-odd">Parameters</dt> |
|
|
2436 |
<dd class="field-odd"><dl class="simple"> |
|
|
2437 |
<dt><strong>coords:array</strong></dt><dd><p>X,Y coordinates of patch.</p> |
|
|
2438 |
</dd> |
|
|
2439 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
2440 |
</dd> |
|
|
2441 |
<dt><strong>boxes:list</strong></dt><dd><p>Shapely objects for annotations.</p> |
|
|
2442 |
</dd> |
|
|
2443 |
</dl> |
|
|
2444 |
</dd> |
|
|
2445 |
<dt class="field-even">Returns</dt> |
|
|
2446 |
<dd class="field-even"><dl class="simple"> |
|
|
2447 |
<dt>float</dt><dd><p>Area of annotation type.</p> |
|
|
2448 |
</dd> |
|
|
2449 |
</dl> |
|
|
2450 |
</dd> |
|
|
2451 |
</dl> |
|
|
2452 |
</dd></dl> |
|
|
2453 |
|
|
|
2454 |
<dl class="function"> |
|
|
2455 |
<dt id="pathflowai.utils.is_image_in_boxes"> |
|
|
2456 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">is_image_in_boxes</code><span class="sig-paren">(</span><em class="sig-param">image_coord_dict</em>, <em class="sig-param">boxes</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#is_image_in_boxes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.is_image_in_boxes" title="Permalink to this definition">¶</a></dt> |
|
|
2457 |
<dd><p>Find if image intersects with annotations.</p> |
|
|
2458 |
<dl class="field-list simple"> |
|
|
2459 |
<dt class="field-odd">Parameters</dt> |
|
|
2460 |
<dd class="field-odd"><dl class="simple"> |
|
|
2461 |
<dt><strong>image_coord_dict:dict</strong></dt><dd><p>Dictionary of patches.</p> |
|
|
2462 |
</dd> |
|
|
2463 |
<dt><strong>boxes:list</strong></dt><dd><p>Shapely annotation shapes.</p> |
|
|
2464 |
</dd> |
|
|
2465 |
</dl> |
|
|
2466 |
</dd> |
|
|
2467 |
<dt class="field-even">Returns</dt> |
|
|
2468 |
<dd class="field-even"><dl class="simple"> |
|
|
2469 |
<dt>dict</dt><dd><p>Dictionary of whether image intersects with any of the annotations.</p> |
|
|
2470 |
</dd> |
|
|
2471 |
</dl> |
|
|
2472 |
</dd> |
|
|
2473 |
</dl> |
|
|
2474 |
</dd></dl> |
|
|
2475 |
|
|
|
2476 |
<dl class="function"> |
|
|
2477 |
<dt id="pathflowai.utils.is_valid_patch"> |
|
|
2478 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">is_valid_patch</code><span class="sig-paren">(</span><em class="sig-param">xs</em>, <em class="sig-param">ys</em>, <em class="sig-param">patch_size</em>, <em class="sig-param">purple_mask</em>, <em class="sig-param">intensity_threshold</em>, <em class="sig-param">threshold=0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#is_valid_patch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.is_valid_patch" title="Permalink to this definition">¶</a></dt> |
|
|
2479 |
<dd><p>Deprecated, computes whether patch is valid.</p> |
|
|
2480 |
</dd></dl> |
|
|
2481 |
|
|
|
2482 |
<dl class="function"> |
|
|
2483 |
<dt id="pathflowai.utils.load_dataset"> |
|
|
2484 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">load_dataset</code><span class="sig-paren">(</span><em class="sig-param">in_zarr</em>, <em class="sig-param">in_pkl</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#load_dataset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.load_dataset" title="Permalink to this definition">¶</a></dt> |
|
|
2485 |
<dd><p>Load ZARR image and annotations pickle.</p> |
|
|
2486 |
<dl class="field-list simple"> |
|
|
2487 |
<dt class="field-odd">Parameters</dt> |
|
|
2488 |
<dd class="field-odd"><dl class="simple"> |
|
|
2489 |
<dt><strong>in_zarr:str</strong></dt><dd><p>Input image.</p> |
|
|
2490 |
</dd> |
|
|
2491 |
<dt><strong>in_pkl:str</strong></dt><dd><p>Input annotations.</p> |
|
|
2492 |
</dd> |
|
|
2493 |
</dl> |
|
|
2494 |
</dd> |
|
|
2495 |
<dt class="field-even">Returns</dt> |
|
|
2496 |
<dd class="field-even"><dl class="simple"> |
|
|
2497 |
<dt>dask.array</dt><dd><p>Image array.</p> |
|
|
2498 |
</dd> |
|
|
2499 |
<dt>dict</dt><dd><p>Annotations dictionary.</p> |
|
|
2500 |
</dd> |
|
|
2501 |
</dl> |
|
|
2502 |
</dd> |
|
|
2503 |
</dl> |
|
|
2504 |
</dd></dl> |
|
|
2505 |
|
|
|
2506 |
<dl class="function"> |
|
|
2507 |
<dt id="pathflowai.utils.load_image"> |
|
|
2508 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">load_image</code><span class="sig-paren">(</span><em class="sig-param">svs_file</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#load_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.load_image" title="Permalink to this definition">¶</a></dt> |
|
|
2509 |
<dd><p>Load SVS, TIF, TIFF</p> |
|
|
2510 |
<dl class="field-list simple"> |
|
|
2511 |
<dt class="field-odd">Parameters</dt> |
|
|
2512 |
<dd class="field-odd"><dl class="simple"> |
|
|
2513 |
<dt><strong>svs_file:type</strong></dt><dd><p>Description of parameter <cite>svs_file</cite>.</p> |
|
|
2514 |
</dd> |
|
|
2515 |
</dl> |
|
|
2516 |
</dd> |
|
|
2517 |
<dt class="field-even">Returns</dt> |
|
|
2518 |
<dd class="field-even"><dl class="simple"> |
|
|
2519 |
<dt>type</dt><dd><p>Description of returned object.</p> |
|
|
2520 |
</dd> |
|
|
2521 |
</dl> |
|
|
2522 |
</dd> |
|
|
2523 |
</dl> |
|
|
2524 |
</dd></dl> |
|
|
2525 |
|
|
|
2526 |
<dl class="function"> |
|
|
2527 |
<dt id="pathflowai.utils.load_process_image"> |
|
|
2528 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">load_process_image</code><span class="sig-paren">(</span><em class="sig-param">svs_file</em>, <em class="sig-param">xml_file=None</em>, <em class="sig-param">npy_mask=None</em>, <em class="sig-param">annotations=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#load_process_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.load_process_image" title="Permalink to this definition">¶</a></dt> |
|
|
2529 |
<dd><p>Load SVS-like image (including NPY), segmentation/classification annotations, generate dask array and dictionary of annotations.</p> |
|
|
2530 |
<dl class="field-list simple"> |
|
|
2531 |
<dt class="field-odd">Parameters</dt> |
|
|
2532 |
<dd class="field-odd"><dl class="simple"> |
|
|
2533 |
<dt><strong>svs_file:str</strong></dt><dd><p>Image file</p> |
|
|
2534 |
</dd> |
|
|
2535 |
<dt><strong>xml_file:str</strong></dt><dd><p>Annotation file.</p> |
|
|
2536 |
</dd> |
|
|
2537 |
<dt><strong>npy_mask:array</strong></dt><dd><p>Numpy segmentation mask.</p> |
|
|
2538 |
</dd> |
|
|
2539 |
<dt><strong>annotations:list</strong></dt><dd><p>List of annotations in xml.</p> |
|
|
2540 |
</dd> |
|
|
2541 |
</dl> |
|
|
2542 |
</dd> |
|
|
2543 |
<dt class="field-even">Returns</dt> |
|
|
2544 |
<dd class="field-even"><dl class="simple"> |
|
|
2545 |
<dt>array</dt><dd><p>Dask array of image.</p> |
|
|
2546 |
</dd> |
|
|
2547 |
<dt>dict</dt><dd><p>Annotation masks.</p> |
|
|
2548 |
</dd> |
|
|
2549 |
</dl> |
|
|
2550 |
</dd> |
|
|
2551 |
</dl> |
|
|
2552 |
</dd></dl> |
|
|
2553 |
|
|
|
2554 |
<dl class="function"> |
|
|
2555 |
<dt id="pathflowai.utils.load_sql_df"> |
|
|
2556 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">load_sql_df</code><span class="sig-paren">(</span><em class="sig-param">sql_file</em>, <em class="sig-param">patch_size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#load_sql_df"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.load_sql_df" title="Permalink to this definition">¶</a></dt> |
|
|
2557 |
<dd><p>Load pandas dataframe from SQL, accessing particular patch size within SQL.</p> |
|
|
2558 |
<dl class="field-list simple"> |
|
|
2559 |
<dt class="field-odd">Parameters</dt> |
|
|
2560 |
<dd class="field-odd"><dl class="simple"> |
|
|
2561 |
<dt><strong>sql_file:str</strong></dt><dd><p>SQL db.</p> |
|
|
2562 |
</dd> |
|
|
2563 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
2564 |
</dd> |
|
|
2565 |
</dl> |
|
|
2566 |
</dd> |
|
|
2567 |
<dt class="field-even">Returns</dt> |
|
|
2568 |
<dd class="field-even"><dl class="simple"> |
|
|
2569 |
<dt>dataframe</dt><dd><p>Patch level information.</p> |
|
|
2570 |
</dd> |
|
|
2571 |
</dl> |
|
|
2572 |
</dd> |
|
|
2573 |
</dl> |
|
|
2574 |
</dd></dl> |
|
|
2575 |
|
|
|
2576 |
<dl class="function"> |
|
|
2577 |
<dt> |
|
|
2578 |
<code class="sig-name descname">modify_patch_info(input_info_db='patch_info.db', slide_labels=Empty DataFrame</code></dt> |
|
|
2579 |
<dt> |
|
|
2580 |
<code class="sig-name descname">Columns: []</code></dt> |
|
|
2581 |
<dt> |
|
|
2582 |
<code class="sig-name descname">Index: [], pos_annotation_class='', patch_size=224, segmentation=False, other_annotations=[], target_segmentation_class=-1, target_threshold=0.0, classify_annotations=False)</code></dt> |
|
|
2583 |
<dd><p>Modify the patch information to get ready for deep learning, incorporate whole slide labels if needed.</p> |
|
|
2584 |
<dl class="field-list simple"> |
|
|
2585 |
<dt class="field-odd">Parameters</dt> |
|
|
2586 |
<dd class="field-odd"><dl class="simple"> |
|
|
2587 |
<dt><strong>input_info_db:str</strong></dt><dd><p>SQL DB file.</p> |
|
|
2588 |
</dd> |
|
|
2589 |
<dt><strong>slide_labels:dataframe</strong></dt><dd><p>Dataframe with whole slide labels.</p> |
|
|
2590 |
</dd> |
|
|
2591 |
<dt><strong>pos_annotation_class:str</strong></dt><dd><p>Tissue/annotation label to label with whole slide image label, if not supplied, any slide’s patches receive the whole slide label.</p> |
|
|
2592 |
</dd> |
|
|
2593 |
<dt><strong>patch_size:int</strong></dt><dd><p>Patch size.</p> |
|
|
2594 |
</dd> |
|
|
2595 |
<dt><strong>segmentation:bool</strong></dt><dd><p>Segmentation?</p> |
|
|
2596 |
</dd> |
|
|
2597 |
<dt><strong>other_annotations:list</strong></dt><dd><p>Other annotations to access from patch information.</p> |
|
|
2598 |
</dd> |
|
|
2599 |
<dt><strong>target_segmentation_class:int</strong></dt><dd><p>Segmentation class to threshold.</p> |
|
|
2600 |
</dd> |
|
|
2601 |
<dt><strong>target_threshold:float</strong></dt><dd><p>Include patch if patch has target area greater than this.</p> |
|
|
2602 |
</dd> |
|
|
2603 |
<dt><strong>classify_annotations:bool</strong></dt><dd><p>Classifying annotations for pretraining, or final model?</p> |
|
|
2604 |
</dd> |
|
|
2605 |
</dl> |
|
|
2606 |
</dd> |
|
|
2607 |
<dt class="field-even">Returns</dt> |
|
|
2608 |
<dd class="field-even"><dl class="simple"> |
|
|
2609 |
<dt>dataframe</dt><dd><p>Modified patch information.</p> |
|
|
2610 |
</dd> |
|
|
2611 |
</dl> |
|
|
2612 |
</dd> |
|
|
2613 |
</dl> |
|
|
2614 |
</dd></dl> |
|
|
2615 |
|
|
|
2616 |
<dl class="function"> |
|
|
2617 |
<dt id="pathflowai.utils.npy2da"> |
|
|
2618 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">npy2da</code><span class="sig-paren">(</span><em class="sig-param">npy_file</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#npy2da"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.npy2da" title="Permalink to this definition">¶</a></dt> |
|
|
2619 |
<dd><p>Numpy to dask array.</p> |
|
|
2620 |
<dl class="field-list simple"> |
|
|
2621 |
<dt class="field-odd">Parameters</dt> |
|
|
2622 |
<dd class="field-odd"><dl class="simple"> |
|
|
2623 |
<dt><strong>npy_file:str</strong></dt><dd><p>Input npy file.</p> |
|
|
2624 |
</dd> |
|
|
2625 |
</dl> |
|
|
2626 |
</dd> |
|
|
2627 |
<dt class="field-even">Returns</dt> |
|
|
2628 |
<dd class="field-even"><dl class="simple"> |
|
|
2629 |
<dt>dask.array</dt><dd><p>Converted numpy array to dask.</p> |
|
|
2630 |
</dd> |
|
|
2631 |
</dl> |
|
|
2632 |
</dd> |
|
|
2633 |
</dl> |
|
|
2634 |
</dd></dl> |
|
|
2635 |
|
|
|
2636 |
<dl class="function"> |
|
|
2637 |
<dt id="pathflowai.utils.parse_coord_return_boxes"> |
|
|
2638 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">parse_coord_return_boxes</code><span class="sig-paren">(</span><em class="sig-param">xml_file</em>, <em class="sig-param">annotation_name=''</em>, <em class="sig-param">return_coords=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#parse_coord_return_boxes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.parse_coord_return_boxes" title="Permalink to this definition">¶</a></dt> |
|
|
2639 |
<dd><p>Get list of shapely objects for each annotation in the XML object.</p> |
|
|
2640 |
<dl class="field-list simple"> |
|
|
2641 |
<dt class="field-odd">Parameters</dt> |
|
|
2642 |
<dd class="field-odd"><dl class="simple"> |
|
|
2643 |
<dt><strong>xml_file:str</strong></dt><dd><p>Annotation file.</p> |
|
|
2644 |
</dd> |
|
|
2645 |
<dt><strong>annotation_name:str</strong></dt><dd><p>Name of xml annotation.</p> |
|
|
2646 |
</dd> |
|
|
2647 |
<dt><strong>return_coords:bool</strong></dt><dd><p>Just return list of coords over shapes.</p> |
|
|
2648 |
</dd> |
|
|
2649 |
</dl> |
|
|
2650 |
</dd> |
|
|
2651 |
<dt class="field-even">Returns</dt> |
|
|
2652 |
<dd class="field-even"><dl class="simple"> |
|
|
2653 |
<dt>list</dt><dd><p>List of shapely objects.</p> |
|
|
2654 |
</dd> |
|
|
2655 |
</dl> |
|
|
2656 |
</dd> |
|
|
2657 |
</dl> |
|
|
2658 |
</dd></dl> |
|
|
2659 |
|
|
|
2660 |
<dl class="function"> |
|
|
2661 |
<dt id="pathflowai.utils.process_svs"> |
|
|
2662 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">process_svs</code><span class="sig-paren">(</span><em class="sig-param">svs_file</em>, <em class="sig-param">xml_file</em>, <em class="sig-param">annotations=[]</em>, <em class="sig-param">output_dir='./'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#process_svs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.process_svs" title="Permalink to this definition">¶</a></dt> |
|
|
2663 |
<dd><p>Store images into npy format and store annotations into pickle dictionary.</p> |
|
|
2664 |
<dl class="field-list simple"> |
|
|
2665 |
<dt class="field-odd">Parameters</dt> |
|
|
2666 |
<dd class="field-odd"><dl class="simple"> |
|
|
2667 |
<dt><strong>svs_file:str</strong></dt><dd><p>Image file.</p> |
|
|
2668 |
</dd> |
|
|
2669 |
<dt><strong>xml_file:str</strong></dt><dd><p>Annotations file.</p> |
|
|
2670 |
</dd> |
|
|
2671 |
<dt><strong>annotations:list</strong></dt><dd><p>List of annotations in image.</p> |
|
|
2672 |
</dd> |
|
|
2673 |
<dt><strong>output_dir:str</strong></dt><dd><p>Output directory.</p> |
|
|
2674 |
</dd> |
|
|
2675 |
</dl> |
|
|
2676 |
</dd> |
|
|
2677 |
</dl> |
|
|
2678 |
</dd></dl> |
|
|
2679 |
|
|
|
2680 |
<dl class="function"> |
|
|
2681 |
<dt id="pathflowai.utils.retain_images"> |
|
|
2682 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">retain_images</code><span class="sig-paren">(</span><em class="sig-param">image_dir</em>, <em class="sig-param">xml_file</em>, <em class="sig-param">annotation=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#retain_images"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.retain_images" title="Permalink to this definition">¶</a></dt> |
|
|
2683 |
<dd><p>Deprecated</p> |
|
|
2684 |
</dd></dl> |
|
|
2685 |
|
|
|
2686 |
<dl class="function"> |
|
|
2687 |
<dt id="pathflowai.utils.return_image_coord"> |
|
|
2688 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">return_image_coord</code><span class="sig-paren">(</span><em class="sig-param">nx=0</em>, <em class="sig-param">ny=0</em>, <em class="sig-param">xl=3333</em>, <em class="sig-param">yl=3333</em>, <em class="sig-param">xi=0</em>, <em class="sig-param">yi=0</em>, <em class="sig-param">xc=3</em>, <em class="sig-param">yc=3</em>, <em class="sig-param">dimx=224</em>, <em class="sig-param">dimy=224</em>, <em class="sig-param">output_point=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#return_image_coord"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.return_image_coord" title="Permalink to this definition">¶</a></dt> |
|
|
2689 |
<dd><p>Deprecated</p> |
|
|
2690 |
</dd></dl> |
|
|
2691 |
|
|
|
2692 |
<dl class="function"> |
|
|
2693 |
<dt id="pathflowai.utils.return_image_in_boxes_dict"> |
|
|
2694 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">return_image_in_boxes_dict</code><span class="sig-paren">(</span><em class="sig-param">image_dir</em>, <em class="sig-param">xml_file</em>, <em class="sig-param">annotation=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#return_image_in_boxes_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.return_image_in_boxes_dict" title="Permalink to this definition">¶</a></dt> |
|
|
2695 |
<dd><p>Deprecated</p> |
|
|
2696 |
</dd></dl> |
|
|
2697 |
|
|
|
2698 |
<dl class="function"> |
|
|
2699 |
<dt id="pathflowai.utils.run_preprocessing_pipeline"> |
|
|
2700 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">run_preprocessing_pipeline</code><span class="sig-paren">(</span><em class="sig-param">svs_file</em>, <em class="sig-param">xml_file=None</em>, <em class="sig-param">npy_mask=None</em>, <em class="sig-param">annotations=[]</em>, <em class="sig-param">out_zarr='output_zarr.zarr'</em>, <em class="sig-param">out_pkl='output.pkl'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#run_preprocessing_pipeline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.run_preprocessing_pipeline" title="Permalink to this definition">¶</a></dt> |
|
|
2701 |
<dd><p>Run preprocessing pipeline. Store image into zarr format, segmentations maintain as npy, and xml annotations as pickle.</p> |
|
|
2702 |
<dl class="field-list simple"> |
|
|
2703 |
<dt class="field-odd">Parameters</dt> |
|
|
2704 |
<dd class="field-odd"><dl class="simple"> |
|
|
2705 |
<dt><strong>svs_file:str</strong></dt><dd><p>Input image file.</p> |
|
|
2706 |
</dd> |
|
|
2707 |
<dt><strong>xml_file:str</strong></dt><dd><p>Input annotation file.</p> |
|
|
2708 |
</dd> |
|
|
2709 |
<dt><strong>npy_mask:str</strong></dt><dd><p>NPY segmentation mask.</p> |
|
|
2710 |
</dd> |
|
|
2711 |
<dt><strong>annotations:list</strong></dt><dd><p>List of annotations.</p> |
|
|
2712 |
</dd> |
|
|
2713 |
<dt><strong>out_zarr:str</strong></dt><dd><p>Output zarr for image.</p> |
|
|
2714 |
</dd> |
|
|
2715 |
<dt><strong>out_pkl:str</strong></dt><dd><p>Output pickle for annotations.</p> |
|
|
2716 |
</dd> |
|
|
2717 |
</dl> |
|
|
2718 |
</dd> |
|
|
2719 |
</dl> |
|
|
2720 |
</dd></dl> |
|
|
2721 |
|
|
|
2722 |
<dl class="function"> |
|
|
2723 |
<dt id="pathflowai.utils.save_all_patch_info"> |
|
|
2724 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">save_all_patch_info</code><span class="sig-paren">(</span><em class="sig-param">basenames</em>, <em class="sig-param">input_dir='./'</em>, <em class="sig-param">annotations=[]</em>, <em class="sig-param">threshold=0.5</em>, <em class="sig-param">patch_size=224</em>, <em class="sig-param">output_pkl='patch_info.pkl'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#save_all_patch_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.save_all_patch_info" title="Permalink to this definition">¶</a></dt> |
|
|
2725 |
<dd><p>Deprecated.</p> |
|
|
2726 |
</dd></dl> |
|
|
2727 |
|
|
|
2728 |
<dl class="function"> |
|
|
2729 |
<dt id="pathflowai.utils.save_dataset"> |
|
|
2730 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">save_dataset</code><span class="sig-paren">(</span><em class="sig-param">arr</em>, <em class="sig-param">masks</em>, <em class="sig-param">out_zarr</em>, <em class="sig-param">out_pkl</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#save_dataset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.save_dataset" title="Permalink to this definition">¶</a></dt> |
|
|
2731 |
<dd><p>Saves dask array image, dictionary of annotations to zarr and pickle respectively.</p> |
|
|
2732 |
<dl class="field-list simple"> |
|
|
2733 |
<dt class="field-odd">Parameters</dt> |
|
|
2734 |
<dd class="field-odd"><dl class="simple"> |
|
|
2735 |
<dt><strong>arr:array</strong></dt><dd><p>Image.</p> |
|
|
2736 |
</dd> |
|
|
2737 |
<dt><strong>masks:dict</strong></dt><dd><p>Dictionary of annotation shapes.</p> |
|
|
2738 |
</dd> |
|
|
2739 |
<dt><strong>out_zarr:str</strong></dt><dd><p>Zarr output file for image.</p> |
|
|
2740 |
</dd> |
|
|
2741 |
<dt><strong>out_pkl:str</strong></dt><dd><p>Pickle output file.</p> |
|
|
2742 |
</dd> |
|
|
2743 |
</dl> |
|
|
2744 |
</dd> |
|
|
2745 |
</dl> |
|
|
2746 |
</dd></dl> |
|
|
2747 |
|
|
|
2748 |
<dl class="function"> |
|
|
2749 |
<dt id="pathflowai.utils.segmentation_predictions2npy"> |
|
|
2750 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">segmentation_predictions2npy</code><span class="sig-paren">(</span><em class="sig-param">y_pred</em>, <em class="sig-param">patch_info</em>, <em class="sig-param">segmentation_map</em>, <em class="sig-param">npy_output</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#segmentation_predictions2npy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.segmentation_predictions2npy" title="Permalink to this definition">¶</a></dt> |
|
|
2751 |
<dd><p>Convert segmentation predictions from model to numpy masks.</p> |
|
|
2752 |
<dl class="field-list simple"> |
|
|
2753 |
<dt class="field-odd">Parameters</dt> |
|
|
2754 |
<dd class="field-odd"><dl class="simple"> |
|
|
2755 |
<dt><strong>y_pred:list</strong></dt><dd><p>List of patch segmentation masks</p> |
|
|
2756 |
</dd> |
|
|
2757 |
<dt><strong>patch_info:dataframe</strong></dt><dd><p>Patch information from DB.</p> |
|
|
2758 |
</dd> |
|
|
2759 |
<dt><strong>segmentation_map:array</strong></dt><dd><p>Existing segmentation mask.</p> |
|
|
2760 |
</dd> |
|
|
2761 |
<dt><strong>npy_output:str</strong></dt><dd><p>Output npy file.</p> |
|
|
2762 |
</dd> |
|
|
2763 |
</dl> |
|
|
2764 |
</dd> |
|
|
2765 |
</dl> |
|
|
2766 |
</dd></dl> |
|
|
2767 |
|
|
|
2768 |
<dl class="function"> |
|
|
2769 |
<dt id="pathflowai.utils.svs2dask_array"> |
|
|
2770 |
<code class="sig-prename descclassname">pathflowai.utils.</code><code class="sig-name descname">svs2dask_array</code><span class="sig-paren">(</span><em class="sig-param">svs_file</em>, <em class="sig-param">tile_size=1000</em>, <em class="sig-param">overlap=0</em>, <em class="sig-param">remove_last=True</em>, <em class="sig-param">allow_unknown_chunksizes=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pathflowai/utils.html#svs2dask_array"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pathflowai.utils.svs2dask_array" title="Permalink to this definition">¶</a></dt> |
|
|
2771 |
<dd><p>Convert SVS, TIF or TIFF to dask array.</p> |
|
|
2772 |
<dl class="field-list"> |
|
|
2773 |
<dt class="field-odd">Parameters</dt> |
|
|
2774 |
<dd class="field-odd"><dl class="simple"> |
|
|
2775 |
<dt><strong>svs_file:str</strong></dt><dd><p>Image file.</p> |
|
|
2776 |
</dd> |
|
|
2777 |
<dt><strong>tile_size:int</strong></dt><dd><p>Size of chunk to be read in.</p> |
|
|
2778 |
</dd> |
|
|
2779 |
<dt><strong>overlap:int</strong></dt><dd><p>Do not modify, overlap between neighboring tiles.</p> |
|
|
2780 |
</dd> |
|
|
2781 |
<dt><strong>remove_last:bool</strong></dt><dd><p>Remove last tile because it has a custom size.</p> |
|
|
2782 |
</dd> |
|
|
2783 |
<dt><strong>allow_unknown_chunksizes: bool</strong></dt><dd><p>Allow different chunk sizes, more flexible, but slowdown.</p> |
|
|
2784 |
</dd> |
|
|
2785 |
</dl> |
|
|
2786 |
</dd> |
|
|
2787 |
<dt class="field-even">Returns</dt> |
|
|
2788 |
<dd class="field-even"><dl class="simple"> |
|
|
2789 |
<dt>dask.array</dt><dd><p>Dask Array.</p> |
|
|
2790 |
</dd> |
|
|
2791 |
</dl> |
|
|
2792 |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">arr</span><span class="o">=</span><span class="n">svs2dask_array</span><span class="p">(</span><span class="n">svs_file</span><span class="p">,</span> <span class="n">tile_size</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">overlap</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">remove_last</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">allow_unknown_chunksizes</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> |
|
|
2793 |
<span class="go"> ..</span> |
|
|
2794 |
</pre></div> |
|
|
2795 |
</div> |
|
|
2796 |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">arr2</span><span class="o">=</span><span class="n">arr</span><span class="o">.</span><span class="n">compute</span><span class="p">()</span> |
|
|
2797 |
<span class="go"> ..</span> |
|
|
2798 |
</pre></div> |
|
|
2799 |
</div> |
|
|
2800 |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">arr3</span><span class="o">=</span><span class="n">to_pil</span><span class="p">(</span><span class="n">cv2</span><span class="o">.</span><span class="n">resize</span><span class="p">(</span><span class="n">arr2</span><span class="p">,</span> <span class="n">dsize</span><span class="o">=</span><span class="p">(</span><span class="mi">1440</span><span class="p">,</span><span class="mi">700</span><span class="p">),</span> <span class="n">interpolation</span><span class="o">=</span><span class="n">cv2</span><span class="o">.</span><span class="n">INTER_CUBIC</span><span class="p">))</span> |
|
|
2801 |
<span class="go"> ..</span> |
|
|
2802 |
</pre></div> |
|
|
2803 |
</div> |
|
|
2804 |
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">arr3</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">test_image_name</span><span class="p">)</span> |
|
|
2805 |
<span class="go"> ..</span> |
|
|
2806 |
</pre></div> |
|
|
2807 |
</div> |
|
|
2808 |
</dd> |
|
|
2809 |
</dl> |
|
|
2810 |
</dd></dl> |
|
|
2811 |
|
|
|
2812 |
</div> |
|
|
2813 |
</div> |
|
|
2814 |
<div class="section" id="indices-and-tables"> |
|
|
2815 |
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1> |
|
|
2816 |
<ul class="simple"> |
|
|
2817 |
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li> |
|
|
2818 |
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li> |
|
|
2819 |
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li> |
|
|
2820 |
</ul> |
|
|
2821 |
</div> |
|
|
2822 |
|
|
|
2823 |
|
|
|
2824 |
</div> |
|
|
2825 |
|
|
|
2826 |
</div> |
|
|
2827 |
<footer> |
|
|
2828 |
|
|
|
2829 |
|
|
|
2830 |
<hr/> |
|
|
2831 |
|
|
|
2832 |
<div role="contentinfo"> |
|
|
2833 |
<p> |
|
|
2834 |
© Copyright 2019, Joshua Levy |
|
|
2835 |
|
|
|
2836 |
</p> |
|
|
2837 |
</div> |
|
|
2838 |
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. |
|
|
2839 |
|
|
|
2840 |
</footer> |
|
|
2841 |
|
|
|
2842 |
</div> |
|
|
2843 |
</div> |
|
|
2844 |
|
|
|
2845 |
</section> |
|
|
2846 |
|
|
|
2847 |
</div> |
|
|
2848 |
|
|
|
2849 |
|
|
|
2850 |
|
|
|
2851 |
<script type="text/javascript"> |
|
|
2852 |
jQuery(function () { |
|
|
2853 |
SphinxRtdTheme.Navigation.enable(true); |
|
|
2854 |
}); |
|
|
2855 |
</script> |
|
|
2856 |
|
|
|
2857 |
|
|
|
2858 |
|
|
|
2859 |
|
|
|
2860 |
|
|
|
2861 |
|
|
|
2862 |
</body> |
|
|
2863 |
</html> |