List of my modules...

Module: Find_Sides

Description:

Labels edge pixels of a roughly axis-aligned object, a label corresponding to one of the six sides X-, X+, Y-, Y+, Z-, and Z+. Those labels are respectively 10, 20, 30, 40, 50, and 60.

As a side effect, edge pixels not belonging to the outer boundary of the object are also labelled, their label is 1. All other pixels are labelled 0.

Algorithm

The developed algorithm is as follows (publication pending):
  1. Use a line-of-sight approach from each side of the image border to flag edge pixels according to the side and direction of the line. Flags are not mutually exclusive.
  2. All edge pixels with only 1 flag are marked A, those with 0 or more than 1 flag are marked B.
  3. Perform a region-growing from A into B, using specified connectivity.
  4. Apply a given number of passes of a sort of majority filter on A: for each pixel in A, if the clear majority of its neighbourhood (including itself) is of a different flag, change it to the majority.
  5. For the flags corresponding to each of the six sides, find the biggest connected component, all other are marked B.
  6. Perform a region-growing from A into B again.
  7. Label edge pixels according to rule described above.

Illustration on a brick-like object with some surface roughness. Result drawn with the Draw_Cubes module.

Notes

Connections:

Image

[required]
The input image, of type HxUniformScalarField3.

Ports:

Threshold


Value that defines whether a pixel belong to the source or not.

Comparison


How the threshold value is used to define pixels of the object. If it satisfied the comparison with the threshold, then it defined the pixels of the object.

Connectivity


Connectivity relation for the edge pixels.

Illustration of the different connectivities. (a): 6-, (b): 18-, and (c): 26-connectivity (in case you didn't figure it out, n-connectivity means n pixels in the neighbourhood).

Cleaning


Number of cleaning passes in step 4 of the algorithm.

Compute


Press this button to start the computation.

Commands:

Additional options can be accessed when typing in the console Find_Sides COMMAND_NAME.

verbose

Displays timing information after the computation. Retype to hide info.

create

Runs the computation. Returns the name of the output, so it can be used in a script, such as set RESULT [Find_Sides create].