Skip to content

Commit

Permalink
correct bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 24, 2024
1 parent d58b82e commit 959c1fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class AxisSize {

private int min = 1;
private int min = 0;
private int step = 0;
private double offset = 0;
private String axisID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AxisV05 implements Axis{
private List<String> channelNames;
private final String abreviation;
private boolean concat = false;
private double scale = 1.0;
private double scale = -1.0;
private AxisSize size;
protected int halo = 0;

Expand Down
26 changes: 4 additions & 22 deletions src/main/java/io/bioimage/modelrunner/tiling/TileMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void getOutputTiles() {
+ "Model specs too complex for JDLL. "
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
} else if (ax.getStep() == 0 && ax.getReferenceTensor() == null) {
} else if (ax.getStep() == 0 && ax.getMin() != 0 && ax.getReferenceTensor() == null) {
TensorSpec intt = descriptor.getInputTensors().stream()
.filter(t -> t.isImage()).findFirst().orElse(null);
TileInfo inTile = inputTileInfo.stream()
Expand All @@ -92,31 +92,13 @@ private void getOutputTiles() {
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
imagSize[i] = (long) (ax.getMin() * factor);
tileSize[i] = (long) (ax.getMin() * factor);
} else if (ax.getStep() == 0) {
TileInfo inTile = inputTileInfo.stream()
.filter(t -> t.getName().equals(ax.getReferenceTensor())).findFirst().orElse(null);
int indTile = inTile.getTileAxesOrder().indexOf(ax.getReferenceAxis());
int indIm = inTile.getImageAxesOrder().indexOf(ax.getReferenceAxis());
if (indTile == -1 || indIm == -1)
throw new IllegalArgumentException(""
+ "Model specs too complex for JDLL. "
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
double factor = (double) inTile.getImageDims()[indIm] / inTile.getTileDims()[indTile];
if (Math.floor(ax.getMin() * factor) != ax.getMin() * factor)
throw new IllegalArgumentException(""
+ "Model specs too complex for JDLL. "
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
imagSize[i] = (long) (ax.getMin() * factor);
tileSize[i] = (long) (ax.getMin() * factor);
tileSize[i] = (long) (ax.getMin());
} else if (ax.getReferenceTensor() == null) {
throw new IllegalArgumentException(""
+ "Model specs too complex for JDLL. "
+ "Please contact the team and create and issue attaching the rdf.yaml file"
+ " so we can troubleshoot at: " + Constants.ISSUES_LINK);
} else if (ax.getStep() != 0) {
} else if (ax.getReferenceTensor() != null) {
TileInfo inTile = inputTileInfo.stream()
.filter(t -> t.getName().equals(ax.getReferenceTensor())).findFirst().orElse(null);
int indTile = inTile.getTileAxesOrder().indexOf(ax.getReferenceAxis());
Expand Down Expand Up @@ -191,7 +173,7 @@ private void validateStepMin() {
if (tileDims[i] != min[i] && step[i] == 0)
throw new IllegalArgumentException("Invalid tile size for axis '" + axesTile.split("")[i].toUpperCase()
+ "'. Only allowed tile size for this axis is: " + min[i]);
else if ((tileDims[i] - min[i]) % step[i] != 0)
else if (step[i] != 0 && (tileDims[i] - min[i]) % step[i] != 0)
throw new IllegalArgumentException("Invalid tile size for axis '" + axesTile.split("")[i].toUpperCase()
+ "'. Tile size for this axis should satisfy: " + min[i] + " + n x " + step[i]
+ " where n can be any positive integer.");
Expand Down

0 comments on commit 959c1fa

Please sign in to comment.