Skip to content

vlt.image.rotateToMax

  ROTATETOMAX - Finds the direction of maximum signal in local regions and rotates them.

    RESULTS = vlt.image.rotateToMax(IMAGE, MASK, POINTSOFINTEREST, WINDOWSIZE, ...)

    For each point of interest, this function extracts a square local region
    (thumbnail) and analyzes the signal within a series of angular wedges
    centered on the point. It identifies the direction with the maximum mean
    signal and rotates the thumbnail so this direction points "up" (0 degrees).

    This is useful for analyzing and normalizing anisotropic patterns around
    specific features in an image.

    Inputs:
      image            - A 2D data matrix.
      mask             - A logical matrix of the same size as IMAGE. True values
                         indicate valid pixels to be included in the analysis.
      pointsOfInterest - An Nx2 matrix of [x, y] coordinates for the center
                         of each region to be analyzed.
      windowSize       - The approximate size of the square thumbnail region
                         in pixels. The actual size will be rounded to the
                         nearest odd integer to ensure a perfect center.

    Name-Value Pairs:
      'numDirections'    - The number of angular wedges to examine around each
                           point. (Default: 18)
      'wedgeAngleWidth'  - The angular width of each wedge in degrees.
                           (Default: 30)
      'wedgeRadius'      - The radial extent of the wedge from the center point
                           in pixels. (Default: windowSize / 2)

    Outputs:
      RESULTS - A structure array with one element for each point of interest,
                containing the following fields:
        .pointOfInterest   - The [x y] coordinate of the point.
        .rotatedImage      - The thumbnail image, rotated so the maximum
                             signal direction is at 0 degrees (up).
        .wedgeDirections   - The compass directions (0-360 deg) of each wedge.
        .wedgeSignalValues - The mean signal value within each wedge.
        .maximumDirection  - The compass direction with the maximum signal.