/** * Helper method to properly log any exceptions raised by Bio-Formats and * add a min/max calculator wrapper to the reader stack. * @param filePath Non-null. * @param series series to use * @param store Min/max store to use with the min/max calculator. */ protected BfPixelBuffer createMinMaxBfPixelBuffer(final String filePath, final int series, final IMinMaxStore store) { try { IFormatReader reader = createBfReader(); MinMaxCalculator calculator = new MinMaxCalculator(reader); calculator.setMinMaxStore(store); BfPixelBuffer pixelBuffer = new BfPixelBuffer(filePath, calculator); pixelBuffer.setSeries(series); log.info(String.format("Creating BfPixelBuffer: %s Series: %d", filePath, series)); return pixelBuffer; } catch (Exception e) { String msg = "Error instantiating pixel buffer: " + filePath; log.error(msg, e); throw new ResourceError(msg); } }
@BeforeMethod public void setUp() throws Exception { fullPlaneCallIndex = 1; Location.mapId(TEST_FILE, TEST_FILE); reader = new MinMaxCalculatorTestReader(); reader.setId(TEST_FILE); minMaxStore = new TestMinMaxStore(); minMaxCalculator = new MinMaxCalculator(reader); minMaxCalculator.setMinMaxStore(minMaxStore); sizeX = reader.getSizeX(); sizeY = reader.getSizeY(); bpp = FormatTools.getBytesPerPixel(reader.getPixelType()); planeSize = sizeY * sizeY * bpp; }