Class ConsensusSetCriterion

java.lang.Object
net.preibisch.mvrecon.process.splitting.ConsensusSetCriterion
All Implemented Interfaces:
OctTreeSplitCriterion

public class ConsensusSetCriterion extends Object implements OctTreeSplitCriterion
Criterion based on multi-consensus RANSAC sets. Stops splitting when EITHER: 1. The number of unique detections is at or below a threshold (e.g., 12), OR 2. All corresponding views have correspondences from only ONE consensus set (even if many detections, they belong to a single coherent transformation) Continues splitting only if: - Unique detections > threshold AND any view has >1 consensus set Note: consensusSetId = -1 (single-consensus mode) is treated as its own set.
  • Field Details

    • CRITERION_NAME

      public static final String CRITERION_NAME
      See Also:
    • TOLERANCE_CHOICES

      public static final String[] TOLERANCE_CHOICES
    • defaultMinCorrespondences

      public static int defaultMinCorrespondences
    • defaultLabelChoices

      public static int[] defaultLabelChoices
    • defaultToleranceMode

      public static ConsensusSetCriterion.ToleranceMode defaultToleranceMode
    • defaultToleranceValue

      public static double defaultToleranceValue
  • Constructor Details

    • ConsensusSetCriterion

      public ConsensusSetCriterion(SpimData2 spimData, Set<String> labels, int minCorrespondences, ConsensusSetCriterion.ToleranceMode toleranceMode, double toleranceValue)
      Constructor.
      Parameters:
      spimData - The SpimData2 containing interest points
      labels - Set of interest point labels to consider
      minCorrespondences - Threshold - regions with more unique detections should be split
      toleranceMode - How to handle multiple consensus sets (NONE, PERCENTAGE, COUNT)
      toleranceValue - The tolerance value (percentage or count, depending on mode)
  • Method Details

    • shouldSplit

      public boolean shouldSplit(List<OctTreeSplitCriterion.SplitCorrespondence> correspondences)
      Description copied from interface: OctTreeSplitCriterion
      Evaluates whether to continue splitting based on pre-filtered correspondences. The correspondences have already been filtered to only include those within the current interval.
      Specified by:
      shouldSplit in interface OctTreeSplitCriterion
      Parameters:
      correspondences - The correspondences within the current interval
      Returns:
      true if this region should be split further, false if it should remain as-is
    • computeOutlierRatio

      public static double computeOutlierRatio(List<OctTreeSplitCriterion.SplitCorrespondence> correspondences)
      Compute the aggregate outlier ratio across all view pairs. For each pair, the dominant consensus set (highest count) is "inlier", everything else is "outlier". Returns totalOutliers / (totalDominant + totalOutliers), or 0.0 if there are no correspondences.
    • scoreSplit

      Description copied from interface: OctTreeSplitCriterion
      Score a candidate binary split. Lower is better. Used as tiebreaker in chooseBestSplitDimension when multiple dimensions produce the same number of clean children.
      Specified by:
      scoreSplit in interface OctTreeSplitCriterion
      Parameters:
      child1 - Correspondences in the first child
      child2 - Correspondences in the second child
      Returns:
      Score (lower = better split). Default: 0 (no preference).
    • description

      public String description()
      Specified by:
      description in interface OctTreeSplitCriterion
      Returns:
      A description of this criterion and its parameters for logging/display
    • loadCorrespondences

      Override to validate that correspondences have multi-consensus information. Throws RuntimeException if consensusSetId is -1 (single-consensus mode).
      Specified by:
      loadCorrespondences in interface OctTreeSplitCriterion
      Parameters:
      viewId - The ViewId to load correspondences for
      Returns:
      List of correspondences for this view
    • getMinCorrespondences

      public int getMinCorrespondences()
    • getToleranceMode

      public ConsensusSetCriterion.ToleranceMode getToleranceMode()
    • getToleranceValue

      public double getToleranceValue()
    • getLabels

      public Set<String> getLabels()
      Specified by:
      getLabels in interface OctTreeSplitCriterion
      Returns:
      The set of interest point labels to consider for correspondences
    • getSpimData

      public SpimData2 getSpimData()
      Specified by:
      getSpimData in interface OctTreeSplitCriterion
      Returns:
      The SpimData2 used by this criterion (needed for accessing timepoints, views, etc.)
    • setupGUI

      public static boolean setupGUI(ij.gui.GenericDialog gd, SpimData2 data)
      Setup GUI components for consensus set criterion.
      Parameters:
      gd - The GenericDialog to add components to
      data - The SpimData2
      Returns:
      true if setup successful, false if no interest points available
    • setupGUI

      public static boolean setupGUI(ij.gui.GenericDialog gd, SpimData2 data, Set<Integer> driveByChannelIds)
      Setup GUI components for consensus set criterion.
      Parameters:
      driveByChannelIds - if non-null, label availability counts are computed only over views of these driving channels (so labels that exist in every driving view are not flagged as "only available for X/Y Views" because of mirrored channels).
    • queryGUI

      public static ConsensusSetCriterion queryGUI(ij.gui.GenericDialog gd, SpimData2 data)
      Query GUI components and create ConsensusSetCriterion instance.
      Parameters:
      gd - The GenericDialog with user input
      data - The SpimData2
      Returns:
      ConsensusSetCriterion instance or null if configuration invalid
    • queryGUI

      public static ConsensusSetCriterion queryGUI(ij.gui.GenericDialog gd, SpimData2 data, Set<Integer> driveByChannelIds)
      Query GUI components and create ConsensusSetCriterion instance.
      Parameters:
      driveByChannelIds - must match the value passed to setupGUI(ij.gui.GenericDialog, net.preibisch.mvrecon.fiji.spimdata.SpimData2) so the label choices are parsed against the same (channel-restricted) view set.