@Test public void testGetHighResolutionCopy() throws Exception { final int rowCount = 3; final int columnCount = 4; final AffineWarpField warpField = new AffineWarpField(1000, 1000, rowCount, columnCount, AffineWarpField.getDefaultInterpolatorFactory()); for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++) { final double v = (row * columnCount) + column; warpField.set(row, column, new double[] {v, v, v, v, v, v}); } } final double[] originalValues = warpField.getValues(); int expectedNumberOfValues = rowCount * columnCount * 6; Assert.assertEquals("invalid number of original values", expectedNumberOfValues, originalValues.length); final int divideRowsBy = 3; final int divideColumnsBy = 3; final AffineWarpField hiResWarpField = warpField.getHighResolutionCopy(divideRowsBy, divideColumnsBy); final double[] hiResValues = hiResWarpField.getValues(); expectedNumberOfValues = rowCount * divideRowsBy * columnCount * divideColumnsBy * 6; Assert.assertEquals("invalid number of high resolution values", expectedNumberOfValues, hiResValues.length); final int originalRow = 1; final int originalColumn = 2; final double[] originalCellValues = warpField.get(originalRow, originalColumn); final int hiResRow = 4; final int hiResColumn = 6; final double[] hiResCellValues = hiResWarpField.get(hiResRow, hiResColumn); for (int i = 0; i < originalCellValues.length; i++) { Assert.assertEquals("invalid high resolution value for index " + i, originalCellValues[i], hiResCellValues[i], 0.0001); } }
public AffineWarpField getHighResolutionCopy(final int divideRowsBy, final int divideColumnsBy) { final int hiResRowCount = rowCount * divideRowsBy; final int hiResColumnCount = columnCount * divideColumnsBy; final int hiResAffineCount = hiResRowCount * hiResColumnCount; final double[] hiResValues = new double[hiResAffineCount * VALUES_PER_AFFINE]; final int affineCount = rowCount * columnCount; for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++ ) { final int startIndex = (row * columnCount) + column; final int hiResStartRow = row * divideRowsBy; final int hiResStartColumn = column * divideColumnsBy; for (int r = 0; r < divideRowsBy; r++) { final int hiResRow = hiResStartRow + r; for (int c = 0; c < divideColumnsBy; c++) { final int hiResColumn = hiResStartColumn + c; final int hiResStartIndex = (hiResRow * hiResColumnCount) + hiResColumn; for (int i = 0; i < VALUES_PER_AFFINE; i++) { final int valuesIndex = startIndex + (i * affineCount); final int hiResValuesIndex = hiResStartIndex + (i * hiResAffineCount); hiResValues[hiResValuesIndex] = values[valuesIndex]; } } } } } return new AffineWarpField(width, height, hiResRowCount, hiResColumnCount, hiResValues, interpolatorFactory); }
AffineWarpField implements Serializable { public AffineWarpField getHighResolutionCopy(final int divideRowsBy, final int divideColumnsBy) { final int hiResRowCount = rowCount * divideRowsBy; final int hiResColumnCount = columnCount * divideColumnsBy; final int hiResAffineCount = hiResRowCount * hiResColumnCount; final double[] hiResValues = new double[hiResAffineCount * VALUES_PER_AFFINE]; final int affineCount = rowCount * columnCount; for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++ ) { final int startIndex = (row * columnCount) + column; final int hiResStartRow = row * divideRowsBy; final int hiResStartColumn = column * divideColumnsBy; for (int r = 0; r < divideRowsBy; r++) { final int hiResRow = hiResStartRow + r; for (int c = 0; c < divideColumnsBy; c++) { final int hiResColumn = hiResStartColumn + c; final int hiResStartIndex = (hiResRow * hiResColumnCount) + hiResColumn; for (int i = 0; i < VALUES_PER_AFFINE; i++) { final int valuesIndex = startIndex + (i * affineCount); final int hiResValuesIndex = hiResStartIndex + (i * hiResAffineCount); hiResValues[hiResValuesIndex] = values[valuesIndex]; } } } } } return new AffineWarpField(width, height, hiResRowCount, hiResColumnCount, hiResValues, interpolatorFactory); } }
AffineWarpField implements Serializable { public AffineWarpField getHighResolutionCopy(final int divideRowsBy, final int divideColumnsBy) { final int hiResRowCount = rowCount * divideRowsBy; final int hiResColumnCount = columnCount * divideColumnsBy; final int hiResAffineCount = hiResRowCount * hiResColumnCount; final double[] hiResValues = new double[hiResAffineCount * VALUES_PER_AFFINE]; final int affineCount = rowCount * columnCount; for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++ ) { final int startIndex = (row * columnCount) + column; final int hiResStartRow = row * divideRowsBy; final int hiResStartColumn = column * divideColumnsBy; for (int r = 0; r < divideRowsBy; r++) { final int hiResRow = hiResStartRow + r; for (int c = 0; c < divideColumnsBy; c++) { final int hiResColumn = hiResStartColumn + c; final int hiResStartIndex = (hiResRow * hiResColumnCount) + hiResColumn; for (int i = 0; i < VALUES_PER_AFFINE; i++) { final int valuesIndex = startIndex + (i * affineCount); final int hiResValuesIndex = hiResStartIndex + (i * hiResAffineCount); hiResValues[hiResValuesIndex] = values[valuesIndex]; } } } } } return new AffineWarpField(width, height, hiResRowCount, hiResColumnCount, hiResValues, interpolatorFactory); } AffineWarpField();  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory);  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final double[] values,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory); }
AffineWarpField implements Serializable { public AffineWarpField getHighResolutionCopy(final int divideRowsBy, final int divideColumnsBy) { final int hiResRowCount = rowCount * divideRowsBy; final int hiResColumnCount = columnCount * divideColumnsBy; final int hiResAffineCount = hiResRowCount * hiResColumnCount; final double[] hiResValues = new double[hiResAffineCount * VALUES_PER_AFFINE]; final int affineCount = rowCount * columnCount; for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++ ) { final int startIndex = (row * columnCount) + column; final int hiResStartRow = row * divideRowsBy; final int hiResStartColumn = column * divideColumnsBy; for (int r = 0; r < divideRowsBy; r++) { final int hiResRow = hiResStartRow + r; for (int c = 0; c < divideColumnsBy; c++) { final int hiResColumn = hiResStartColumn + c; final int hiResStartIndex = (hiResRow * hiResColumnCount) + hiResColumn; for (int i = 0; i < VALUES_PER_AFFINE; i++) { final int valuesIndex = startIndex + (i * affineCount); final int hiResValuesIndex = hiResStartIndex + (i * hiResAffineCount); hiResValues[hiResValuesIndex] = values[valuesIndex]; } } } } } return new AffineWarpField(width, height, hiResRowCount, hiResColumnCount, hiResValues, interpolatorFactory); } AffineWarpField();  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory);  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final double[] values,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory); double getWidth(); double getHeight(); int getRowCount(); int getColumnCount(); double[] getValues(); InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> getInterpolatorFactory(); @Override String toString(); double getXScale(); double getYScale(); double[] get(final int row,
                        final int column); void set(final int row,
                    final int column,
                    final double[] affineMatrixElements); RealRandomAccess<RealComposite<DoubleType>> getAccessor(); AffineWarpField getCopy(); AffineWarpField getHighResolutionCopy(final int divideRowsBy,
                                                 final int divideColumnsBy); String toDebugJson(); static InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> getDefaultInterpolatorFactory(); static int getSize(final int rowCount,
                               final int columnCount); }
AffineWarpField implements Serializable { public AffineWarpField getHighResolutionCopy(final int divideRowsBy, final int divideColumnsBy) { final int hiResRowCount = rowCount * divideRowsBy; final int hiResColumnCount = columnCount * divideColumnsBy; final int hiResAffineCount = hiResRowCount * hiResColumnCount; final double[] hiResValues = new double[hiResAffineCount * VALUES_PER_AFFINE]; final int affineCount = rowCount * columnCount; for (int row = 0; row < rowCount; row++) { for (int column = 0; column < columnCount; column++ ) { final int startIndex = (row * columnCount) + column; final int hiResStartRow = row * divideRowsBy; final int hiResStartColumn = column * divideColumnsBy; for (int r = 0; r < divideRowsBy; r++) { final int hiResRow = hiResStartRow + r; for (int c = 0; c < divideColumnsBy; c++) { final int hiResColumn = hiResStartColumn + c; final int hiResStartIndex = (hiResRow * hiResColumnCount) + hiResColumn; for (int i = 0; i < VALUES_PER_AFFINE; i++) { final int valuesIndex = startIndex + (i * affineCount); final int hiResValuesIndex = hiResStartIndex + (i * hiResAffineCount); hiResValues[hiResValuesIndex] = values[valuesIndex]; } } } } } return new AffineWarpField(width, height, hiResRowCount, hiResColumnCount, hiResValues, interpolatorFactory); } AffineWarpField();  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory);  AffineWarpField(final double width,
                           final double height,
                           final int rowCount,
                           final int columnCount,
                           final double[] values,
                           final InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> interpolatorFactory); double getWidth(); double getHeight(); int getRowCount(); int getColumnCount(); double[] getValues(); InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> getInterpolatorFactory(); @Override String toString(); double getXScale(); double getYScale(); double[] get(final int row,
                        final int column); void set(final int row,
                    final int column,
                    final double[] affineMatrixElements); RealRandomAccess<RealComposite<DoubleType>> getAccessor(); AffineWarpField getCopy(); AffineWarpField getHighResolutionCopy(final int divideRowsBy,
                                                 final int divideColumnsBy); String toDebugJson(); static InterpolatorFactory<RealComposite<DoubleType>, RandomAccessible<RealComposite<DoubleType>>> getDefaultInterpolatorFactory(); static int getSize(final int rowCount,
                               final int columnCount);  }