Skip to content

Commit 38da3f8

Browse files
committed
fillholes doc example
Signed-off-by: Daniel Greenstein <[email protected]>
1 parent a1e7ee7 commit 38da3f8

File tree

8 files changed

+54
-13
lines changed

8 files changed

+54
-13
lines changed

src/doc/imagebufalgo.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,21 +2569,26 @@ Image Enhancement / Restoration
25692569

25702570
Examples:
25712571

2572-
.. tabs::
2573-
2574-
.. code-tab:: c++
2572+
.. tabs::
25752573

2576-
ImageBuf Src ("holes.exr");
2577-
ImageBuf Filled = ImageBufAlgo::fillholes_pushpull (Src);
2574+
.. tab:: C++
2575+
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
2576+
:language: c++
2577+
:start-after: BEGIN-imagebufalgo-fillholes_pushpull
2578+
:end-before: END-imagebufalgo-fillholes_pushpull
2579+
:dedent: 4
25782580

2579-
.. code-tab:: py
2581+
.. tab:: Python
2582+
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
2583+
:language: py
2584+
:start-after: BEGIN-imagebufalgo-fillholes_pushpull
2585+
:end-before: END-imagebufalgo-fillholes_pushpull
2586+
:dedent: 4
25802587

2581-
Src = ImageBuf("holes.exr")
2582-
Filled = ImageBufAlgo.fillholes_pushpull (Src)
2588+
.. tab:: oiiotool
2589+
.. sourcecode:: bash
25832590

2584-
.. code-tab:: bash oiiotool
2585-
2586-
oiiotool holes.exr --fillholes -o filled.exr
2591+
oiiotool holes.exr --fillholes -o filled.exr
25872592

25882593
|
25892594
55.5 KB
Binary file not shown.

testsuite/docs-examples-cpp/ref/out.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ example_fit
2929
example_warp
3030
example_fixNonFinite
3131
Repaired 48 non-finite pixels
32+
example_fillholes_pushpull
3233
example_make_texture
3334
zero1.exr : 512 x 512, 3 channel, half openexr
3435
SHA-1: 95823C334FCE55968E8D2827CCD1CF77CEE19ABD
@@ -110,6 +111,8 @@ texture.exr : 256 x 256, 3 channel, half openexr (+mipmap)
110111
SHA-1: 4074B050432CE7C664CEC4546A46E74F9A310CDC
111112
with_nans_fixed.tif : 256 x 256, 3 channel, float tiff
112113
SHA-1: FE830FB041FAE5F1AA16B23FB69B91DED4BF5B73
114+
checker_with_alpha_filled.exr : 256 x 256, 4 channel, half openexr
115+
SHA-1: B245E027638D5C1BA2608FEDDB3BB9B5E9FA3A44
113116
Comparing "simple.tif" and "ref/simple.tif"
114117
PASS
115118
Comparing "scanlines.tif" and "ref/scanlines.tif"

testsuite/docs-examples-cpp/run.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
command += run_app("cmake -E copy " + test_source_dir + "/../common/grid-small.exr grid.exr")
1515
command += run_app("cmake -E copy " + test_source_dir + "/../common/tahoe-small.tif tahoe.tif")
1616
command += run_app("cmake -E copy " + test_source_dir + "/../common/with_nans.tif with_nans.tif")
17+
command += run_app("cmake -E copy " + test_source_dir + "/../common/checker_with_alpha.exr checker_with_alpha.exr")
1718

1819
# Build
1920
command += run_app("cmake -S " + test_source_dir + " -B build -DCMAKE_BUILD_TYPE=Release >> build.txt 2>&1", silent=True)
@@ -70,7 +71,9 @@
7071
"reorient.exr",
7172
"cshift.exr",
7273
"texture.exr",
73-
"with_nans_fixed.tif"
74+
"with_nans_fixed.tif",
75+
"checker_with_alpha_filled.exr"
76+
7477
]
7578
for file in hashes :
7679
command += info_command(file, verbose=False)

testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,21 @@ void example_fixNonFinite()
517517
Src.write("with_nans_fixed.tif");
518518

519519
}
520+
521+
void example_fillholes_pushpull()
522+
{
523+
print("example_fillholes_pushpull\n");
524+
// BEGIN-imagebufalgo-fillholes_pushpull
525+
526+
ImageBuf Src ("checker_with_alpha.exr");
527+
ImageBuf Filled = ImageBufAlgo::fillholes_pushpull (Src);
528+
529+
// END-imagebufalgo-fillholes_pushpull
530+
Filled.write("checker_with_alpha_filled.exr");
531+
532+
}
533+
534+
520535
// Section: Morphological filters
521536

522537

@@ -592,6 +607,7 @@ int main(int /*argc*/, char** /*argv*/)
592607
// Section: Image enhancement / restoration
593608

594609
example_fixNonFinite();
610+
example_fillholes_pushpull();
595611

596612
// Section: Morphological filters
597613

testsuite/docs-examples-python/ref/out.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ example_resample
2929
example_fit
3030
example_warp
3131
example_fixNonFinite
32+
example_fillholes_pushpull
3233
example_make_texture
3334
zero1.exr : 512 x 512, 3 channel, half openexr
3435
SHA-1: 95823C334FCE55968E8D2827CCD1CF77CEE19ABD
@@ -110,6 +111,8 @@ texture.exr : 256 x 256, 3 channel, half openexr (+mipmap)
110111
SHA-1: 4074B050432CE7C664CEC4546A46E74F9A310CDC
111112
with_nans_fixed.tif : 256 x 256, 3 channel, float tiff
112113
SHA-1: FE830FB041FAE5F1AA16B23FB69B91DED4BF5B73
114+
checker_with_alpha_filled.exr : 256 x 256, 4 channel, half openexr
115+
SHA-1: B245E027638D5C1BA2608FEDDB3BB9B5E9FA3A44
113116
Comparing "simple.tif" and "../docs-examples-cpp/ref/simple.tif"
114117
PASS
115118
Comparing "scanlines.tif" and "../docs-examples-cpp/ref/scanlines.tif"

testsuite/docs-examples-python/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
command += run_app("cmake -E copy " + test_source_dir + "/../common/grid-small.exr grid.exr")
1515
command += run_app("cmake -E copy " + test_source_dir + "/../common/tahoe-small.tif tahoe.tif")
1616
command += run_app("cmake -E copy " + test_source_dir + "/../common/with_nans.tif with_nans.tif")
17+
command += run_app("cmake -E copy " + test_source_dir + "/../common/checker_with_alpha.exr checker_with_alpha.exr")
1718

1819
# Run the examples for each chapter
1920
for chapter in [ "imageioapi", "imageoutput", "imageinput", "writingplugins",
@@ -66,7 +67,8 @@
6667
"reorient.exr",
6768
"cshift.exr",
6869
"texture.exr",
69-
"with_nans_fixed.tif"
70+
"with_nans_fixed.tif",
71+
"checker_with_alpha_filled.exr"
7072
]
7173

7274
for file in hashes :

testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,14 @@ def example_fixNonFinite():
455455
# END-imagebufalgo-fixNonFinite
456456

457457

458+
def example_fillholes_pushpull():
459+
print("example_fillholes_pushpull")
460+
# BEGIN-imagebufalgo-fillholes_pushpull
461+
Src = ImageBuf("checker_with_alpha.exr")
462+
Filled = ImageBufAlgo.fillholes_pushpull(Src)
463+
# END-imagebufalgo-fillholes_pushpull
464+
Filled.write("checker_with_alpha_filled.exr")
465+
458466

459467
# Section: Morphological filters
460468

@@ -527,6 +535,7 @@ def example_make_texture():
527535

528536
# Section: Image enhancement / restoration
529537
example_fixNonFinite()
538+
example_fillholes_pushpull()
530539

531540
# Section: Morphological filters
532541

0 commit comments

Comments
 (0)