Skip to content

Commit

Permalink
fix s5 dataset name for typical run
Browse files Browse the repository at this point in the history
  • Loading branch information
trautmane committed May 6, 2024
1 parent 5f8fdff commit da67786
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

import java.io.IOException;
import java.io.Serializable;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -214,10 +217,23 @@ public static void computeCost(

final int outOfBoundsValue;
if (options.outOfBoundsValue == null) {
final String downsampledDataset = n5.groupPath(options.inputDatasetName, "s5");
final IterableInterval<UnsignedByteType> lastLayer = getLastLayer(n5, downsampledDataset);
outOfBoundsValue = median(lastLayer);
System.out.println("Out of bounds value automatically computed to be " + outOfBoundsValue);

final String s5DatasetName;
if (options.inputDatasetName.endsWith("s0")) {
s5DatasetName = options.inputDatasetName.replaceFirst("s0$", "s5");
} else {
s5DatasetName = options.inputDatasetName + "/s5";
}

final Path s5Path = Paths.get(options.n5Path, s5DatasetName);
if (Files.exists(s5Path)) {
final IterableInterval<UnsignedByteType> lastLayer = getLastLayer(n5, s5DatasetName);
outOfBoundsValue = median(lastLayer);
System.out.println("Out of bounds value automatically computed to be " + outOfBoundsValue);
} else {
throw new RuntimeException("Cannot compute out of bounds value automatically because " + s5Path + " does not exist.");
}

} else {
outOfBoundsValue = options.outOfBoundsValue;
}
Expand Down

0 comments on commit da67786

Please sign in to comment.