loci.formats.cache

## Class CrosshairStrategy

- java.lang.Object
- - loci.formats.cache.CacheStrategy
  - - loci.formats.cache.CrosshairStrategy

- All Implemented Interfaces:
    java.util.Comparator, CacheReporter, ICacheStrategy

      public class CrosshairStrategy
      extends CacheStrategy

  A crosshair strategy caches planes extending from the the current dimensional position along each individual axis, but not combinations of axes. For example, if the current position is Z5-C2-T18, the strategy will preload the next and previous focal planes (Z6-C2-T18 and Z4-C2-T18), the next and previous channels (Z5-C3-T18 and Z5-C1-T18), and the next and previous time points (Z5-C2-T19 and Z5-C2-T17), but nothing diverging on multiple axes (e.g., Z6-C3-T19 or Z4-C1-T17).

  Planes closest to the current position are loaded first, with axes prioritized according to the cache strategy's priority settings.

  To illustrate the crosshair strategy, here is a diagram showing a case in 2D with 35 dimensional positions (5Z x 7T). For both Z and T, order is centered, range is 2, and priority is normal. The numbers indicate the order planes will be cached, with "0" corresponding to the current dimensional position (Z2-3T).

            T  0  1  2  3  4  5  6
          Z /---------------------
          0 |           6
          1 |           2
          2 |     8  4  0  3  7
          3 |           1
          4 |           5

- - ### Field Summary

    - ### Fields inherited from class loci.formats.cache.CacheStrategy

      `DEFAULT_RANGE, lengths, listeners, order, priorities, range`

    - ### Fields inherited from interface loci.formats.cache.ICacheStrategy

      `BACKWARD_ORDER, CENTERED_ORDER, FORWARD_ORDER, HIGH_PRIORITY, LOW_PRIORITY, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CrosshairStrategy(int[] lengths)` Constructs a crosshair strategy.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int[][]` | `getPossiblePositions()` Gets positions to consider for possible inclusion in the cache, assuming a current position at the origin (0).

    - ### Methods inherited from class loci.formats.cache.CacheStrategy

      `addCacheListener, compare, distance, getCacheListeners, getLengths, getLoadList, getOrder, getPriorities, getRange, length, notifyListeners, pos, pos, raster, removeCacheListener, setOrder, setPriority, setRange`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### CrosshairStrategy

          public CrosshairStrategy(int[] lengths)

      Constructs a crosshair strategy.

  - ### Method Detail

    - #### getPossiblePositions

          protected int[][] getPossiblePositions()

      Description copied from class: `CacheStrategy`
      Gets positions to consider for possible inclusion in the cache, assuming a current position at the origin (0).
      Specified by:
        `getPossiblePositions` in class `CacheStrategy`

Copyright © 2026 Open Microscopy Environment