morphology.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.ndimage` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _morphology
  6. __all__ = [ # noqa: F822
  7. 'iterate_structure', 'generate_binary_structure',
  8. 'binary_erosion', 'binary_dilation', 'binary_opening',
  9. 'binary_closing', 'binary_hit_or_miss', 'binary_propagation',
  10. 'binary_fill_holes', 'grey_erosion', 'grey_dilation',
  11. 'grey_opening', 'grey_closing', 'morphological_gradient',
  12. 'morphological_laplace', 'white_tophat', 'black_tophat',
  13. 'distance_transform_bf', 'distance_transform_cdt',
  14. 'distance_transform_edt'
  15. ]
  16. def __dir__():
  17. return __all__
  18. def __getattr__(name):
  19. if name not in __all__:
  20. raise AttributeError(
  21. "scipy.ndimage.morphology is deprecated and has no attribute "
  22. f"{name}. Try looking in scipy.ndimage instead.")
  23. warnings.warn(f"Please use `{name}` from the `scipy.ndimage` namespace, "
  24. "the `scipy.ndimage.morphology` namespace is deprecated.",
  25. category=DeprecationWarning, stacklevel=2)
  26. return getattr(_morphology, name)