java.lang.Object
net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.PairwiseSetup<V>
Direct Known Subclasses:
AllToAllRange

public abstract class PairwiseSetup<V extends Comparable<V>> extends Object
  • Field Details

  • Constructor Details

    • PairwiseSetup

      public PairwiseSetup(List<V> views, Set<Group<V>> groups)
      Sets up all pairwise comparisons 1) definePairs() 2) removeNonOverlappingPairs() - if wanted 3) reorderPairs() - if wanted 4) detectSubsets() 5) sortSubsets() - if wanted 6) getSubsets() within each subset 7) subset.fixViews( this.getDefaultFixedViews() ) 8) subset.fixViews() - fixed some of the views necessary for the strategy to work
      Parameters:
      views - - all the views to include
      groups - - view groups to include
    • PairwiseSetup

      public PairwiseSetup(List<V> views)
  • Method Details

    • getViews

      public List<V> getViews()
    • getGroups

      public Set<Group<V>> getGroups()
    • getPairs

      public List<net.imglib2.util.Pair<V,V>> getPairs()
    • getSubsets

      public ArrayList<Subset<V>> getSubsets()
    • setPairs

      public void setPairs(List<net.imglib2.util.Pair<V,V>> pairs)
      Directly set the pairs list (used for optimized pair generation that bypasses definePairs()). After calling this, you should call detectSubsets() to build the subset structure.
      Parameters:
      pairs - - the list of pairs to set
    • definePairs

      public ArrayList<net.imglib2.util.Pair<V,V>> definePairs()
      Given a list of views and their grouping, identify all pairs that need to be compared
      Returns:
      - redundant pairs that were removed
    • definePairsAbstract

      protected abstract List<net.imglib2.util.Pair<V,V>> definePairsAbstract()
      abstract method called by the public definePairs method
      Returns:
      - the list of pairs
    • removeNonOverlappingPairs

      public ArrayList<net.imglib2.util.Pair<V,V>> removeNonOverlappingPairs(OverlapDetection<V> ovlp)
      Remove pairs that are not overlapping. Uses optimized parallel implementation for SimpleBoundingBoxOverlap with ViewId.
      Parameters:
      ovlp - - implementation of OverlapDetection
      Returns:
      a list of pairs that were removed (not stored in this object)
    • reorderPairs

      public void reorderPairs()
      Reorder the pairs so that the "smaller" view comes first
    • detectSubsets

      public void detectSubsets()
      Given a list of pairs of views that need to be compared, find subsets that are not overlapping
    • sortSubsets

      public void sortSubsets()
      Sorts each subset by comparing the first view of each pair, and then all subsets according to their first pair
    • getDefaultFixedViews

      public abstract List<V> getDefaultFixedViews()
      Get a list of fixed views necessary for the specific strategy to work
      Returns:
      list of default fixed views
    • fixViewsInAllSubsets

      public ArrayList<net.imglib2.util.Pair<V,V>> fixViewsInAllSubsets(List<V> fixedViews)
      Fix an additional list of views (removes them from pairs and subsets)
      Parameters:
      fixedViews - the fixed views (will be modified)
      Returns:
      - all the removed views
    • removeNonExistentViewsInGroups

      public static <V> Set<Group<V>> removeNonExistentViewsInGroups(List<V> views, Set<Group<V>> groups)
      Remove all views in groups that do not exist in the views list - called from constructor
      Type Parameters:
      V - anything, but most likely extending ViewId
      Parameters:
      views - the views to keep
      groups - the groups
      Returns:
      new set of groups
    • removeRedundantPairs

      public static <V> ArrayList<net.imglib2.util.Pair<V,V>> removeRedundantPairs(List<net.imglib2.util.Pair<V,V>> pairs, Set<Group<V>> groups)
      Checks all pairs if both views are contained in the same group, and if so removes the pair from the list - called from definePairs()
      Type Parameters:
      V - view id type
      Parameters:
      pairs - - the pairs, will me modified
      groups - - the groups
      Returns:
      - removed pairs
    • removeNonOverlappingPairs

      public static <V> ArrayList<net.imglib2.util.Pair<V,V>> removeNonOverlappingPairs(List<net.imglib2.util.Pair<V,V>> pairs, OverlapDetection<V> ovlp)
      Remove pairs that are not overlapping
      Type Parameters:
      V - view id type
      Parameters:
      pairs - - the pairs, will be modified
      ovlp - - implementation of OverlapDetection
      Returns:
      a list of pairs that were removed
    • reorderPairs

      public static <V extends Comparable<V>> void reorderPairs(List<net.imglib2.util.Pair<V,V>> pairs)
    • detectSubsets

      public static <V> ArrayList<Subset<V>> detectSubsets(List<V> views, List<net.imglib2.util.Pair<V,V>> pairs, Set<Group<V>> groups)
      Given a list of views, pairs of views that need to be compared, and groups - find subsets that are not overlapping
      Type Parameters:
      V - - view id type
      Parameters:
      views - - all views involved
      pairs - - all pairs that need to be compared
      groups - - all groups of views (transformed together)
      Returns:
      - the found subsets
    • setId

      protected static <V> int setId(V v, ArrayList<HashSet<V>> vSets)
    • findGroupsAssociatedWithSubset

      public static <V> HashSet<Group<V>> findGroupsAssociatedWithSubset(HashSet<V> setsViews, Set<Group<V>> groups)
    • subsetsLinkedByGroup

      public static <V> HashSet<Integer> subsetsLinkedByGroup(List<? extends Set<V>> vSets, Group<V> group)
      which subsets are part of a group - called by detectSubsets()
      Type Parameters:
      V - view id type
      Parameters:
      vSets - list of view sets
      group - a group of views
      Returns:
      set of indices of sets in vSets that contain a view of group
    • mergeSets

      public static <V> void mergeSets(ArrayList<HashSet<V>> vSets, ArrayList<ArrayList<net.imglib2.util.Pair<V,V>>> pairSets, int i1, int i2)
      Merge two sets with indices i1, i2
      Type Parameters:
      V - view id type
      Parameters:
      vSets - - subset precursors
      pairSets - - sets of pairs to compare
      i1 - - first index to merge
      i2 - - second index to merge
    • mergeSets

      public static <V> void mergeSets(ArrayList<HashSet<V>> vSets, ArrayList<ArrayList<net.imglib2.util.Pair<V,V>>> pairSets, Collection<Integer> mergeIndicies)
      Merge N sets with indices Note: This method collects all views and pairs from the sets being merged, removes the old sets from vSets and pairSets, and adds the merged set at the END. After this method completes, the merged set will be at index (pairSets.size() - 1).
      Type Parameters:
      V - view id type
      Parameters:
      vSets - - subset precursors
      pairSets - - sets of pairs to compare
      mergeIndicies - - indices to merge
    • sortSets

      public static <V> void sortSets(ArrayList<Subset<V>> subsets, Comparator<net.imglib2.util.Pair<V,V>> comp)
      Sorts each list using a given comparator, and then the lists according to their first element
      Type Parameters:
      V - viewId type
      Parameters:
      subsets - the subsets to be sorted
      comp - the comparator
    • main

      public static void main(String[] args)