Package loci.formats.out
Class OMETiffWriter
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatWriter
loci.formats.out.TiffWriter
loci.formats.out.OMETiffWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileWriter,IFormatHandler,IFormatWriter,IMetadataConfigurable,IPyramidHandler
- Direct Known Subclasses:
PyramidOMETiffWriter
OMETiffWriter is the file format writer for OME-TIFF files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprivate String[][]private OMEXMLMetadataprivate OMEXMLServiceprivate static final StringFields inherited from class loci.formats.out.TiffWriter
canDetectBigTiff, checkParams, COMPRESSION_J2K, COMPRESSION_J2K_LOSSY, COMPRESSION_JPEG, COMPRESSION_LZW, COMPRESSION_UNCOMPRESSED, COMPRESSION_ZLIB, in, isBigTiff, tiffSaver, tileSizeX, tileSizeYFields inherited from class loci.formats.FormatWriter
cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBitsFields inherited from class loci.formats.FormatHandler
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private StringgetBinaryOnlyOMEXML(String file, String companion, String companionUUID) Get the value of theCOMPANION_KEYoption.private Stringprivate StringGets the UUID corresponding to the given filename.private Stringprivate intprivate voidpopulateImage(OMEXMLMetadata omeMeta, int series) private voidpopulateTiffData(OMEXMLMetadata omeMeta, int[] zct, int ifd, int series, int plane) booleanGet the value of theCREATOR_KEYoption.voidsaveBytes(int no, byte[] buf, int x, int y, int w, int h) Saves the given image tile to the current series in the current file.voidSaves the given image to the specified series in the current file.private voidsaveComment(String file, String xml) voidsaveCompressedBytes(int no, byte[] buf, int x, int y, int w, int h) Save a compressed tile to the current output file.private voidsetCreator(ome.xml.meta.OMEXMLMetadataRoot root) Set the Creator attribute on the given OME-XML root object.voidInitializes a writer from the input file name.private voidMethods inherited from class loci.formats.out.TiffWriter
canDoStacks, createInputStream, createTiffSaver, getCodec, getPixelTypes, getPlaneCount, getTileSizeX, getTileSizeY, makeIFD, prepareToWriteImage, saveBytes, setBigTiff, setCanDetectBigTiff, setTileSizeX, setTileSizeY, setupTiffSaverMethods inherited from class loci.formats.FormatWriter
changeOutputFile, checkParams, createOutputStream, getCodecOptions, getColorModel, getCompression, getCompressionTypes, getFramesPerSecond, getMetadataRetrieve, getPixelTypes, getPlaneCount, getResolution, getResolutionCount, getResolutions, getSamplesPerPixel, getSamplesPerPixel, getSeries, getSizeX, getSizeY, hasResolutions, isFullPlane, isInterleaved, isSupportedType, saveBytes, saveBytes, savePlane, savePlane, savePlane, seekToPlaneOffset, setCodecOptions, setColorModel, setCompression, setFramesPerSecond, setInterleaved, setMetadataRetrieve, setResolution, setResolutions, setSeries, setValidBitsPerPixel, setWriteSequentiallyMethods inherited from class loci.formats.FormatHandler
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface loci.formats.IFormatHandler
getFormat, getNativeDataType, getSuffixes, isThisTypeMethods inherited from interface loci.formats.IMetadataConfigurable
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
-
Field Details
-
WARNING_COMMENT
- See Also:
-
COMPANION_KEY
- See Also:
-
CREATOR_KEY
- See Also:
-
imageLocations
-
omeMeta
-
service
-
ifdCounts
-
uuids
-
-
Constructor Details
-
OMETiffWriter
public OMETiffWriter()
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classTiffWriter- Throws:
IOException
-
saveCompressedBytes
public void saveCompressedBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException Description copied from interface:ICompressedTileWriterSave a compressed tile to the current output file. The compression type of the tile should match the compression type set in the writer.- Specified by:
saveCompressedBytesin interfaceICompressedTileWriter- Overrides:
saveCompressedBytesin classTiffWriter- Parameters:
no- plane indexbuf- compressed tile bytesx- pixel X coordinate of the upper-left corner of the tiley- pixel Y coordinate of the upper-left corner of the tilew- width in pixels of the compressed tileh- height in pixels of the compressed tile- Throws:
FormatExceptionIOException
-
saveBytes
public void saveBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException Description copied from interface:IFormatWriterSaves the given image tile to the current series in the current file.- Specified by:
saveBytesin interfaceIFormatWriter- Overrides:
saveBytesin classTiffWriter- Parameters:
no- the plane index within the series.buf- the byte array that represents the image tile.x- the X coordinate of the upper-left corner of the image tile.y- the Y coordinate of the upper-left corner of the image tile.w- the width (in pixels) of the image tile.h- the height (in pixels) of the image tile.- Throws:
FormatException- if one of the parameters is invalid.IOException- if there was a problem writing to the file.- See Also:
-
saveBytes
public void saveBytes(int no, byte[] buf, IFD ifd, int x, int y, int w, int h) throws FormatException, IOException Description copied from class:TiffWriterSaves the given image to the specified series in the current file. The IFD hashtable allows specification of TIFF parameters such as bit depth, compression and units. Use one IFD instance per plane.- Overrides:
saveBytesin classTiffWriter- Throws:
FormatExceptionIOException- See Also:
-
setId
Description copied from class:FormatWriterInitializes a writer from the input file name. Initializes aRandomAccessOutputStreamfor the output file and initializes the metadata for all the series usingFormatWriter.setSeries(int).- Specified by:
setIdin interfaceIFormatHandler- Overrides:
setIdin classTiffWriter- Parameters:
id- aStringspecifying the path to the file- Throws:
FormatExceptionIOException
-
getCompanion
Get the value of theCOMPANION_KEYoption.- Returns:
- path to the companion file, or null if a companion file is not used
-
preserveCreator
public boolean preserveCreator()Get the value of theCREATOR_KEYoption. This toggles whether or not the OME Creator attribute will be overwritten with the current Bio-Formats version. For input data that does not have a Creator attribute defined, this makes no difference. By default, returns false, i.e. the Creator will be overwritten if it exists.- Returns:
- true if the Creator attribute should be preserved (if it exists)
-
getUUID
Gets the UUID corresponding to the given filename. -
setupServiceAndMetadata
private void setupServiceAndMetadata() throws loci.common.services.DependencyException, loci.common.services.ServiceException- Throws:
loci.common.services.DependencyExceptionloci.common.services.ServiceException
-
insertWarningComment
-
getOMEXML
- Throws:
FormatExceptionIOException
-
getBinaryOnlyOMEXML
private String getBinaryOnlyOMEXML(String file, String companion, String companionUUID) throws FormatException, IOException, loci.common.services.DependencyException, loci.common.services.ServiceException - Throws:
FormatExceptionIOExceptionloci.common.services.DependencyExceptionloci.common.services.ServiceException
-
setCreator
private void setCreator(ome.xml.meta.OMEXMLMetadataRoot root) Set the Creator attribute on the given OME-XML root object. If the Creator was not previously set, it will be set to the current Bio-Formats version. If the Creator has been set already, theCREATOR_KEYoption (viapreserveCreator()) is used to determine whether to overwrite the existing value with the Bio-Formats version.- Parameters:
root- OME-XML root object
-
saveComment
- Throws:
IOException
-
populateTiffData
-
populateImage
-
planeCount
private int planeCount()
-