Skip to content

Commit

Permalink
improve validate halo method
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 21, 2024
1 parent 24419d2 commit a1e2724
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main/java/io/bioimage/modelrunner/tiling/TileCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,28 @@ private void getOutputTiles() {
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
}
outputTileInfo.add(TileInfo.build(tt.getTensorID(), imagSize, outAxesOrder, tileSize, outAxesOrder));
}
outputTileInfo.add(TileInfo.build(tt.getTensorID(), imagSize, outAxesOrder, tileSize, outAxesOrder));
}
}

private void validateTileVsHalo() {
for (TileInfo tile : this.outputTileInfo) {
TensorSpec tt = this.descriptor.findOutputTensor(tile.getName());
for (Axis ax : tt.getAxesInfo().getAxesList()) {
int ind = tile.getImageAxesOrder().indexOf(ax.getAxis());
if (tile.getProposedTileDimensions()[ind] - ax.getHalo() * 2 <= 0)
throw new IllegalArgumentException("Input size too small, halo would be bigger than "
+ "the image accross dimension '" + ax.getAxis() + "'. Toal halo = " + ax.getHalo() * 2
+ ", image size = " + tile.getProposedTileDimensions()[ind] + ".");
}
}
}

/**
* TODO remove
*/
private void validateTileVsHalo2() {
for (TensorSpec tt : this.descriptor.getOutputTensors()) {
for (Axis ax : tt.getAxesInfo().getAxesList()) {
String ref = ax.getReferenceTensor();
Expand All @@ -150,7 +166,6 @@ private void validateTileVsHalo() {
+ ", image size = " + outSize + ".");
}
}

}

private void validateStepMin() {
Expand Down

0 comments on commit a1e2724

Please sign in to comment.