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 (tuple(int, int)) – cutoff to binarize image

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

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws_closing = ws.copy()
>>> puma.filter_closing(ws.closing, cutoff=(128, 255), size=3)
>>> ws_binary = ws.copy()
>>> ws_binary.binarize_range((128, 255))
>>> puma.compare_slices(ws_binary, ws_closing) # compare it
pumapy.filters.filters.filter_dilate(ws, cutoff, size=5)[source]

3D morphological dilation filter.

Parameters
  • ws (Workspace) – input workspace

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

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

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws.binarize_range((128, 255))  # binarize it so that it is only 1s and 0s
>>> ws_dilate = ws.copy()
>>> puma.filter_dilate(ws_dilate, cutoff=(1, 1), size=5)  # dilating the copy
>>> puma.compare_slices(ws, ws_dilate)  # compare it
pumapy.filters.filters.filter_edt(ws, cutoff)[source]

3D Exact euclidean distance transform.

Parameters
  • ws (Workspace) – input workspace

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

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws.binarize_range((128, 255))  # binarize it so that it is only 1s and 0s
>>> ws_edt = ws.copy()
>>> puma.filter_edt(ws_edt, cutoff=(1,1))
>>> puma.compare_slices(ws, ws_edt) #compare it
pumapy.filters.filters.filter_erode(ws, cutoff, size=5)[source]

3D morphological erosion filter.

Parameters
  • ws (Workspace) – input workspace

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

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

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws.binarize_range((128, 255))  # binarize it so that it is only 1s and 0s
>>> ws_erode = ws.copy()
>>> puma.filter_erode(ws_erode, (1, 1))  # eroding the copy
>>> puma.compare_slices(ws, ws_erode)  # compare 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, optional) – specify whether to apply filter on orientation field

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0) #  generate tpms material
>>> ws.binarize_range((128, 255)) # binarize it so that it is only 1s and 0s
>>> ws_gaussian = ws.copy()
>>> puma.filter_gaussian(ws_gaussian, sigma=2, apply_on_orientation=False)
>>> puma.compare_slices(ws, ws_gaussian) # compare it
pumapy.filters.filters.filter_mean(ws, size=5)[source]

3D Mean filter.

Parameters
  • ws (Workspace) – input workspace

  • size (int, optional) – size of window

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws.binarize_range((128, 255))  # binarize it so that it is only 1s and 0s
>>> ws_mean = ws.copy()
>>> puma.filter_mean(ws_mean, size=10)
>>> puma.compare_slices(ws, ws_mean) #compare it
pumapy.filters.filters.filter_median(ws, size)[source]

3D Median filter

Parameters
  • ws (Workspace) – input workspace

  • size (int) – size of window

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws.binarize_range((128, 255))  # binarize it so that it is only 1s and 0s
>>> ws_median = ws.copy()
>>> puma.filter_median(ws_median, size = 10)
>>> puma.compare_slices(ws, ws_median) # compare 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 (tuple(int, int)) – cutoff to binarize image

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

Returns

True if successful, False otherwise.

Return type

bool

Example

>>> import pumapy as puma
>>> ws = puma.generate_tpms((100, 100, 100), (0.02, 0.05), 0.201, 0)  # generate tpms material
>>> ws_opening = ws.copy()
>>> puma.filter_opening(ws_opening, cutoff=(128,255), size=3)
>>> ws_binary = ws.copy()
>>> ws_binary.binarize_range((128, 255))
>>> puma.compare_slices(ws_binary, ws_opening) # compare it