metadata = service.createOMEXMLMetadata(); addSeries(tileWidth, tileLength); writer = new OmeroPixelsPyramidWriter(); writer.setMetadataRetrieve(metadata); writer.setCompression(compression); writer.setWriteSequentially(true); writer.setInterleaved(true); writer.setBigTiff(bigTiff); writer.setId(output);
/** * This method should never exit without releasing the lock. */ protected void closeWriter() throws IOException { try { if (writer != null) { writer.close(); writer = null; } } finally { try { if (writerFile != null) { try { FileUtils.moveFile(writerFile, readerFile); } finally { writerFile = null; } } } finally { releaseLock(); } } }
@Override public void close() throws IOException { log.debug("close(" + currentId + ")"); try { if (currentId != null) { postProcess(); } } catch (FormatException e) { String m = "Error during process processing!"; log.error(m, e); throw new IOException(m); } finally { super.close(); } }
/** * Performs re-compression post processing on the pixel pyramid. * @throws IOException * @throws FormatException */ protected void postProcess() throws IOException, FormatException { TiffReader reader = new TiffReader(); try { reader.setId(currentId); // First we want to re-compress resolution level 0 (the source series, // with resolution levels exposed, are in reverse order). recompressSeries(reader, 1); // Second we want to re-compress resolution level 1 (the source series, // with resolution levels exposed, are in reverse order). recompressSeries(reader, 2); } finally { reader.close(); } }
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); } }