public class TiffWriter extends FormatWriter
| Modifier and Type | Field and Description |
|---|---|
private static long |
BIG_TIFF_CUTOFF
Number of bytes at which to automatically switch to BigTIFF
This is approximately 3.9 GB instead of 4 GB,
to allow space for the IFDs.
|
private static java.lang.String[] |
BIG_TIFF_SUFFIXES |
protected boolean |
checkParams
Whether or not to check the parameters passed to saveBytes.
|
static java.lang.String |
COMPRESSION_J2K |
static java.lang.String |
COMPRESSION_J2K_LOSSY |
static java.lang.String |
COMPRESSION_JPEG |
static java.lang.String |
COMPRESSION_LZW |
static java.lang.String |
COMPRESSION_UNCOMPRESSED |
static java.lang.String |
COMPRESSION_ZLIB |
protected loci.common.RandomAccessInputStream |
in
Input stream to use when overwriting data.
|
protected boolean |
isBigTiff
Whether or not the output file is a BigTIFF file.
|
protected TiffSaver |
tiffSaver
The TiffSaver that will do most of the writing.
|
private static int |
TILE_GRANULARITY
TIFF tiles must be of a height and width divisible by 16.
|
protected int |
tileSizeX
The tile width which will be used for writing.
|
protected int |
tileSizeY
The tile height which will be used for writing.
|
cm, compression, compressionTypes, fps, initialized, interleaved, metadataRetrieve, options, out, resolution, resolutionData, sequential, series, validBitsCOMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes| Constructor and Description |
|---|
TiffWriter() |
TiffWriter(java.lang.String format,
java.lang.String[] exts) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDoStacks()
Reports whether the writer can save multiple images to a single file.
|
void |
close() |
protected loci.common.RandomAccessInputStream |
createInputStream() |
protected TiffSaver |
createTiffSaver() |
private void |
formatCompression(IFD ifd)
Sets the compression code for the specified IFD.
|
int[] |
getPixelTypes(java.lang.String codec)
Gets the supported pixel types for the given codec.
|
int |
getPlaneCount()
Retrieve the total number of planes in the current series.
|
private byte[] |
getTile(byte[] buf,
loci.common.Region tileParams,
loci.common.Region srcParams) |
int |
getTileSizeX()
Retrieves the current tile width
Defaults to 0 if not supported
|
int |
getTileSizeY()
Retrieves the current tile height
Defaults to 0 if not supported
|
protected int |
prepareToWriteImage(int no,
byte[] buf,
IFD ifd,
int x,
int y,
int w,
int h)
Performs the preparation for work prior to the usage of the TIFF saver.
|
void |
saveBytes(int no,
byte[] buf,
IFD ifd)
Saves the given image to the specified (possibly already open) file.
|
void |
saveBytes(int no,
byte[] buf,
IFD ifd,
int x,
int y,
int w,
int h)
Saves the given image to the specified series in the current file.
|
void |
saveBytes(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.
|
void |
setBigTiff(boolean bigTiff)
Sets whether or not BigTIFF files should be written.
|
void |
setId(java.lang.String id)
Initializes a writer from the input file name.
|
int |
setTileSizeX(int tileSize)
Will attempt to set the tile width to the desired value and return the actual value which will be used
|
int |
setTileSizeY(int tileSize)
Will attempt to set the tile height to the desired value and return the actual value which will be used
|
protected void |
setupTiffSaver() |
changeOutputFile, checkParams, createOutputStream, 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, setWriteSequentiallycheckSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFormat, getNativeDataType, getSuffixes, isThisTypegetMetadataOptions, getSupportedMetadataLevels, setMetadataOptionspublic static final java.lang.String COMPRESSION_UNCOMPRESSED
public static final java.lang.String COMPRESSION_LZW
public static final java.lang.String COMPRESSION_J2K
public static final java.lang.String COMPRESSION_J2K_LOSSY
public static final java.lang.String COMPRESSION_JPEG
public static final java.lang.String COMPRESSION_ZLIB
private static final java.lang.String[] BIG_TIFF_SUFFIXES
private static final long BIG_TIFF_CUTOFF
private static final int TILE_GRANULARITY
protected boolean isBigTiff
protected TiffSaver tiffSaver
protected loci.common.RandomAccessInputStream in
protected boolean checkParams
protected int tileSizeX
protected int tileSizeY
public TiffWriter()
public TiffWriter(java.lang.String format,
java.lang.String[] exts)
private void formatCompression(IFD ifd) throws FormatException
ifd - The IFD table to handle.FormatExceptionpublic void setId(java.lang.String id)
throws FormatException,
java.io.IOException
FormatWriterRandomAccessOutputStream for the output
file and initializes the metadata for all the series using
FormatWriter.setSeries(int).setId in interface IFormatHandlersetId in class FormatWriterid - a String specifying the path to the fileFormatExceptionjava.io.IOExceptionpublic void saveBytes(int no,
byte[] buf,
IFD ifd)
throws java.io.IOException,
FormatException
java.io.IOExceptionFormatExceptionpublic void saveBytes(int no,
byte[] buf,
IFD ifd,
int x,
int y,
int w,
int h)
throws java.io.IOException,
FormatException
java.io.IOExceptionFormatExceptionprotected int prepareToWriteImage(int no,
byte[] buf,
IFD ifd,
int x,
int y,
int w,
int h)
throws java.io.IOException,
FormatException
saveBytes() in an attempt to
ensure thread safety.java.io.IOExceptionFormatExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class FormatWriterjava.io.IOExceptionpublic int getPlaneCount()
FormatWritergetPlaneCount in class FormatWriterpublic void saveBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
throws FormatException,
java.io.IOException
IFormatWriterno - the image index within the current file, starting from 0.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.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.IFormatWriter.saveBytes(int, byte[], int, int, int, int)public boolean canDoStacks()
IFormatWritercanDoStacks in interface IFormatWritercanDoStacks in class FormatWriterpublic int[] getPixelTypes(java.lang.String codec)
IFormatWritergetPixelTypes in interface IFormatWritergetPixelTypes in class FormatWriterpublic void setBigTiff(boolean bigTiff)
protected void setupTiffSaver()
throws java.io.IOException
java.io.IOExceptionpublic int getTileSizeX()
throws FormatException
IFormatWritergetTileSizeX in interface IFormatWritergetTileSizeX in class FormatWriterFormatException - Image metadata including Pixels Size X must be set prior to calling getTileSizeX()public int setTileSizeX(int tileSize)
throws FormatException
IFormatWritersetTileSizeX in interface IFormatWritersetTileSizeX in class FormatWritertileSize - The tile width you wish to use. Setting to 0 will disable tilingFormatException - Tile size must be greater than or equal to 0 and less than the image widthpublic int getTileSizeY()
throws FormatException
IFormatWritergetTileSizeY in interface IFormatWritergetTileSizeY in class FormatWriterFormatException - Image metadata including Pixels Size Y must be set prior to calling getTileSizeY()public int setTileSizeY(int tileSize)
throws FormatException
IFormatWritersetTileSizeY in interface IFormatWritersetTileSizeY in class FormatWritertileSize - The tile height you wish to use. Setting to 0 will disable tilingFormatException - Tile size must be greater than or equal to 0 and less than the image heightprivate byte[] getTile(byte[] buf,
loci.common.Region tileParams,
loci.common.Region srcParams)
protected loci.common.RandomAccessInputStream createInputStream()
throws java.io.IOException
java.io.IOExceptionprotected TiffSaver createTiffSaver()
Copyright © 2019 Open Microscopy Environment