@Test public void testAddImage() throws Exception { final Bounds layerBounds = new Bounds(47678.0, 16044.0, 3457.0, 253506.0, 121939.0, 3457.0); final int boxHeight = 8192; final int boxWidth = 8192; final SectionBoxBounds boxBounds = new SectionBoxBounds(3457.0, 8192, 8192, layerBounds); final IGridPaths iGridPaths = new IGridPaths(boxBounds.getNumberOfRows(), boxBounds.getNumberOfColumns()); int row = boxBounds.getFirstRow(); int column; for (int y = boxBounds.getFirstY(); y <= boxBounds.getLastY(); y += boxHeight) { column = boxBounds.getFirstColumn(); for (int x = boxBounds.getFirstX(); x <= boxBounds.getLastX(); x += boxWidth) { iGridPaths.addImage(new File("/tmp/" + row + "/" + column + ".png"), row, column); column++; } row++; } validateSave(iGridPaths, boxBounds.getNumberOfRows(), boxBounds.getNumberOfColumns()); }
public void addImage(final File imageFile, final int row, final int column) throws IllegalArgumentException { if ((row < 0) || (row >= numberOfRows)) { throw new IllegalArgumentException("invalid row (" + row + ") specified for " + imageFile.getAbsolutePath() + ", row values must be between 0 and " + (numberOfRows - 1)); } if ((column < 0) || (column >= numberOfColumns)) { throw new IllegalArgumentException("invalid column (" + column + ") specified for " + imageFile.getAbsolutePath() + ", column values must be between 0 and " + (numberOfColumns - 1)); } final int index = (row * numberOfColumns) + column; for (int i = pathList.size(); i < index; i++) { pathList.add(null); } pathList.add(imageFile.getAbsolutePath()); }
IGridPaths { public void addImage(final File imageFile, final int row, final int column) throws IllegalArgumentException { if ((row < 0) || (row >= numberOfRows)) { throw new IllegalArgumentException("invalid row (" + row + ") specified for " + imageFile.getAbsolutePath() + ", row values must be between 0 and " + (numberOfRows - 1)); } if ((column < 0) || (column >= numberOfColumns)) { throw new IllegalArgumentException("invalid column (" + column + ") specified for " + imageFile.getAbsolutePath() + ", column values must be between 0 and " + (numberOfColumns - 1)); } final int index = (row * numberOfColumns) + column; for (int i = pathList.size(); i < index; i++) { pathList.add(null); } pathList.add(imageFile.getAbsolutePath()); } }
IGridPaths { public void addImage(final File imageFile, final int row, final int column) throws IllegalArgumentException { if ((row < 0) || (row >= numberOfRows)) { throw new IllegalArgumentException("invalid row (" + row + ") specified for " + imageFile.getAbsolutePath() + ", row values must be between 0 and " + (numberOfRows - 1)); } if ((column < 0) || (column >= numberOfColumns)) { throw new IllegalArgumentException("invalid column (" + column + ") specified for " + imageFile.getAbsolutePath() + ", column values must be between 0 and " + (numberOfColumns - 1)); } final int index = (row * numberOfColumns) + column; for (int i = pathList.size(); i < index; i++) { pathList.add(null); } pathList.add(imageFile.getAbsolutePath()); } IGridPaths(final int numberOfRows,
                      final int numberOfColumns); }
IGridPaths { public void addImage(final File imageFile, final int row, final int column) throws IllegalArgumentException { if ((row < 0) || (row >= numberOfRows)) { throw new IllegalArgumentException("invalid row (" + row + ") specified for " + imageFile.getAbsolutePath() + ", row values must be between 0 and " + (numberOfRows - 1)); } if ((column < 0) || (column >= numberOfColumns)) { throw new IllegalArgumentException("invalid column (" + column + ") specified for " + imageFile.getAbsolutePath() + ", column values must be between 0 and " + (numberOfColumns - 1)); } final int index = (row * numberOfColumns) + column; for (int i = pathList.size(); i < index; i++) { pathList.add(null); } pathList.add(imageFile.getAbsolutePath()); } IGridPaths(final int numberOfRows,
                      final int numberOfColumns); void addImage(final File imageFile,
                         final int row,
                         final int column); void addBoxes(final String baseBoxPath,
                         final String pathSuffix,
                         final List<BoxData> boxes); File saveToFile(final File parentDirectory,
                           final Double z,
                           final File emptyImage); }
IGridPaths { public void addImage(final File imageFile, final int row, final int column) throws IllegalArgumentException { if ((row < 0) || (row >= numberOfRows)) { throw new IllegalArgumentException("invalid row (" + row + ") specified for " + imageFile.getAbsolutePath() + ", row values must be between 0 and " + (numberOfRows - 1)); } if ((column < 0) || (column >= numberOfColumns)) { throw new IllegalArgumentException("invalid column (" + column + ") specified for " + imageFile.getAbsolutePath() + ", column values must be between 0 and " + (numberOfColumns - 1)); } final int index = (row * numberOfColumns) + column; for (int i = pathList.size(); i < index; i++) { pathList.add(null); } pathList.add(imageFile.getAbsolutePath()); } IGridPaths(final int numberOfRows,
                      final int numberOfColumns); void addImage(final File imageFile,
                         final int row,
                         final int column); void addBoxes(final String baseBoxPath,
                         final String pathSuffix,
                         final List<BoxData> boxes); File saveToFile(final File parentDirectory,
                           final Double z,
                           final File emptyImage);  }