public class TiffSaver extends Object
Modifier and Type | Field and Description |
---|---|
protected ByteArrayHandle |
bytes
Output bytes.
|
protected String |
filename
Output filename.
|
protected RandomAccessOutputStream |
out
Output stream to use when saving TIFF data.
|
Constructor and Description |
---|
TiffSaver(RandomAccessOutputStream out,
ByteArrayHandle bytes)
Constructs a new TIFF saver from the given output source.
|
TiffSaver(RandomAccessOutputStream out,
String filename)
Constructs a new TIFF saver from the given output source.
|
TiffSaver(String filename)
Constructs a new TIFF saver from the given filename.
|
Modifier and Type | Method and Description |
---|---|
RandomAccessOutputStream |
getStream()
Gets the stream from which TIFF data is being saved.
|
boolean |
isBigTiff()
Returns whether or not we are writing BigTIFF data.
|
boolean |
isLittleEndian()
Returns whether or not we are writing little-endian data.
|
void |
overwriteComment(RandomAccessInputStream in,
Object value)
Convenience method for overwriting a file's first ImageDescription.
|
void |
overwriteIFDValue(RandomAccessInputStream raf,
int ifd,
int tag,
Object value)
Surgically overwrites an existing IFD value with the given one.
|
void |
overwriteLastIFDOffset(RandomAccessInputStream raf) |
void |
setBigTiff(boolean bigTiff)
Sets whether or not BigTIFF data should be written.
|
void |
setCodecOptions(CodecOptions options)
Sets the codec options.
|
void |
setLittleEndian(boolean littleEndian)
Sets whether or not little-endian data should be written.
|
void |
setWritingSequentially(boolean sequential)
Sets whether or not we know that the planes will be written sequentially.
|
void |
writeHeader()
Writes the TIFF file header.
|
void |
writeIFD(IFD ifd,
long nextOffset) |
void |
writeIFDValue(RandomAccessOutputStream extraOut,
long offset,
int tag,
Object value)
Writes the given IFD value to the given output object.
|
void |
writeImage(byte[][] buf,
IFDList ifds,
int pixelType) |
void |
writeImage(byte[] buf,
IFD ifd,
int no,
int pixelType,
boolean last) |
void |
writeImage(byte[] buf,
IFD ifd,
int no,
int pixelType,
int x,
int y,
int w,
int h,
boolean last)
Writes to any rectangle from the passed block.
|
void |
writeImage(byte[] buf,
IFD ifd,
int no,
int pixelType,
int x,
int y,
int w,
int h,
boolean last,
Integer nChannels,
boolean copyDirectly) |
protected RandomAccessOutputStream out
protected String filename
protected ByteArrayHandle bytes
public TiffSaver(String filename) throws IOException
filename
- Filename of the output stream that we may use to create
extra input or output streams as required.IOException
public TiffSaver(RandomAccessOutputStream out, String filename)
out
- Output stream to save TIFF data to.filename
- Filename of the output stream that we may use to create
extra input or output streams as required.public TiffSaver(RandomAccessOutputStream out, ByteArrayHandle bytes)
out
- Output stream to save TIFF data to.bytes
- In memory byte array handle that we may use to create
extra input or output streams as required.public void setWritingSequentially(boolean sequential)
public RandomAccessOutputStream getStream()
public void setLittleEndian(boolean littleEndian)
public void setBigTiff(boolean bigTiff)
public boolean isLittleEndian()
public boolean isBigTiff()
public void setCodecOptions(CodecOptions options)
options
- The value to set.public void writeHeader() throws IOException
IOException
public void writeImage(byte[][] buf, IFDList ifds, int pixelType) throws FormatException, IOException
FormatException
IOException
public void writeImage(byte[] buf, IFD ifd, int no, int pixelType, boolean last) throws FormatException, IOException
FormatException
IOException
public void writeImage(byte[] buf, IFD ifd, int no, int pixelType, int x, int y, int w, int h, boolean last) throws FormatException, IOException
buf
- The block that is to be written.ifd
- The Image File Directories. Mustn't be null
.no
- The image index within the current file, starting from 0.pixelType
- The type of pixels.x
- The X-coordinate of the top-left corner.y
- The Y-coordinate of the top-left corner.w
- The width of the rectangle.h
- The height of the rectangle.last
- Pass true
if it is the last image,
false
otherwise.FormatException
IOException
public void writeImage(byte[] buf, IFD ifd, int no, int pixelType, int x, int y, int w, int h, boolean last, Integer nChannels, boolean copyDirectly) throws FormatException, IOException
FormatException
IOException
public void writeIFD(IFD ifd, long nextOffset) throws FormatException, IOException
FormatException
IOException
public void writeIFDValue(RandomAccessOutputStream extraOut, long offset, int tag, Object value) throws FormatException, IOException
extraOut
- buffer to which "extra" IFD information should be writtenoffset
- global offset to use for IFD offset valuestag
- IFD tag to writevalue
- IFD value to writeFormatException
IOException
public void overwriteLastIFDOffset(RandomAccessInputStream raf) throws FormatException, IOException
FormatException
IOException
public void overwriteIFDValue(RandomAccessInputStream raf, int ifd, int tag, Object value) throws FormatException, IOException
FormatException
IOException
public void overwriteComment(RandomAccessInputStream in, Object value) throws FormatException, IOException
FormatException
IOException
Copyright © 2014 Open Microscopy Environment