Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pandoc
uses: pandoc/actions/setup@v1

- name: Set up uv
id: setup-uv
uses: astral-sh/setup-uv@v6
Expand Down
1,363 changes: 41 additions & 1,322 deletions examples/filters/reference/apply_chords.ipynb

Large diffs are not rendered by default.

655 changes: 41 additions & 614 deletions examples/filters/reference/apply_chords_3D.ipynb

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions examples/filters/reference/apply_padded.ipynb

Large diffs are not rendered by default.

40 changes: 12 additions & 28 deletions examples/filters/reference/chunked_func.ipynb

Large diffs are not rendered by default.

747 changes: 30 additions & 717 deletions examples/filters/reference/distance_transform_lin.ipynb

Large diffs are not rendered by default.

649 changes: 45 additions & 604 deletions examples/filters/reference/fftmorphology.ipynb

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions examples/filters/reference/fill_closed_pores.ipynb

Large diffs are not rendered by default.

55 changes: 20 additions & 35 deletions examples/filters/reference/find_disconnected_voxels.ipynb

Large diffs are not rendered by default.

93 changes: 14 additions & 79 deletions examples/filters/reference/find_dt_artifacts.ipynb

Large diffs are not rendered by default.

671 changes: 41 additions & 630 deletions examples/filters/reference/find_peaks.ipynb

Large diffs are not rendered by default.

1,665 changes: 0 additions & 1,665 deletions examples/filters/reference/find_trapped_clusters.ipynb

This file was deleted.

508 changes: 31 additions & 477 deletions examples/filters/reference/flood.ipynb

Large diffs are not rendered by default.

536 changes: 24 additions & 512 deletions examples/filters/reference/flood_func.ipynb

Large diffs are not rendered by default.

1,077 changes: 32 additions & 1,045 deletions examples/filters/reference/hold_peaks.ipynb

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions examples/filters/reference/local_thickness.ipynb

Large diffs are not rendered by default.

63 changes: 24 additions & 39 deletions examples/filters/reference/nl_means_layered.ipynb

Large diffs are not rendered by default.

67 changes: 14 additions & 53 deletions examples/filters/reference/nphase_border.ipynb

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions examples/filters/reference/pc_to_satn.ipynb

Large diffs are not rendered by default.

57 changes: 30 additions & 27 deletions examples/filters/reference/porosimetry.ipynb

Large diffs are not rendered by default.

157 changes: 23 additions & 134 deletions examples/filters/reference/prune_branches.ipynb

Large diffs are not rendered by default.

116 changes: 16 additions & 100 deletions examples/filters/reference/reduce_peaks.ipynb

Large diffs are not rendered by default.

165 changes: 45 additions & 120 deletions examples/filters/reference/region_size.ipynb

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions examples/filters/reference/satn_to_seq.ipynb

Large diffs are not rendered by default.

88 changes: 25 additions & 63 deletions examples/filters/reference/seq_to_satn.ipynb

Large diffs are not rendered by default.

1,667 changes: 58 additions & 1,609 deletions examples/filters/reference/size_to_satn.ipynb

Large diffs are not rendered by default.

1,279 changes: 46 additions & 1,233 deletions examples/filters/reference/size_to_seq.ipynb

Large diffs are not rendered by default.

425 changes: 62 additions & 363 deletions examples/filters/reference/snow_partitioning.ipynb

Large diffs are not rendered by default.

177 changes: 28 additions & 149 deletions examples/filters/reference/snow_partitioning_n.ipynb

Large diffs are not rendered by default.

112 changes: 20 additions & 92 deletions examples/filters/reference/snow_partitioning_parallel.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/filters/reference/trim_disconnected_voxels.ipynb

Large diffs are not rendered by default.

3,917 changes: 46 additions & 3,871 deletions examples/filters/reference/trim_extrema.ipynb

Large diffs are not rendered by default.

51 changes: 31 additions & 20 deletions examples/filters/reference/trim_floating_solid.ipynb

Large diffs are not rendered by default.

309 changes: 19 additions & 290 deletions examples/filters/reference/trim_nearby_peaks.ipynb

Large diffs are not rendered by default.

678 changes: 24 additions & 654 deletions examples/filters/reference/trim_nonpercolating_paths.ipynb

Large diffs are not rendered by default.

331 changes: 23 additions & 308 deletions examples/filters/reference/trim_saddle_points.ipynb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions examples/filters/reference/trim_small_clusters.ipynb

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions examples/filters/tutorials/adding_chords.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
],
"source": [
"fig, ax = plt.subplots()\n",
"ax.imshow(im, interpolation='none', origin='lower')\n",
"ax.axis('off');"
"ax.imshow(im, interpolation=\"none\", origin=\"lower\")\n",
"ax.axis(\"off\");"
]
},
{
Expand Down Expand Up @@ -131,9 +131,9 @@
"crds_x = ps.filters.apply_chords(im=im, spacing=4, axis=0)\n",
"crds_y = ps.filters.apply_chords(im=im, spacing=4, axis=1)\n",
"fig, ax = plt.subplots(1, 2, figsize=[8, 4])\n",
"ax[0].imshow(crds_x, interpolation='none', origin='lower')\n",
"ax[0].imshow(crds_x, interpolation=\"none\", origin=\"lower\")\n",
"ax[0].axis(False)\n",
"ax[1].imshow(crds_y, interpolation='none', origin='lower')\n",
"ax[1].imshow(crds_y, interpolation=\"none\", origin=\"lower\")\n",
"ax[1].axis(False);"
]
},
Expand Down Expand Up @@ -183,9 +183,9 @@
"sz_x = ps.filters.region_size(crds_x)\n",
"sz_y = ps.filters.region_size(crds_y)\n",
"fig, ax = plt.subplots(1, 2, figsize=[8, 4])\n",
"ax[0].imshow(sz_x, interpolation='none', origin='lower')\n",
"ax[0].imshow(sz_x, interpolation=\"none\", origin=\"lower\")\n",
"ax[0].axis(False)\n",
"ax[1].imshow(sz_y, interpolation='none', origin='lower')\n",
"ax[1].imshow(sz_y, interpolation=\"none\", origin=\"lower\")\n",
"ax[1].axis(False);"
]
},
Expand Down Expand Up @@ -291,8 +291,12 @@
],
"source": [
"fig, ax = plt.subplots(figsize=(5, 4))\n",
"ax.bar(x=data_y.L, height=data_y.cdf, width=data_y.bin_widths, color='b', edgecolor='k', alpha=0.5)\n",
"ax.bar(x=data_x.L, height=data_x.cdf, width=data_x.bin_widths, color='r', edgecolor='k', alpha=0.5)\n",
"ax.bar(\n",
" x=data_y.L, height=data_y.cdf, width=data_y.bin_widths, color=\"b\", edgecolor=\"k\", alpha=0.5\n",
")\n",
"ax.bar(\n",
" x=data_x.L, height=data_x.cdf, width=data_x.bin_widths, color=\"r\", edgecolor=\"k\", alpha=0.5\n",
")\n",
"ax.set_xlabel(\"Chord length\")\n",
"ax.set_ylabel(\"Frequency\");"
]
Expand Down Expand Up @@ -390,7 +394,7 @@
"source": [
"crds = ps.filters.apply_chords(im=im, axis=0)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(crds[:, :, 50], interpolation='none', origin='lower')\n",
"ax.imshow(crds[:, :, 50], interpolation=\"none\", origin=\"lower\")\n",
"ax.axis(False);"
]
},
Expand Down Expand Up @@ -425,7 +429,7 @@
"source": [
"data = ps.metrics.chord_length_distribution(crds, bins=25)\n",
"fig, ax = plt.subplots(figsize=(5, 4))\n",
"ax.bar(x=data_y.L, height=data.cdf, width=data.bin_widths, color='b', edgecolor='k', alpha=0.5)\n",
"ax.bar(x=data_y.L, height=data.cdf, width=data.bin_widths, color=\"b\", edgecolor=\"k\", alpha=0.5)\n",
"ax.set_xlabel(\"Chord length\")\n",
"ax.set_ylabel(\"Frequency\");"
]
Expand Down
36 changes: 18 additions & 18 deletions examples/filters/tutorials/finding_and_filling_pores.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(im_closed, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Closed pores')\n",
"ax[1].set_title(\"Closed pores\")\n",
"ax[2].imshow(im_filled, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('Image without closed pores');"
"ax[2].set_title(\"Image without closed pores\");"
]
},
{
Expand Down Expand Up @@ -164,13 +164,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(im_surface, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Surface pores')\n",
"ax[1].set_title(\"Surface pores\")\n",
"ax[2].imshow(im_filled, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('Image without closed or surface pores');"
"ax[2].set_title(\"Image without closed or surface pores\");"
]
},
{
Expand Down Expand Up @@ -207,13 +207,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(im_invalid, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Invalid pores')\n",
"ax[1].set_title(\"Invalid pores\")\n",
"ax[2].imshow(im_filled, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('Image without invalid pores');"
"ax[2].set_title(\"Image without invalid pores\");"
]
},
{
Expand Down Expand Up @@ -253,13 +253,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(~im_floating, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Floating solid')\n",
"ax[1].set_title(\"Floating solid\")\n",
"ax[2].imshow(im_trimmed, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('Image w no invalid pores or floating solid');"
"ax[2].set_title(\"Image w no invalid pores or floating solid\");"
]
},
{
Expand Down Expand Up @@ -299,13 +299,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(im_filled_ud, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Percolating top to bottom')\n",
"ax[1].set_title(\"Percolating top to bottom\")\n",
"ax[2].imshow(im_filled_lr, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('Percolating left to right');"
"ax[2].set_title(\"Percolating left to right\");"
]
},
{
Expand Down Expand Up @@ -345,13 +345,13 @@
"fig, ax = plt.subplots(1, 3, figsize=[12, 4])\n",
"ax[0].imshow(im, cmap=cm, vmax=2)\n",
"ax[0].axis(False)\n",
"ax[0].set_title('Original image')\n",
"ax[0].set_title(\"Original image\")\n",
"ax[1].imshow(im_disconnected, cmap=cm, vmax=2)\n",
"ax[1].axis(False)\n",
"ax[1].set_title('Disconnected from inlets')\n",
"ax[1].set_title(\"Disconnected from inlets\")\n",
"ax[2].imshow(im_filled, cmap=cm, vmax=2)\n",
"ax[2].axis(False)\n",
"ax[2].set_title('After filling');"
"ax[2].set_title(\"After filling\");"
]
},
{
Expand Down
20 changes: 10 additions & 10 deletions examples/filters/tutorials/local_thickness.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"im = ps.generators.random_spheres(im=im, r=15, phi=0.4, smooth=False)\n",
"im = ps.generators.random_spheres(im=im, r=10, phi=0.6, smooth=False)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(im, interpolation='none', origin='lower')\n",
"ax.imshow(im, interpolation=\"none\", origin=\"lower\")\n",
"ax.axis(False);"
]
},
Expand Down Expand Up @@ -116,7 +116,7 @@
"source": [
"thk = ps.filters.local_thickness(im)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(thk, interpolation='none', origin='lower', cmap=plt.cm.viridis)\n",
"ax.imshow(thk, interpolation=\"none\", origin=\"lower\", cmap=plt.cm.viridis)\n",
"ax.axis(False);"
]
},
Expand Down Expand Up @@ -222,9 +222,9 @@
],
"source": [
"fig, ax = plt.subplots(figsize=(5, 4))\n",
"ax.set_xlabel('log(Pore Radius) [voxels]')\n",
"ax.set_ylabel('Normalized Volume Fraction')\n",
"ax.bar(x=psd.LogR, height=psd.pdf, width=psd.bin_widths, edgecolor='k');"
"ax.set_xlabel(\"log(Pore Radius) [voxels]\")\n",
"ax.set_ylabel(\"Normalized Volume Fraction\")\n",
"ax.bar(x=psd.LogR, height=psd.pdf, width=psd.bin_widths, edgecolor=\"k\");"
]
},
{
Expand Down Expand Up @@ -269,7 +269,7 @@
"strel = ps.tools.ps_disk(R)\n",
"im_temp = spim.binary_opening(im, structure=strel)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(im_temp*2.0, interpolation='none', origin='lower');"
"ax.imshow(im_temp * 2.0, interpolation=\"none\", origin=\"lower\");"
]
},
{
Expand All @@ -292,7 +292,7 @@
},
"outputs": [],
"source": [
"im_result = im_temp*R"
"im_result = im_temp * R"
]
},
{
Expand Down Expand Up @@ -340,7 +340,7 @@
},
"outputs": [],
"source": [
"im_result[(im_result == 0)*im_temp] = R"
"im_result[(im_result == 0) * im_temp] = R"
]
},
{
Expand Down Expand Up @@ -381,7 +381,7 @@
],
"source": [
"fig, ax = plt.subplots()\n",
"ax.imshow(im_result, interpolation='none', origin='lower');"
"ax.imshow(im_result, interpolation=\"none\", origin=\"lower\");"
]
},
{
Expand Down Expand Up @@ -421,7 +421,7 @@
],
"source": [
"fig, ax = plt.subplots()\n",
"ax.imshow(thk, cmap=plt.cm.viridis, interpolation='none', origin='lower');"
"ax.imshow(thk, cmap=plt.cm.viridis, interpolation=\"none\", origin=\"lower\");"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions examples/filters/tutorials/snow_partitioning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"source": [
"im = ps.generators.overlapping_spheres([500, 500], r=10, porosity=0.5)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(im, origin='lower');"
"ax.imshow(im, origin=\"lower\");"
]
},
{
Expand Down Expand Up @@ -2193,13 +2193,13 @@
],
"source": [
"fig, ax = plt.subplots(2, 2, figsize=[8, 8])\n",
"ax[0, 0].imshow(snow_out.im, origin='lower')\n",
"ax[0, 1].imshow(snow_out.dt, origin='lower')\n",
"ax[0, 0].imshow(snow_out.im, origin=\"lower\")\n",
"ax[0, 1].imshow(snow_out.dt, origin=\"lower\")\n",
"dt_peak = snow_out.dt.copy()\n",
"peaks_dilated = binary_dilation(snow_out.peaks > 0)\n",
"dt_peak[peaks_dilated > 0] = np.nan\n",
"ax[1, 0].imshow(dt_peak, origin='lower')\n",
"ax[1, 1].imshow(ps.tools.randomize_colors(snow_out.regions), origin='lower')\n",
"ax[1, 0].imshow(dt_peak, origin=\"lower\")\n",
"ax[1, 1].imshow(ps.tools.randomize_colors(snow_out.regions), origin=\"lower\")\n",
"ax[0, 0].set_title(\"Binary image\")\n",
"ax[0, 1].set_title(\"Distance transform\")\n",
"ax[1, 0].set_title(\"Distance transform peaks\")\n",
Expand Down
7 changes: 4 additions & 3 deletions examples/filters/tutorials/snow_partitioning_parallel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"source": [
"im = ps.generators.overlapping_spheres([1000, 1000], r=10, porosity=0.5)\n",
"fig, ax = plt.subplots()\n",
"ax.imshow(im, origin='lower');"
"ax.imshow(im, origin=\"lower\");"
]
},
{
Expand Down Expand Up @@ -117,7 +117,8 @@
"source": [
"parallel_kw = {\"divs\": 2}\n",
"snow_out = ps.filters.snow_partitioning_parallel(\n",
" im=im, parallel_kw=parallel_kw, r_max=5, sigma=0.4)"
" im=im, parallel_kw=parallel_kw, r_max=5, sigma=0.4\n",
")"
]
},
{
Expand Down Expand Up @@ -160,7 +161,7 @@
"source": [
"fig, ax = plt.subplots(1, 1, figsize=[6, 6])\n",
"ax.imshow(randomize_colors(snow_out.regions))\n",
"ax.set_title('Segmented Image');"
"ax.set_title(\"Segmented Image\");"
]
},
{
Expand Down
Loading
Loading