Skip to content

Commit 65fd60e

Browse files
committed
option to reset prev grad scores
1 parent fce2675 commit 65fd60e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/CDMatchEntity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ public void updateNormalizedScore(Float score) {
103103
this.normalizedScore = score;
104104
}
105105

106+
public void resetGradientScores() {
107+
this.gradientAreaGap = null;
108+
this.highExpressionArea = null;
109+
this.bidirectionalAreaGap = null;
110+
this.normalizedScore = null;
111+
}
112+
106113
@JsonIgnore
107114
public boolean isMatchFound() {
108115
return matchFound;

colormipsearch-tools/src/main/java/org/janelia/colormipsearch/cmd/CalculateGradientScoresCmd.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ static class CalculateGradientScoresArgs extends AbstractGradientScoresArgs {
9191
arity = 0)
9292
boolean useBidirectionalMatching = false;
9393

94+
@Parameter(names = {"--cancel-previous-gradient-scores"},
95+
description = "Cancel existing gradient scores before calculating new ones",
96+
arity = 0)
97+
boolean cancelExistingGradientScores = false;
98+
9499
CalculateGradientScoresArgs(CommonArgs commonArgs) {
95100
super(commonArgs);
96101
}
@@ -344,8 +349,14 @@ List<GroupedItems<M, CDMatchEntity<M, T>>> getCDMatchesForMaskMipID(NeuronMatche
344349
/*from*/0,
345350
/*nRecords*/-1,
346351
/*readPageSize*/0);
347-
LOG.debug("Found {} color depth matches for {} in {}ms - start selecting best matches",
352+
LOG.debug("Found {} color depth matches for {} in {}ms",
348353
allCDMatches.size(), maskCDMipId, System.currentTimeMillis() - startTime);
354+
if (args.cancelExistingGradientScores) {
355+
allCDMatches.forEach(CDMatchEntity::resetGradientScores);
356+
long nScoresUpdated = updateCDMatches(allCDMatches);
357+
LOG.debug("Reset gradient {} scores for {} matches for {} in {}ms",
358+
nScoresUpdated, allCDMatches.size(), maskCDMipId, System.currentTimeMillis() - startTime);
359+
}
349360
// select best matches to process
350361
List<CDMatchEntity<M, T>> bestMatches = ColorMIPProcessUtils.selectBestMatches(
351362
allCDMatches,

0 commit comments

Comments
 (0)