Class PairwiseSetup<V extends Comparable<V>>
java.lang.Object
net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.PairwiseSetup<V>
- Direct Known Subclasses:
AllToAllRange
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPairwiseSetup(List<V> views) 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 -
Method Summary
Modifier and TypeMethodDescriptionGiven a list of views and their grouping, identify all pairs that need to be comparedprotected abstract List<net.imglib2.util.Pair<V, V>> abstract method called by the public definePairs methodvoidGiven a list of pairs of views that need to be compared, find subsets that are not overlappingdetectSubsets(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 overlappingfindGroupsAssociatedWithSubset(HashSet<V> setsViews, Set<Group<V>> groups) fixViewsInAllSubsets(List<V> fixedViews) Fix an additional list of views (removes them from pairs and subsets)Get a list of fixed views necessary for the specific strategy to workgetPairs()getViews()static voidstatic <V> voidmergeSets(ArrayList<HashSet<V>> vSets, ArrayList<ArrayList<net.imglib2.util.Pair<V, V>>> pairSets, int i1, int i2) Merge two sets with indices i1, i2static <V> voidmergeSets(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.removeNonExistentViewsInGroups(List<V> views, Set<Group<V>> groups) Remove all views in groups that do not exist in the views list - called from constructorstatic <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 overlappingRemove pairs that are not overlapping.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()voidReorder the pairs so that the "smaller" view comes firststatic <V extends Comparable<V>>
voidreorderPairs(List<net.imglib2.util.Pair<V, V>> pairs) protected static <V> intvoidsetPairs(List<net.imglib2.util.Pair<V, V>> pairs) Directly set the pairs list (used for optimized pair generation that bypasses definePairs()).static <V> voidsortSets(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 elementvoidSorts each subset by comparing the first view of each pair, and then all subsets according to their first pairsubsetsLinkedByGroup(List<? extends Set<V>> vSets, Group<V> group) which subsets are part of a group - called by detectSubsets()
-
Field Details
-
views
-
groups
-
pairs
-
subsets
-
-
Constructor Details
-
PairwiseSetup
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 includegroups- - view groups to include
-
PairwiseSetup
-
-
Method Details
-
getViews
-
getGroups
-
getPairs
-
getSubsets
-
setPairs
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
Given a list of views and their grouping, identify all pairs that need to be compared- Returns:
- - redundant pairs that were removed
-
definePairsAbstract
abstract method called by the public definePairs method- Returns:
- - the list of pairs
-
removeNonOverlappingPairs
Remove pairs that are not overlapping. Uses optimized parallel implementation for SimpleBoundingBoxOverlap with ViewId.- Parameters:
ovlp- - implementation ofOverlapDetection- 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
Get a list of fixed views necessary for the specific strategy to work- Returns:
- list of default fixed views
-
fixViewsInAllSubsets
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
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 keepgroups- 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 modifiedgroups- - 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 modifiedovlp- - implementation ofOverlapDetection- Returns:
- a list of pairs that were removed
-
reorderPairs
-
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 involvedpairs- - all pairs that need to be comparedgroups- - all groups of views (transformed together)- Returns:
- - the found subsets
-
setId
-
findGroupsAssociatedWithSubset
-
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 setsgroup- 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 precursorspairSets- - sets of pairs to comparei1- - first index to mergei2- - 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 precursorspairSets- - sets of pairs to comparemergeIndicies- - 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 sortedcomp- the comparator
-
main
-