@Override public byte[] openBytes(int no, byte[] buf) throws FormatException, IOException { return openBytes(no, buf, 0, 0, getSizeX(), getSizeY()); }
@Override public byte[] openBytes(int no, byte[] buf) throws FormatException, IOException { return openBytes(no, buf, 0, 0, getSizeX(), getSizeY()); }
@Override public byte[] openBytes(int no) throws FormatException, IOException { return openBytes(no, 0, 0, getSizeX(), getSizeY()); }
@Override public byte[] openBytes(int no) throws FormatException, IOException { return openBytes(no, 0, 0, getSizeX(), getSizeY()); }
@Test public void testValidMinMaxFirstHalf() throws Exception { byte[] buf = new byte[planeSize / 2]; int halfway = sizeY / 2; minMaxCalculator.openBytes(0, buf, 0, 0, sizeX, halfway); assertMinMax(-1.0, 1.0); }
@Test public void testValidMinMaxNoOutOfBufferInspection() throws Exception { byte[] buf = new byte[planeSize * 2]; buf[buf.length - 1] = 120; // This should not be calculated against minMaxCalculator.openBytes(0, buf, 0, 0, sizeX, sizeY); assertMinMax(-2.0, 101.0); }
@Test public void testValidMinMax() throws Exception { minMaxCalculator.openBytes(0); assertMinMax(-2.0, 101.0); }
@Override public byte[] openBytes(int no, int x, int y, int w, int h) throws FormatException, IOException { byte[] buf = new byte[w * h * getRGBChannelCount() * FormatTools.getBytesPerPixel(getPixelType())]; return openBytes(no, buf, x, y, w, h); }
@Test public void testValidMinMaxSecondHalf() throws Exception { byte[] buf = new byte[planeSize / 2]; int halfway = sizeY / 2; minMaxCalculator.openBytes(0, buf, 0, halfway, sizeX, halfway); assertMinMax(-2.0, 2.0); }
@Override public byte[] openBytes(int no, int x, int y, int w, int h) throws FormatException, IOException { byte[] buf = new byte[w * h * getRGBChannelCount() * FormatTools.getBytesPerPixel(getPixelType())]; return openBytes(no, buf, x, y, w, h); }
/** * Checks that the min and max values for each core index do not change * when the resolutions are unflattened. */ @Test public void testMultipleResolutions() throws Exception { minMaxCalculator.setCoreIndex(0); minMaxCalculator.openBytes(0); assertMinMax(-2.0, 101.0); minMaxCalculator.setCoreIndex(1); minMaxCalculator.openBytes(0); assertMinMax(-1.0, 102.0); MinMaxCalculator unflattened = new MinMaxCalculator(new MinMaxCalculatorTestReader()); try { unflattened.setFlattenedResolutions(false); unflattened.setId(TEST_FILE); unflattened.setCoreIndex(0); unflattened.openBytes(0); assertEquals(-2.0, unflattened.getPlaneMinimum(0)[0]); assertEquals(103.0, unflattened.getPlaneMaximum(0)[0]); unflattened.setCoreIndex(1); unflattened.openBytes(0); assertEquals(-1.0, unflattened.getPlaneMinimum(0)[0]); assertEquals(104.0, unflattened.getPlaneMaximum(0)[0]); } finally { unflattened.close(); } }