private BfPixelBuffer delegate() { if (isWrite()) { try { closeWriter(); try { initializeReader(); } catch (FormatException e) { throw new RuntimeException(e); } } catch (IOException e1) { throw new RuntimeException(e1); } } else if (delegate == null) { try { initializeReader(); } catch (IOException e) { throw new RuntimeException(e); } catch (FormatException e) { throw new RuntimeException(e); } } return delegate; }
public synchronized void setResolutionLevel(int resolutionLevel) { if (isWrite()) { throw new ApiUsageException("In write mode!"); } delegate().setResolutionLevel(resolutionLevel); } }
public synchronized int getResolutionLevels() { if (isWrite()) { throw new ApiUsageException("In write mode!"); } return delegate().getResolutionLevels(); }
public synchronized int getResolutionLevel() { if (isWrite()) { throw new ApiUsageException("In write mode!"); } return delegate().getResolutionLevel(); }
public synchronized List<List<Integer>> getResolutionDescriptions() { if (isWrite()) { throw new ApiUsageException("In write mode!"); } return delegate().getResolutionDescriptions(); }
public synchronized Dimension getTileSize() { if (isWrite()) { return new Dimension(sizes.getTileWidth(), sizes.getTileHeight()); } return delegate().getTileSize(); }
public synchronized void setTile(byte[] buffer, Integer z, Integer c, Integer t, Integer x, Integer y, Integer w, Integer h) throws IOException, BufferOverflowException { if (!isWrite()) { throw new ApiUsageException("In read-only mode!"); } try { int planeCount = getSizeZ() * getSizeC() * getSizeT(); int planeNumber = FormatTools.getIndex( "XYZCT", getSizeZ(), getSizeC(), getSizeT(), planeCount, z, c, t); IFD ifd = getIFD(z, c, t, w, h); if (log.isDebugEnabled()) { log.debug(String.format( "Writing tile planeNumber:%d bufferSize:%d ifd:%s " + "x:%d y:%d w:%d h:%d", planeNumber, buffer.length, ifd.toString(), x, y, w, h)); } writer.saveBytes(planeNumber, buffer, ifd, x, y, w, h); } catch (FormatException e) { throw new RuntimeException(e); } }