Skip to content

Commit

Permalink
correct more small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 24, 2024
1 parent 959c1fa commit 160dfb5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/io/bioimage/modelrunner/tiling/TileMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,30 +435,30 @@ public List<long[]> getTilePostionsOutputImage(String tensorID) {
}

public <T extends NativeType<T> & RealType<T>> RandomAccessibleInterval<T> getNthTileInput(String tensorID, RandomAccessibleInterval<T> rai, int n) {
List<long[]> tiles = this.getTilePostionsOutputImage(tensorID);
if (tiles.size() >= n) {
List<long[]> tiles = this.getTilePostionsInputImage(tensorID);
if (tiles.size() <= n) {
throw new IllegalArgumentException("There are only " + tiles.size() + " tiles. Tile " + n
+ " is out of bounds.");
}
long[] minLim = tiles.get(n);
long[] size = this.getInputTileSize(tensorID);
long[] maxLim = new long[size.length];
for (int i = 0; i < size.length; i ++) maxLim[i] = minLim[i] + maxLim[i] - 1;
for (int i = 0; i < size.length; i ++) maxLim[i] = minLim[i] + size[i] - 1;
RandomAccessibleInterval<T> tileRai = Views.interval(
Views.extendMirrorDouble(rai), new FinalInterval( minLim, maxLim ));
return tileRai;
}

public <T extends NativeType<T> & RealType<T>> RandomAccessibleInterval<T> getNthTileOutput(String tensorID, RandomAccessibleInterval<T> rai, int n) {
List<long[]> tiles = this.getTilePostionsOutputImage(tensorID);
if (tiles.size() >= n) {
if (tiles.size() <= n) {
throw new IllegalArgumentException("There are only " + tiles.size() + " tiles. Tile " + n
+ " is out of bounds.");
}
long[] minLim = tiles.get(n);
long[] size = this.getOutputTileSize(tensorID);
long[] maxLim = new long[size.length];
for (int i = 0; i < size.length; i ++) maxLim[i] = minLim[i] + maxLim[i] - 1;
for (int i = 0; i < size.length; i ++) maxLim[i] = minLim[i] + size[i] - 1;
RandomAccessibleInterval<T> tileRai = Views.interval(
Views.extendMirrorDouble(rai), new FinalInterval( minLim, maxLim ));
return tileRai;
Expand Down

0 comments on commit 160dfb5

Please sign in to comment.