Computes standard otolith morphometric measurements (Area, Perimeter, Length, Width) along with advanced shape descriptors (Feret_Max, Feret_Min, PCA_Angle). The function supports scale conversion from pixels to millimeters if a `pixels_per_mm` value is provided.
Value
A named list containing:
Area: Surface area of the otolith.Perimeter: Length of the otolith boundary.Length: Maximum dimension (major axis) of the PCA-aligned bounding box.Width: Minimum dimension (minor axis) of the PCA-aligned bounding box.Feret_Max: Maximum Feret diameter (longest distance between any two boundary points).Feret_Min: Minimum Feret diameter (minimum distance between parallel tangency lines).PCA_Angle: Orientation angle of the major axis of inertia in degrees (normalized to [0, 180)).Units: Measurement units ("px" or "mm").
Examples
# Example using the built-in Aphanopus dataset
data(Aphanopus)
# Note: For internal calculation, you would typically pass the raw coordinates.
# Here we illustrate the function with sample coordinates from the package:
image_path <- system.file("extdata", "otolith.jpg", package = "aforoR")
binary_img <- preprocess_image(image_path)
contour <- extract_contour(binary_img)
metrics <- calculate_morphometrics(contour, pixels_per_mm = 100)
print(metrics)
#> $Area
#> [1] 9.7628
#>
#> $Perimeter
#> [1] 12.89881
#>
#> $Length
#> [1] 5.025411
#>
#> $Width
#> [1] 2.72705
#>
#> $Feret_Max
#> [1] 5.031948
#>
#> $Feret_Min
#> [1] 2.726763
#>
#> $PCA_Angle
#> [1] 3.082376
#>
#> $Units
#> [1] "mm"
#>
