1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Morphological operations on n-dimensional arrays
//!
//! This module provides functions for performing morphological operations on n-dimensional
//! arrays, such as erosion, dilation, opening, closing, gradient, tophat and more.
//!
//! Morphological operations are nonlinear operations that process images based on shapes.
//! They can be used for many purposes: removing noise, extracting features, detecting edges, etc.
//!
//! # Usage Recommendations
//!
//! For best results, use the following guidelines:
//!
//! 1. For 1D and 2D arrays, use the specific implementations:
//! - For 1D arrays, the generic `binary_*` functions will automatically use optimized 1D implementations
//! - For 2D arrays, prefer the functions in the `simple_morph` module, like `binary_erosion_2d` and `grey_dilation_2d`
//!
//! 2. For n-dimensional arrays of arbitrary dimension:
//! - Use the generic functions (`binary_erosion`, `grey_dilation`, etc.), but be aware of limitations
//! - Convert your arrays to `IxDyn` dimension type before passing to these functions
//! - Some operations for dimensions greater than 2 are limited in functionality
//!
//! # Example
//!
//! ```
//! use scirs2_core::ndarray::{Array2, array};
//! use scirs2_ndimage::morphology::simple_morph::binary_erosion_2d;
//!
//! // Create a binary image
//! let input = array![[false, true, true],
//! [false, true, true],
//! [false, false, false]];
//!
//! // Apply binary erosion
//! let result = binary_erosion_2d(&input, None, None, None, None).unwrap();
//! assert_eq!(result[[1, 1]], false); // Corner pixels are eroded
//! ```
use Debug;
// These modules have issues, not exporting directly
// Public re-exports
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
/// Border handling modes for morphological operations
/// Structuring element connectivity for binary morphology