pumapy.filters

pumapy.filters.filters

pumapy.filters.filters.filter_closing(ws, cutoff, size=5)[source]

3D morphological closing filter (i.e. erosion first and then dilation).

Parameters
  • ws (Workspace) – input workspace

  • cutoff ((int, int)) – cutoff to binarize image

  • size (int) – size of the spherical windows used

Example

>>> import pumapy as puma
>>> ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
Importing .../100_fiberform.tif ... Done
>>> ws_closing = ws.copy()
>>> puma.filter_closing(ws_closing, cutoff=(90, 255), size=3)
>>> ws_binary = ws.copy()
>>> ws_binary.binarize_range((90, 255))
>>> # puma.compare_slices(ws_binary, ws_closing, 'z', index=1)  # to visualize it
pumapy.filters.filters.filter_dilate(ws, cutoff, size=5)[source]

3D morphological dilation filter.

Parameters
  • ws (Workspace) – input workspace

  • cutoff ((int, int)) – cutoff to binarize image

  • size (int) – size of the spherical windows used

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
Generating TPMS ...
>>> ws_dilate = ws.copy()
>>> puma.filter_dilate(ws_dilate, cutoff=(1, 1), size=5)  # dilating the copy
>>> # puma.compare_slices(ws, ws_dilate)  # to visualize it
pumapy.filters.filters.filter_edt(ws, cutoff)[source]

3D Exact euclidean distance transform.

Parameters
  • ws (Workspace) – input workspace

  • cutoff ((int, int)) – cutoff to binarize image

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
Generating TPMS...
>>> ws_edt = ws.copy()
>>> puma.filter_edt(ws_edt, cutoff=(1, 1))
>>> # puma.compare_slices(ws, ws_edt)  # to visualize it
pumapy.filters.filters.filter_erode(ws, cutoff, size=5)[source]

3D morphological erosion filter.

Parameters
  • ws (Workspace) – input workspace

  • cutoff ((int, int)) – cutoff to binarize image

  • size (int) – size of the spherical windows used

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
Generating TPMS ...
>>> ws_erode = ws.copy()
>>> puma.filter_erode(ws_erode, (1, 1))  # eroding the copy
>>> # puma.compare_slices(ws, ws_erode)  # to visualize it
pumapy.filters.filters.filter_gaussian(ws, sigma=1, apply_on_orientation=False)[source]

3D Gaussian filter

Parameters
  • ws (Workspace) – input workspace

  • sigma (int) – size of kernel

  • apply_on_orientation (bool) – specify whether to apply filter on orientation field

Example

>>> import pumapy as puma
>>> ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
Importing .../100_fiberform.tif ... Done
>>> ws_gaussian = ws.copy()
>>> puma.filter_gaussian(ws_gaussian, sigma=2, apply_on_orientation=False)
>>> # puma.compare_slices(ws, ws_gaussian, 'z', index=1)  # to visualize it
pumapy.filters.filters.filter_mean(ws, size=5)[source]

3D Mean filter.

Parameters
  • ws (Workspace) – input workspace

  • size (int) – size of window

Example

>>> import pumapy as puma
>>> ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
Importing .../100_fiberform.tif ... Done
>>> ws_mean = ws.copy()
>>> puma.filter_mean(ws_mean, size=10)
>>> # puma.compare_slices(ws, ws_mean)  # to visualize it
pumapy.filters.filters.filter_median(ws, size)[source]

3D Median filter

Parameters
  • ws (Workspace) – input workspace

  • size (int) – size of window

Example

>>> import pumapy as puma
>>> ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
Importing .../100_fiberform.tif ... Done
>>> ws_median = ws.copy()
>>> puma.filter_median(ws_median, size=10)
>>> # puma.compare_slices(ws, ws_median)  # to visualize it
pumapy.filters.filters.filter_opening(ws, cutoff, size=5)[source]

3D morphological opening filter (i.e. dilation first and then erosion).

Parameters
  • ws (Workspace) – input workspace

  • cutoff ((int, int)) – cutoff to binarize image

  • size (int) – size of the spherical windows used

Example

>>> import pumapy as puma
>>> ws = puma.import_3Dtiff(puma.path_to_example_file("100_fiberform.tif"), 1.3e-6)
Importing .../100_fiberform.tif ... Done
>>> ws_opening = ws.copy()
>>> puma.filter_opening(ws_opening, cutoff=(90, 255), size=3)
>>> ws_binary = ws.copy()
>>> ws_binary.binarize_range((90, 255))
>>> # puma.compare_slices(ws_binary, ws_opening, 'z', index=1)  # to visualize it