morpho Module

Morphological operations


Uses

  • module~~morpho~~UsesGraph module~morpho morpho data_arch data_arch module~morpho->data_arch miscellaneous miscellaneous module~morpho->miscellaneous module~stat_mom stat_mom module~morpho->module~stat_mom module~stat_mom->data_arch sort_arrays sort_arrays module~stat_mom->sort_arrays

Used by

  • module~~morpho~~UsedByGraph module~morpho morpho program~test_morpho test_morpho program~test_morpho->module~morpho

Subroutines

public subroutine calcul_normales(tab_in, long, larg, scale_xyz, cone_angle, hori, print_mask)

Function that returns the fraction of surface nearly horizontal (normal less than 5 degrees from a vertical line)

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:long,1:larg) :: tab_in

surface array

integer(kind=I4), intent(in) :: long

surface array length

integer(kind=I4), intent(in) :: larg

surface array width

real(kind=R8), intent(in), dimension(1:3) :: scale_xyz

lag along x, y and scale z

real(kind=R8), intent(in) :: cone_angle

cone angle

real(kind=R8), intent(out) :: hori

fraction of facets nearly horizontal

logical(kind=I4), intent(in), optional :: print_mask

mask output ?

public subroutine count_cell(msk, long, larg, nbr_cell, med_cell)

Calculate the number of cells in a mask, as well as the cell median size

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(inout), dimension(1:long, 1:larg) :: msk

mask

integer(kind=I4), intent(in) :: long

2D array length

integer(kind=I4), intent(in) :: larg

2D array height

integer(kind=I4), intent(out) :: nbr_cell

number of cells

real(kind=R8), intent(out), optional :: med_cell

median size of the cells

public subroutine def_masque(msk, tab, long, larg, crit1, crit2, top)

Height mask without deepest pits and highest peaks

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(out), dimension(1:long, 1:larg) :: msk

mask

real(kind=R8), intent(in), dimension(1:long, 1:larg) :: tab

heights 2D array

integer(kind=I4), intent(in) :: long

2D array length

integer(kind=I4), intent(in) :: larg

2D array height

real(kind=R8), intent(in) :: crit1

%age for deepest pits to remove

real(kind=R8), intent(in) :: crit2

%age for highest peaks to remove

real(kind=R8), intent(out) :: top

%age of surface masked

public subroutine erode_dilate(msk, long, larg, val, act)

Perform erosion or dilation on a binary mask depending on the value of act. The operations utilize a defined kernel to affect neighboring pixels based on the specified val

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(inout), dimension(1:long,1:larg) :: msk

2D mask

integer(kind=I4), intent(in) :: long

2D mask length

integer(kind=I4), intent(in) :: larg

2D mask height

integer(kind=I4), intent(in) :: val

size of the structuring element for the erosion/dilation operation

character(len=5), intent(in) :: act

action to be performed, either “erode” or another operation, presumably “dilate”.

private subroutine flood(masque, taille, nx, ny, niv)

Perform some kind of flood fill or connected component labeling on a grid (masque), starting from an initial ‘1’ element found and spreading out to adjacent ‘1’ elements, updating them to a specified value or zero if no value (niv) is specified.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(inout), dimension(1:nx, 1:ny) :: masque

Input/output matrix

integer(kind=I4), intent(out) :: taille

Output scalar

integer(kind=I4), intent(in) :: nx

Input dimensions

integer(kind=I4), intent(in) :: ny

Input dimensions

integer(kind=I4), intent(in), optional :: niv

Optional input level

private subroutine make_composite_mask(msk, n_cells, locus, a, b, width, height, shap, long, larg)

The subroutine generates a composite mask based on specified parameters. The mask is filled with a number of shapes (in this case, ellipses) placed randomly within a defined area, while ensuring that the shapes do not overlap.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(out), dimension(1:long, 1:larg) :: msk

Output mask that will be filled with shapes

integer(kind=I4), intent(in) :: n_cells

Number of cells to create in the composite mask

character(len=6), intent(in) :: locus

Position of the shape (e.g., ‘center’ for centering)

integer(kind=I4), intent(in) :: a

ellipsis first parameter

integer(kind=I4), intent(in) :: b

ellipsis second parameter

integer(kind=I4), intent(in) :: width

Width of each shape to be drawn in the mask

integer(kind=I4), intent(in) :: height

Height of each shape to be drawn in the mask

character(len=8), intent(in) :: shap

Type of shape to be drawn (here, ‘ellipsis’ is used)

integer(kind=I4), intent(in) :: long

Length (dimensions) of the mask

integer(kind=I4), intent(in) :: larg

Width (dimensions) of the mask

private subroutine make_mask(x0, y0, a, b, shap, msk, long, larg)

Mask a region within a given shape (for the moment an ellipsis)

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(in) :: x0

mask shape center 1st coordinate

integer(kind=I4), intent(in) :: y0

mask shape center 2nd coordinate

integer(kind=I4), intent(in) :: a

ellipsis semi-length

integer(kind=I4), intent(in) :: b

ellipsis semi-height

character(len=8), intent(in) :: shap

kind of mask shape

integer(kind=I4), intent(inout), dimension(1:long, 1:larg) :: msk

mask

integer(kind=I4), intent(in) :: long

2D array length

integer(kind=I4), intent(in) :: larg

2D array height

public subroutine surf_area(tab_in, long, larg, scale_xyz, aire)

Function that returns the relative area of a surface minus 1.

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:long,1:larg) :: tab_in

surface array

integer(kind=I4), intent(in) :: long

2D array length

integer(kind=I4), intent(in) :: larg

2D array width

real(kind=R8), intent(in), dimension(1:3) :: scale_xyz

scale along x, y, z

real(kind=R8), intent(out) :: aire

computed area

public subroutine topology(tab, long, larg, res)

The function performs the following operations on a surface:

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:long, 1:larg) :: tab

heights 2D array

integer(kind=I4), intent(in) :: long

2D array length

integer(kind=I4), intent(in) :: larg

2D array height

real(kind=R8), intent(out), dimension(1:6) :: res

results