public abstract class FormatWriter extends FormatHandler implements IFormatWriter
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.image.ColorModel |
cm
Default color model.
|
protected java.lang.String |
compression
Current compression type.
|
protected java.lang.String[] |
compressionTypes
Available compression types.
|
protected int |
fps
Frame rate to use when writing in frames per second, if applicable.
|
protected boolean[][] |
initialized
Whether each plane in each series of the current file has been
prepped for writing.
|
protected boolean |
interleaved
Whether the channels in an RGB image are interleaved.
|
protected MetadataRetrieve |
metadataRetrieve
Current metadata retrieval object.
|
protected CodecOptions |
options
The options if required.
|
protected loci.common.RandomAccessOutputStream |
out
Current file.
|
protected int |
resolution
Current pyramid resolution.
|
protected java.util.List<java.util.List<Resolution>> |
resolutionData |
protected boolean |
sequential
Whether or not we are writing planes sequentially.
|
protected int |
series
Current series.
|
protected int |
validBits
The number of valid bits per pixel.
|
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes| Constructor and Description |
|---|
FormatWriter(java.lang.String format,
java.lang.String suffix)
Constructs a format writer with the given name and default suffix.
|
FormatWriter(java.lang.String format,
java.lang.String[] suffixes)
Constructs a format writer with the given name and default suffixes.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDoStacks()
Reports whether the writer can save multiple images to a single file.
|
void |
changeOutputFile(java.lang.String id)
Switch the output file for the current dataset.
|
protected void |
checkParams(int no,
byte[] buf,
int x,
int y,
int w,
int h)
Ensure that the arguments that are being passed to saveBytes(...) are
valid.
|
void |
close() |
protected loci.common.RandomAccessOutputStream |
createOutputStream() |
java.awt.image.ColorModel |
getColorModel()
Gets the color model.
|
java.lang.String |
getCompression()
Gets the current compression type.
|
java.lang.String[] |
getCompressionTypes()
Gets the available compression types.
|
int |
getFramesPerSecond()
Gets the frames per second to use when writing.
|
MetadataRetrieve |
getMetadataRetrieve()
Retrieves the current metadata retrieval object for this writer.
|
int[] |
getPixelTypes()
Gets the supported pixel types.
|
int[] |
getPixelTypes(java.lang.String codec)
Gets the supported pixel types for the given codec.
|
protected int |
getPlaneCount()
Retrieve the total number of planes in the current series.
|
protected int |
getPlaneCount(int series)
Retrieve the total number of planes in given series.
|
int |
getResolution()
Get the current resolution level.
|
int |
getResolutionCount()
Return the number of resolutions for the current series.
|
java.util.List<Resolution> |
getResolutions()
Get a list of resolution objects for the current series.
|
protected int |
getSamplesPerPixel()
Retrieve the number of samples per pixel for the current series.
|
protected int |
getSamplesPerPixel(int series)
Retrieve the number of samples per pixel for given series.
|
int |
getSeries()
Returns the current series.
|
protected int |
getSizeX() |
protected int |
getSizeY() |
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 boolean |
hasResolutions() |
protected boolean |
isFullPlane(int x,
int y,
int w,
int h)
Returns true if the given rectangle coordinates correspond to a full
image in the given series.
|
boolean |
isInterleaved()
Gets whether or not the channels in an image are interleaved.
|
boolean |
isSupportedType(int type)
Checks if the given pixel type is supported.
|
void |
saveBytes(int no,
byte[] buf)
Saves the given image to the current series in the current file.
|
void |
saveBytes(int no,
byte[] buf,
loci.common.Region tile)
Saves the given image tile to the current series in the current file.
|
void |
savePlane(int no,
java.lang.Object plane)
Saves the given image plane to the current series in the current file.
|
void |
savePlane(int no,
java.lang.Object plane,
int x,
int y,
int w,
int h)
Saves the given image plane to the current series in the current file.
|
void |
savePlane(int no,
java.lang.Object plane,
loci.common.Region tile)
Saves the given image plane to the current series in the current file.
|
protected void |
seekToPlaneOffset(long baseOffset,
int x,
int y)
Seek to the given (x, y) coordinate of the image that starts at
the given offset.
|
void |
setCodecOptions(CodecOptions options)
Sets the codec options.
|
void |
setColorModel(java.awt.image.ColorModel model)
Sets the color model.
|
void |
setCompression(java.lang.String compress)
Sets the current compression type.
|
void |
setFramesPerSecond(int rate)
Sets the frames per second to use when writing.
|
void |
setId(java.lang.String id)
Initializes a writer from the input file name.
|
void |
setInterleaved(boolean interleaved)
Sets whether or not the channels in an image are interleaved.
|
void |
setMetadataRetrieve(MetadataRetrieve retrieve)
Sets the metadata retrieval object from
which to retrieve standardized metadata.
|
void |
setResolution(int resolution)
Set the resolution level.
|
void |
setResolutions(java.util.List<Resolution> resolutions)
Specify a list of resolution objects for the current series.
|
void |
setSeries(int series)
Sets the current series.
|
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
|
void |
setValidBitsPerPixel(int bits)
Sets the number of valid bits per pixel.
|
void |
setWriteSequentially(boolean sequential)
Sets whether or not we know that planes will be written sequentially.
|
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, isThisType, setMetadataOptionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsaveBytesgetFormat, getNativeDataType, getSuffixes, isThisTypegetMetadataOptions, getSupportedMetadataLevels, setMetadataOptionsprotected int fps
protected java.awt.image.ColorModel cm
protected java.lang.String[] compressionTypes
protected java.lang.String compression
protected CodecOptions options
protected boolean[][] initialized
protected boolean interleaved
protected int validBits
protected int series
protected boolean sequential
protected MetadataRetrieve metadataRetrieve
getMetadataRetrieve()
prevent "null" access.protected loci.common.RandomAccessOutputStream out
protected int resolution
protected java.util.List<java.util.List<Resolution>> resolutionData
public FormatWriter(java.lang.String format,
java.lang.String suffix)
public FormatWriter(java.lang.String format,
java.lang.String[] suffixes)
public void changeOutputFile(java.lang.String id)
throws FormatException,
java.io.IOException
IFormatWriterchangeOutputFile in interface IFormatWriterFormatExceptionjava.io.IOExceptionpublic void saveBytes(int no,
byte[] buf)
throws FormatException,
java.io.IOException
IFormatWritersaveBytes in interface IFormatWriterno - the image index within the current file, starting from 0.buf - the byte array that represents the image.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.public void saveBytes(int no,
byte[] buf,
loci.common.Region tile)
throws FormatException,
java.io.IOException
IFormatWritersaveBytes in interface IFormatWriterno - the image index within the current file, starting from 0.buf - the byte array that represents the image tile.tile - the Region representing the image tile to be read.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.public void savePlane(int no,
java.lang.Object plane)
throws FormatException,
java.io.IOException
IFormatWritersavePlane in interface IFormatWriterno - the image index within the current file, starting from 0.plane - the image plane.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.public void savePlane(int no,
java.lang.Object plane,
int x,
int y,
int w,
int h)
throws FormatException,
java.io.IOException
IFormatWritersavePlane in interface IFormatWriterno - the image index within the current file, starting from 0.plane - the image plane.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.public void savePlane(int no,
java.lang.Object plane,
loci.common.Region tile)
throws FormatException,
java.io.IOException
IFormatWritersavePlane in interface IFormatWriterno - the image index within the current file, starting from 0.plane - the image plane.tile - the Region representing the image tile to be read.FormatException - if one of the parameters is invalid.java.io.IOException - if there was a problem writing to the file.public void setSeries(int series)
throws FormatException
IFormatWritersetSeries in interface IFormatWriterseries - the series index, starting from 0.FormatException - if the specified series is invalid.public int getSeries()
IFormatWritergetSeries in interface IFormatWriterpublic void setInterleaved(boolean interleaved)
IFormatWritersetInterleaved in interface IFormatWriterpublic boolean isInterleaved()
IFormatWriterisInterleaved in interface IFormatWriterpublic void setValidBitsPerPixel(int bits)
IFormatWritersetValidBitsPerPixel in interface IFormatWriterpublic boolean canDoStacks()
IFormatWritercanDoStacks in interface IFormatWriterpublic void setMetadataRetrieve(MetadataRetrieve retrieve)
IFormatWritersetMetadataRetrieve in interface IFormatWriterpublic MetadataRetrieve getMetadataRetrieve()
IFormatWriternull
metadata retrieval object.getMetadataRetrieve in interface IFormatWriterpublic void setColorModel(java.awt.image.ColorModel model)
IFormatWritersetColorModel in interface IFormatWriterpublic java.awt.image.ColorModel getColorModel()
IFormatWritergetColorModel in interface IFormatWriterpublic void setFramesPerSecond(int rate)
IFormatWritersetFramesPerSecond in interface IFormatWriterpublic int getFramesPerSecond()
IFormatWritergetFramesPerSecond in interface IFormatWriterpublic java.lang.String[] getCompressionTypes()
IFormatWritergetCompressionTypes in interface IFormatWriterpublic void setCompression(java.lang.String compress)
throws FormatException
IFormatWritersetCompression in interface IFormatWriterFormatExceptionpublic void setCodecOptions(CodecOptions options)
IFormatWritersetCodecOptions in interface IFormatWriteroptions - The options to set.public java.lang.String getCompression()
IFormatWritergetCompression in interface IFormatWriterpublic int[] getPixelTypes()
IFormatWritergetPixelTypes in interface IFormatWriterpublic int[] getPixelTypes(java.lang.String codec)
IFormatWritergetPixelTypes in interface IFormatWriterpublic boolean isSupportedType(int type)
IFormatWriterisSupportedType in interface IFormatWriterpublic void setWriteSequentially(boolean sequential)
IFormatWritersetWriteSequentially in interface IFormatWriterpublic int getTileSizeX()
throws FormatException
IFormatWritergetTileSizeX in interface IFormatWriterFormatException - Image metadata including Pixels Size X must be set prior to calling getTileSizeX()public int setTileSizeX(int tileSize)
throws FormatException
IFormatWritersetTileSizeX in interface IFormatWritertileSize - 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 IFormatWriterFormatException - Image metadata including Pixels Size Y must be set prior to calling getTileSizeY()public int setTileSizeY(int tileSize)
throws FormatException
IFormatWritersetTileSizeY in interface IFormatWritertileSize - 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 heightpublic void setResolutions(java.util.List<Resolution> resolutions)
IFormatWritersetResolutions in interface IFormatWriterpublic java.util.List<Resolution> getResolutions()
IFormatWritergetResolutions in interface IFormatWriterpublic int getResolutionCount()
IPyramidHandlergetResolutionCount in interface IPyramidHandlerpublic int getResolution()
IPyramidHandlergetResolution in interface IPyramidHandlerIPyramidHandler.getResolutionCount()public void setResolution(int resolution)
IPyramidHandlersetResolution in interface IPyramidHandlerIPyramidHandler.getResolutionCount()public void setId(java.lang.String id)
throws FormatException,
java.io.IOException
RandomAccessOutputStream for the output
file and initializes the metadata for all the series using
setSeries(int).setId in interface IFormatHandlerid - a String specifying the path to the fileFormatExceptionjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprotected void checkParams(int no,
byte[] buf,
int x,
int y,
int w,
int h)
throws FormatException
FormatException - if any of the arguments is invalid.protected void seekToPlaneOffset(long baseOffset,
int x,
int y)
throws java.io.IOException
java.io.IOExceptionprotected boolean isFullPlane(int x,
int y,
int w,
int h)
throws FormatException
FormatExceptionprotected int getSamplesPerPixel()
protected int getSamplesPerPixel(int series)
protected int getPlaneCount()
protected int getPlaneCount(int series)
protected loci.common.RandomAccessOutputStream createOutputStream()
throws java.io.IOException
java.io.IOExceptionprotected int getSizeX()
throws FormatException
FormatExceptionprotected int getSizeY()
throws FormatException
FormatExceptionprotected boolean hasResolutions()
Copyright © 2019 Open Microscopy Environment