-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboundary.html
516 lines (514 loc) · 39.4 KB
/
boundary.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>The library infrastructure » Boundary module | DIPlib | a library for quantitative image analysis</title>
<link rel="stylesheet" href="m-dip+documentation.compiled.css" />
<link rel="icon" href="DIPlib_logo_32.png" type="image/png" />
<link rel="search" type="application/opensearchdescription+xml" href="opensearch.xml" title="Search DIPlib documentation" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#ffffff" />
</head>
<body>
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
<a href="https://diplib.org"><img src="DIPlib_logo.svg" alt="" />DIPlib</a><span class="m-breadcrumb">┃</span><a href="index.html" class="m-thin">a library for quantitative image analysis</a><span class="m-breadcrumb">┃</span><a href="https://github.com/DIPlib/diplib/releases/tag/3.5.2" class="m-thin">version 3.5.2</a> </span>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
</svg></a>
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
</div>
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li><a href="pages.html">Pages</a></li>
<li><a href="modules.html">Modules</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="3">
<li><a href="classes.html">Classes</a></li>
<li><a href="files.html">Files</a></li>
<li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<use href="#m-doc-search-icon-path" />
</svg></a></li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
<span class="m-breadcrumb"><a href="infrastructure.html">The library infrastructure</a> »</span>
Boundary <span class="m-thin">module</span> <div class="m-doc-include m-code m-thin m-text-right">#include <a href="file--diplib--boundary-h.html">"diplib/boundary.h"</a></div>
</h1>
<p>Handling image boundary extension for filtering</p>
<div class="m-block m-default">
<h3>Contents</h3>
<ul>
<li>
Reference
<ul>
<li><a href="#alias-members">Aliases</a></li>
<li><a href="#enum-members">Enums</a></li>
<li><a href="#function-members">Functions</a></li>
</ul>
</li>
</ul>
</div>
<section id="alias-members">
<h2>Aliases</h2>
<dl class="m-doc">
<dt id="dip-Option-ExtendImageFlags">
using <a href="#dip-Option-ExtendImageFlags" class="m-doc-self">dip::<wbr />Option::<wbr />ExtendImageFlags</a> = dip::detail::Options
</dt>
<dd>Combines any number of <a href="boundary.html#dip-Option-ExtendImage"><code>dip::Option::ExtendImage</code></a> constants together.</dd>
<dt id="dip-BoundaryConditionArray">
using <a href="#dip-BoundaryConditionArray" class="m-doc-self">dip::<wbr />BoundaryConditionArray</a> = <a href="dip-DimensionArray-T.html" class="m-doc">dip::DimensionArray</a>
</dt>
<dd>An array to hold boundary conditions.</dd>
</dl>
</section>
<section id="enum-members">
<h2>Enums</h2>
<dl class="m-doc">
<dt>
<span class="m-doc-wrap-bumper">enum class <a href="#dip-BoundaryCondition" class="m-doc">dip::<wbr />BoundaryCondition</a>: uint8{ </span><span class="m-doc-wrap"><a href="#dip-BoundaryCondition-SYMMETRIC_MIRROR" class="m-doc">SYMMETRIC_MIRROR</a>,
<a href="#dip-BoundaryCondition-DEFAULT" class="m-doc">DEFAULT</a>,
<a href="#dip-BoundaryCondition-ASYMMETRIC_MIRROR" class="m-doc">ASYMMETRIC_MIRROR</a>,
<a href="#dip-BoundaryCondition-PERIODIC" class="m-doc">PERIODIC</a>,
<a href="#dip-BoundaryCondition-ASYMMETRIC_PERIODIC" class="m-doc">ASYMMETRIC_PERIODIC</a>,
<a href="#dip-BoundaryCondition-ADD_ZEROS" class="m-doc">ADD_ZEROS</a>,
<a href="#dip-BoundaryCondition-ADD_MAX_VALUE" class="m-doc">ADD_MAX_VALUE</a>,
<a href="#dip-BoundaryCondition-ADD_MIN_VALUE" class="m-doc">ADD_MIN_VALUE</a>,
<a href="#dip-BoundaryCondition-ZERO_ORDER_EXTRAPOLATE" class="m-doc">ZERO_ORDER_EXTRAPOLATE</a>,
<a href="#dip-BoundaryCondition-FIRST_ORDER_EXTRAPOLATE" class="m-doc">FIRST_ORDER_EXTRAPOLATE</a>,
<a href="#dip-BoundaryCondition-SECOND_ORDER_EXTRAPOLATE" class="m-doc">SECOND_ORDER_EXTRAPOLATE</a>,
<a href="#dip-BoundaryCondition-THIRD_ORDER_EXTRAPOLATE" class="m-doc">THIRD_ORDER_EXTRAPOLATE</a>,
<a href="#dip-BoundaryCondition-ALREADY_EXPANDED" class="m-doc">ALREADY_EXPANDED</a> }</span>
</dt>
<dd>Enumerates various ways of extending image data beyond its boundary. <a href="#dip-BoundaryCondition">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">enum class <a href="#dip-Option-ExtendImage" class="m-doc">dip::<wbr />Option::<wbr />ExtendImage</a>: uint8{ </span><span class="m-doc-wrap"><a href="#dip-Option-ExtendImage-Masked" class="m-doc">Masked</a>,
<a href="#dip-Option-ExtendImage-ExpandTensor" class="m-doc">ExpandTensor</a> }</span>
</dt>
<dd>Defines options to the <a href="boundary.html#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-"><code>dip::ExtendImage</code></a> function. <a href="#dip-Option-ExtendImage">more...</a></dd>
</dl>
</section>
<section id="function-members">
<h2>Functions</h2>
<dl class="m-doc">
<dt id="dip-StringToBoundaryCondition-String-CL">
<span class="m-doc-wrap-bumper">auto <a href="#dip-StringToBoundaryCondition-String-CL" class="m-doc-self">dip::<wbr />StringToBoundaryCondition</a>(</span><span class="m-doc-wrap"><a href="supporttypes.html#dip-String" class="m-doc">dip::String</a> const& bc) -> <a href="boundary.html#dip-BoundaryCondition" class="m-doc">dip::BoundaryCondition</a></span>
</dt>
<dd>Convert a string to a boundary condition.</dd>
<dt id="dip-StringArrayToBoundaryConditionArray-StringArray-CL">
<span class="m-doc-wrap-bumper">auto <a href="#dip-StringArrayToBoundaryConditionArray-StringArray-CL" class="m-doc-self">dip::<wbr />StringArrayToBoundaryConditionArray</a>(</span><span class="m-doc-wrap"><a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& bc) -> <a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a></span>
</dt>
<dd>Convert an array of strings to an array of boundary conditions.</dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-BoundaryArrayUseParameter-BoundaryConditionArray-L-dip-uint-" class="m-doc">dip::<wbr />BoundaryArrayUseParameter</a>(</span><span class="m-doc-wrap"><a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a>& bc,
<a href="supporttypes.html#dip-uint" class="m-doc">dip::uint</a> nDims)</span>
</dt>
<dd>Check the length of a <code>BoundaryConditionArray</code>, and extend it if necessary and possible. <a href="#dip-BoundaryArrayUseParameter-BoundaryConditionArray-L-dip-uint-">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">auto <a href="#dip-ReadPixelWithBoundaryCondition-Image-CL-IntegerArray--BoundaryConditionArray-CL" class="m-doc">dip::<wbr />ReadPixelWithBoundaryCondition</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& img,
<a href="supporttypes.html#dip-IntegerArray" class="m-doc">dip::IntegerArray</a> coords,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> const& bc) -> <a href="dip-Image-Pixel.html" class="m-doc">dip::Image::Pixel</a></span>
</dt>
<dd>Returns a pixel with a copy of the sample values at <code>coords</code>. <a href="#dip-ReadPixelWithBoundaryCondition-Image-CL-IntegerArray--BoundaryConditionArray-CL">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-" class="m-doc">dip::<wbr />ExtendImage</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> borderSizes,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {},
<a href="boundary.html#dip-Option-ExtendImageFlags" class="m-doc">dip::Option::ExtendImageFlags</a> options = {})</span>
</dt>
<dd>Extends the image <code>in</code> by <code>borderSizes</code> along each dimension. <a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--StringArray-CL-StringSet-CL" class="m-doc">dip::<wbr />ExtendImage</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> borderSizes,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions,
<a href="supporttypes.html#dip-StringSet" class="m-doc">dip::StringSet</a> const& options = {})</span>
</dt>
<dd>Extends the image <code>in</code> by <code>borderSizes</code> along each dimension. <a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--StringArray-CL-StringSet-CL">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-Option-CropLocation--BoundaryConditionArray--Option-ExtendImageFlags-" class="m-doc">dip::<wbr />ExtendImageToSize</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> const& sizes,
<a href="supporttypes.html#dip-Option-CropLocation" class="m-doc">dip::Option::CropLocation</a> cropLocation = Option::CropLocation::CENTER,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {},
<a href="boundary.html#dip-Option-ExtendImageFlags" class="m-doc">dip::Option::ExtendImageFlags</a> options = {})</span>
</dt>
<dd>Extends the image <code>in</code> to <code>sizes</code>. <a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-Option-CropLocation--BoundaryConditionArray--Option-ExtendImageFlags-">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-String-CL-StringArray-CL-StringSet-CL" class="m-doc">dip::<wbr />ExtendImageToSize</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> const& sizes,
<a href="supporttypes.html#dip-String" class="m-doc">dip::String</a> const& cropLocation,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions = {},
<a href="supporttypes.html#dip-StringSet" class="m-doc">dip::StringSet</a> const& options = {})</span>
</dt>
<dd>Extends the image <code>in</code> to <code>sizes</code>. <a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-String-CL-StringArray-CL-StringSet-CL">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendRegion-Image-L-RangeArray--BoundaryConditionArray-" class="m-doc">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="dip-Range.html#dip-RangeArray" class="m-doc">dip::RangeArray</a> ranges,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {})</span>
</dt>
<dd>Fills the pixels outside a region in the image using a boundary condition. <a href="#dip-ExtendRegion-Image-L-RangeArray--BoundaryConditionArray-">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendRegion-Image-L-RangeArray-CL-StringArray-CL" class="m-doc">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="dip-Range.html#dip-RangeArray" class="m-doc">dip::RangeArray</a> const& ranges,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions)</span>
</dt>
<dd>Fills the pixels outside a region in the image using a boundary condition. <a href="#dip-ExtendRegion-Image-L-RangeArray-CL-StringArray-CL">more...</a></dd>
<dt>
<span class="m-doc-wrap-bumper">void <a href="#dip-ExtendRegion-Image-L-UnsignedArray--UnsignedArray--StringArray-CL" class="m-doc">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> origin,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> sizes,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions)</span>
</dt>
<dd>Fills the pixels outside a region in the image using a boundary condition. <a href="#dip-ExtendRegion-Image-L-UnsignedArray--UnsignedArray--StringArray-CL">more...</a></dd>
</dl>
</section>
<section>
<h2>Enum documentation</h2>
<section class="m-doc-details" id="dip-BoundaryCondition"><div>
<h3>
enum class <a href="#dip-BoundaryCondition" class="m-doc-self">dip::<wbr />BoundaryCondition</a>: uint8
</h3>
<p>Enumerates various ways of extending image data beyond its boundary.</p>
<p>This enumerator is used by the framework functions and some internal functions.
Externally, the boundary condition is represented by strings.</p>
<p>Most functions will take a string instead of a <code>dip::BoundaryCondition</code> constant.
The following table links boundary condition constants and their string representations.</p>
<table class="m-table">
<thead>
<tr>
<th><code>BoundaryCondition</code> constant</th>
<th>String</th>
<th>Definition</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>SYMMETRIC_MIRROR</code></td>
<td>“mirror”</td>
<td>The data are mirrored, with the value at -1 equal to the value at 0, at -2 equal to at 1, etc.</td>
</tr>
<tr>
<td><code>ASYMMETRIC_MIRROR</code></td>
<td>“asym mirror”</td>
<td>The data are mirrored and inverted.</td>
</tr>
<tr>
<td><code>PERIODIC</code></td>
<td>“periodic”</td>
<td>The data are repeated periodically, with the value at -1 equal to the value of the last pixel.</td>
</tr>
<tr>
<td><code>ASYMMETRIC_PERIODIC</code></td>
<td>“asym periodic”</td>
<td>The data are repeated periodically and inverted.</td>
</tr>
<tr>
<td><code>ADD_ZEROS</code></td>
<td>“add zeros”</td>
<td>The boundary is filled with zeros.</td>
</tr>
<tr>
<td><code>ADD_MAX_VALUE</code></td>
<td>“add max”</td>
<td>The boundary is filled with the max value for the data type.</td>
</tr>
<tr>
<td><code>ADD_MIN_VALUE</code></td>
<td>“add min”</td>
<td>The boundary is filled with the min value for the data type.</td>
</tr>
<tr>
<td><code>ZERO_ORDER_EXTRAPOLATE</code></td>
<td>“zero order”</td>
<td>The value at the border is repeated indefinitely.</td>
</tr>
<tr>
<td><code>FIRST_ORDER_EXTRAPOLATE</code></td>
<td>“first order”</td>
<td>A linear function is defined based on the value closest to the border, the function reaches zero at the end of the extended boundary.</td>
</tr>
<tr>
<td><code>SECOND_ORDER_EXTRAPOLATE</code></td>
<td>“second order”</td>
<td>A quadratic function is defined based on the two values closest to the border, the function reaches zero at the end of the extended boundary.</td>
</tr>
<tr>
<td><code>THIRD_ORDER_EXTRAPOLATE</code></td>
<td>“third order”</td>
<td>A cubic function is defined based on the two values closest to the border, the function reaches zero with a zero derivative at the end of the extended boundary.</td>
</tr>
<tr>
<td><code>DEFAULT</code></td>
<td>“default” or “”</td>
<td>The default value, currently equal to <code>SYMMETRIC_MIRROR</code>.</td>
</tr>
<tr>
<td><code>ALREADY_EXPANDED</code></td>
<td>“already expanded”</td>
<td>The dangerous option. The image is an ROI of a larger image, the filter should read existing data outside of the image. The user must be sure that there exists sufficient data to satisfy the filter, for this she must understand how far the filter will read data outside of the image bounds. Not supported by all functions, and cannot always be combined with other options.</td>
</tr>
</tbody>
</table>
</div></section>
<section class="m-doc-details" id="dip-Option-ExtendImage"><div>
<h3>
enum class <a href="#dip-Option-ExtendImage" class="m-doc-self">dip::<wbr />Option::<wbr />ExtendImage</a>: uint8
</h3>
<p>Defines options to the <a href="boundary.html#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-"><code>dip::ExtendImage</code></a> function.</p>
<p>Implicitly casts to <a href="boundary.html#dip-Option-ExtendImageFlags"><code>dip::Option::ExtendImageFlags</code></a>. Combine constants together with the <code>+</code> operator.</p>
<table class="m-table m-fullwidth m-first-tight m-flat m-doc">
<thead><tr><th>Enumerators</th><th></th></tr></thead>
<tbody>
<tr>
<td><a href="#dip-Option-ExtendImage-Masked" class="m-doc-self" id="dip-Option-ExtendImage-Masked">Masked</a> = 0</td>
<td>
The output image is a window on the boundary-extended image of the same size as the input.
</td>
</tr>
<tr>
<td><a href="#dip-Option-ExtendImage-ExpandTensor" class="m-doc-self" id="dip-Option-ExtendImage-ExpandTensor">ExpandTensor</a> = 1</td>
<td>
The output image has normal tensor storage.
</td>
</tr>
</tbody>
</table>
</div></section>
</section>
<section>
<h2>Function documentation</h2>
<section class="m-doc-details" id="dip-BoundaryArrayUseParameter-BoundaryConditionArray-L-dip-uint-"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-BoundaryArrayUseParameter-BoundaryConditionArray-L-dip-uint-" class="m-doc-self">dip::<wbr />BoundaryArrayUseParameter</a>(</span><span class="m-doc-wrap"><a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a>& bc,
<a href="supporttypes.html#dip-uint" class="m-doc">dip::uint</a> nDims)</span></span>
</h3>
<p>Check the length of a <code>BoundaryConditionArray</code>, and extend it if necessary and possible.</p>
<p>The output will
have <code>nDims</code> elements. If the input has a single value, it will be used for all dimensions. If the
input is an empty array, the default boundary condition will be used for all dimensions. If the array
has <code>nDims</code> elements, it is copied unchanged. For any other length, an exception is thrown.</p>
<aside class="m-note m-default">
<h4>See also</h4>
<p><a href="supporttypes.html#dip-ArrayUseParameter-T-DimensionArray<T>-L-dip-uint--T-"><code>dip::ArrayUseParameter</code></a></p>
</aside>
</div></section>
<section class="m-doc-details" id="dip-ReadPixelWithBoundaryCondition-Image-CL-IntegerArray--BoundaryConditionArray-CL"><div>
<h3>
<span class="m-doc-wrap-bumper"><a href="dip-Image-Pixel.html" class="m-doc">dip::Image::Pixel</a>
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ReadPixelWithBoundaryCondition-Image-CL-IntegerArray--BoundaryConditionArray-CL" class="m-doc-self">dip::<wbr />ReadPixelWithBoundaryCondition</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& img,
<a href="supporttypes.html#dip-IntegerArray" class="m-doc">dip::IntegerArray</a> coords,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> const& bc)</span></span>
</h3>
<p>Returns a pixel with a copy of the sample values at <code>coords</code>.</p>
<p>If <code>coords</code> falls outside the image, then the boundary condition <code>bc</code> is used to determine what values to write
into the output pixel.</p>
<p>First, second and third order interpolations are not implemented, because their functionality
is impossible to reproduce in this simple function. Use <a href="boundary.html#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-"><code>dip::ExtendImage</code></a> to get the functionality
of these boundary conditions.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--BoundaryConditionArray--Option-ExtendImageFlags-" class="m-doc-self">dip::<wbr />ExtendImage</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> borderSizes,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {},
<a href="boundary.html#dip-Option-ExtendImageFlags" class="m-doc">dip::Option::ExtendImageFlags</a> options = {})</span></span>
</h3>
<p>Extends the image <code>in</code> by <code>borderSizes</code> along each dimension.</p>
<p>This function is identical to the <code>dip::ExtendImage</code> below, except it uses boundary condition constants and option
constants instead of strings. This version is meant to be used by low-level library functions.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendImage-Image-CL-Image-L-UnsignedArray--StringArray-CL-StringSet-CL"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendImage-Image-CL-Image-L-UnsignedArray--StringArray-CL-StringSet-CL" class="m-doc-self">dip::<wbr />ExtendImage</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> borderSizes,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions,
<a href="supporttypes.html#dip-StringSet" class="m-doc">dip::StringSet</a> const& options = {})</span></span>
</h3>
<p>Extends the image <code>in</code> by <code>borderSizes</code> along each dimension.</p>
<p>The output image has size <code>in.Size( ii ) + 2 * borderSizes[ ii ]</code> along dimension <code>ii</code>.</p>
<p>The new regions are filled using the boundary condition <code>bc</code>. If <code>boundaryConditions</code> is an empty array, the default
boundary condition is used along all dimensions. If <code>boundaryConditions</code> has a single element, it is used for all
dimensions. Similarly, if <code>borderSizes</code> has a single element, it is used for all dimensions.</p>
<p>If <code>options</code> contains <code>"masked"</code>, the output image is a window on the boundary-extended image, of the
same size as <code>in</code>. That is, <code>out</code> will be identical to <code>in</code> except that it is possible
to access pixels outside of its domain.</p>
<p>If <code>options</code> contains <code>"expand tensor"</code>, the output image will have normal tensor storage
(<a href="dip-Tensor.html#dip-Tensor-HasNormalOrder-C"><code>dip::Tensor::HasNormalOrder</code></a> is true). This affects only those input images that have a transposed, symmetric
or triangular matrix as tensor shape.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-Option-CropLocation--BoundaryConditionArray--Option-ExtendImageFlags-"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-Option-CropLocation--BoundaryConditionArray--Option-ExtendImageFlags-" class="m-doc-self">dip::<wbr />ExtendImageToSize</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> const& sizes,
<a href="supporttypes.html#dip-Option-CropLocation" class="m-doc">dip::Option::CropLocation</a> cropLocation = Option::CropLocation::CENTER,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {},
<a href="boundary.html#dip-Option-ExtendImageFlags" class="m-doc">dip::Option::ExtendImageFlags</a> options = {})</span></span>
</h3>
<p>Extends the image <code>in</code> to <code>sizes</code>.</p>
<p>This function is identical to the <code>dip::ExtendImageToSize</code> below, except it uses boundary condition constants and option
constants instead of strings. This version is meant to be used by low-level library functions.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-String-CL-StringArray-CL-StringSet-CL"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendImageToSize-Image-CL-Image-L-UnsignedArray-CL-String-CL-StringArray-CL-StringSet-CL" class="m-doc-self">dip::<wbr />ExtendImageToSize</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a> const& in,
<a href="dip-Image.html" class="m-doc">dip::Image</a>& out,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> const& sizes,
<a href="supporttypes.html#dip-String" class="m-doc">dip::String</a> const& cropLocation,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions = {},
<a href="supporttypes.html#dip-StringSet" class="m-doc">dip::StringSet</a> const& options = {})</span></span>
</h3>
<p>Extends the image <code>in</code> to <code>sizes</code>.</p>
<p>The output image has size <code>sizes( ii )</code> along dimension <code>ii</code>. <code>sizes</code> must have <code>in.Dimensionality()</code> elements.</p>
<p>The string <code>cropLocation</code> determines where in the output image <code>in</code> is placed. Its values translate to
one of the <a href="supporttypes.html#dip-Option-CropLocation"><code>dip::Option::CropLocation</code></a> values as follows:</p>
<table class="m-table">
<thead>
<tr>
<th><code>CropLocation</code> constant</th>
<th>String</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="supporttypes.html#dip-Option-CropLocation-CENTER"><code>dip::Option::CropLocation::CENTER</code></a></td>
<td><code>"center"</code></td>
</tr>
<tr>
<td><a href="supporttypes.html#dip-Option-CropLocation-MIRROR_CENTER"><code>dip::Option::CropLocation::MIRROR_CENTER</code></a></td>
<td><code>"mirror center"</code></td>
</tr>
<tr>
<td><a href="supporttypes.html#dip-Option-CropLocation-TOP_LEFT"><code>dip::Option::CropLocation::TOP_LEFT</code></a></td>
<td><code>"top left"</code></td>
</tr>
<tr>
<td><a href="supporttypes.html#dip-Option-CropLocation-BOTTOM_RIGHT"><code>dip::Option::CropLocation::BOTTOM_RIGHT</code></a></td>
<td><code>"bottom right"</code></td>
</tr>
</tbody>
</table>
<p>The new regions are filled using the boundary condition <code>bc</code>. If <code>boundaryConditions</code> is an empty array, the default
boundary condition is used along all dimensions. If <code>boundaryConditions</code> has a single element, it is used for all
dimensions. Similarly, if <code>borderSizes</code> has a single element, it is used for all dimensions.</p>
<p>If <code>options</code> contains <code>"masked"</code>, the output image is a window on the boundary-extended image, of the
same size as <code>in</code>. That is, <code>out</code> will be identical to <code>in</code> except that it is possible
to access pixels outside of its domain.</p>
<p>If <code>options</code> contains <code>"expand tensor"</code>, the output image will have normal tensor storage
(<a href="dip-Tensor.html#dip-Tensor-HasNormalOrder-C"><code>dip::Tensor::HasNormalOrder</code></a> is true). This affects only those input images that have a transposed, symmetric
or triangular matrix as tensor shape.</p>
<p>This function is similar to <a href="dip-Image.html#dip-Image-Pad-UnsignedArray-CL-Pixel-CL-Option-CropLocation--C"><code>dip::Image::Pad</code></a>, which fills the new regions with a constant value.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendRegion-Image-L-RangeArray--BoundaryConditionArray-"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendRegion-Image-L-RangeArray--BoundaryConditionArray-" class="m-doc-self">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="dip-Range.html#dip-RangeArray" class="m-doc">dip::RangeArray</a> ranges,
<a href="boundary.html#dip-BoundaryConditionArray" class="m-doc">dip::BoundaryConditionArray</a> boundaryConditions = {})</span></span>
</h3>
<p>Fills the pixels outside a region in the image using a boundary condition.</p>
<p>This function is identical to the <code>dip::ExtendRegion</code> below, except it uses boundary condition constants
instead of strings. This version is meant to be used by low-level library functions.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendRegion-Image-L-RangeArray-CL-StringArray-CL"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendRegion-Image-L-RangeArray-CL-StringArray-CL" class="m-doc-self">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="dip-Range.html#dip-RangeArray" class="m-doc">dip::RangeArray</a> const& ranges,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions)</span></span>
</h3>
<p>Fills the pixels outside a region in the image using a boundary condition.</p>
<p>The region that is preserved is specified through <code>ranges</code>. The step sizes are ignored, only the <code>start</code> and <code>stop</code>
values of <code>ranges</code> are used.</p>
<p>The pixels outside of the region are filled using the boundary condition <code>boundaryConditions</code>, using only those
values inside the region. If <code>boundaryConditions</code> is an empty array, the default boundary condition is used along
all dimensions. If <code>boundaryConditions</code> has a single element, it is used for all dimensions. <code>ranges</code> is
similarly expanded if it has a single element.</p>
</div></section>
<section class="m-doc-details" id="dip-ExtendRegion-Image-L-UnsignedArray--UnsignedArray--StringArray-CL"><div>
<h3>
<span class="m-doc-wrap-bumper">void
</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#dip-ExtendRegion-Image-L-UnsignedArray--UnsignedArray--StringArray-CL" class="m-doc-self">dip::<wbr />ExtendRegion</a>(</span><span class="m-doc-wrap"><a href="dip-Image.html" class="m-doc">dip::Image</a>& image,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> origin,
<a href="supporttypes.html#dip-UnsignedArray" class="m-doc">dip::UnsignedArray</a> sizes,
<a href="supporttypes.html#dip-StringArray" class="m-doc">dip::StringArray</a> const& boundaryConditions)</span></span>
</h3>
<p>Fills the pixels outside a region in the image using a boundary condition.</p>
<p>The region that is preserved is specified through <code>origin</code> and <code>sizes</code>.</p>
<p>The pixels outside of the region are filled using the boundary condition <code>boundaryConditions</code>, using only those
values inside the region. If <code>boundaryConditions</code> is an empty array, the default boundary condition is used along
all dimensions. If <code>boundaryConditions</code> has a single element, it is used for all dimensions. <code>origin</code> and <code>sizes</code>
are similarly expanded if they have a single element.</p>
</div></section>
</section>
</div>
</div>
</div>
</article></main>
<div class="m-doc-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-doc-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount">…</div>
</div>
<div class="m-doc-search-content">
<form action="https://diplib.org/diplib-docs/#search">
<input type="search" name="q" id="search-input" placeholder="Loading …" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
</form>
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript. Enable it or <a href="https://google.com/search?q=site:diplib.org+">use an external search engine</a>.</noscript>
<div id="search-help" class="m-text m-dim m-text-center">
<p class="m-noindent">Search for symbols, directories, files, pages or modules.
You can omit any prefix from the symbol or file path; adding a <code>:</code> or
<code>/</code> suffix lists all members of given symbol or directory.</p>
<p class="m-noindent">Use <span class="m-label m-dim">↓</span> / <span class="m-label m-dim">↑</span> to navigate through the list,
<span class="m-label m-dim">Enter</span> to go.
<span class="m-label m-dim">Tab</span> autocompletes common prefix.
You can copy a link to the result using <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">L</span>,
or <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">M</span> to copy a Markdown link.</p>
</div>
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.<br />Maybe try a full-text <a href="#" id="search-external" data-search-engine="https://google.com/search?q=site:diplib.org+{query}">search with external engine</a>?</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search-v1.js"></script>
<script src="searchdata-v1.js" async="async"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<p>DIPlib, a library for quantitative image analysis. Documentation compiled with <a href="https://crisluengo.github.io/doxpp/">dox++</a> and styled with <a href="https://mcss.mosra.cz/">m.css</a>.</p>
</div>
</div>
</div>
</nav></footer>
</body>
</html>