loci.formats
Class FormatWriter

java.lang.Object
  extended by loci.formats.FormatHandler
      extended by loci.formats.FormatWriter
All Implemented Interfaces:
IFormatHandler, IFormatWriter, StatusReporter
Direct Known Subclasses:
AVIWriter, EPSWriter, ImageIOWriter, LegacyQTWriter, QTWriter, TiffWriter

public abstract class FormatWriter
extends FormatHandler
implements IFormatWriter

Abstract superclass of all biological file format writers.

Source code:
Trac, SVN


Field Summary
protected  ColorModel cm
          Default color model.
protected  String compression
          Current compression type.
protected  String[] compressionTypes
          Available compression types.
protected  int fps
          Frame rate to use when writing in frames per second, if applicable.
protected  boolean initialized
          Whether the current file has been prepped for writing.
protected  MetadataRetrieve metadataRetrieve
          Current metadata retrieval object.
 
Fields inherited from class loci.formats.FormatHandler
currentId, debug, debugLevel, format, statusListeners, suffixes
 
Constructor Summary
FormatWriter(String format, String suffix)
          Constructs a format writer with the given name and default suffix.
FormatWriter(String format, String[] suffixes)
          Constructs a format writer with the given name and default suffixes.
 
Method Summary
 boolean canDoStacks()
          Reports whether the writer can save multiple images to a single file.
 boolean canDoStacks(String id)
          Deprecated. Replaced by canDoStacks()
 ColorModel getColorModel()
          Gets the color model.
 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(String id)
          Deprecated. Replaced by getPixelTypes()
 boolean isSupportedType(int type)
          Checks if the given pixel type is supported.
 boolean isSupportedType(String id, int type)
          Deprecated. Replaced by isSupportedType(int type)
 void save(String id, Image image, boolean last)
          Deprecated. Replaced by IFormatWriter.saveImage(Image, boolean)
 void saveBytes(byte[] bytes, boolean last)
          Saves the given byte array to the current file.
 void saveBytes(byte[] bytes, int series, boolean lastInSeries, boolean last)
          Saves the given byte array to the given series in the current file.
 void saveImage(Image image, int series, boolean lastInSeries, boolean last)
          Saves the given image to the given series in the current file.
 void setColorModel(ColorModel model)
          Sets the color model.
 void setCompression(String compress)
          Sets the current compression type.
 void setFramesPerSecond(int rate)
          Sets the frames per second to use when writing.
 void setId(String id, boolean force)
          Sets the current file name.
 void setMetadataRetrieve(MetadataRetrieve retrieve)
          Sets the metadata retrieval object from which to retrieve standardized metadata.
 
Methods inherited from class loci.formats.FormatHandler
addStatusListener, debug, getFormat, getStatusListeners, getSuffixes, isThisType, isThisType, removeStatusListener, setDebug, setDebugLevel, setId, status, status, status, trace, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface loci.formats.IFormatWriter
saveImage
 
Methods inherited from interface loci.formats.IFormatHandler
close, getFormat, getSuffixes, isThisType, isThisType, setId
 
Methods inherited from interface loci.formats.StatusReporter
addStatusListener, getStatusListeners, removeStatusListener
 

Field Detail

fps

protected int fps
Frame rate to use when writing in frames per second, if applicable.


cm

protected ColorModel cm
Default color model.


compressionTypes

protected String[] compressionTypes
Available compression types.


compression

protected String compression
Current compression type.


initialized

protected boolean initialized
Whether the current file has been prepped for writing.


metadataRetrieve

protected MetadataRetrieve metadataRetrieve
Current metadata retrieval object. Should never be accessed directly as the semantics of getMetadataRetrieve() prevent "null" access.

Constructor Detail

FormatWriter

public FormatWriter(String format,
                    String suffix)
Constructs a format writer with the given name and default suffix.


FormatWriter

public FormatWriter(String format,
                    String[] suffixes)
Constructs a format writer with the given name and default suffixes.

Method Detail

saveBytes

public void saveBytes(byte[] bytes,
                      boolean last)
               throws FormatException,
                      IOException
Description copied from interface: IFormatWriter
Saves the given byte array to the current file. If this is the last array to be written, the last flag must be set.

Specified by:
saveBytes in interface IFormatWriter
Throws:
FormatException
IOException

saveBytes

public void saveBytes(byte[] bytes,
                      int series,
                      boolean lastInSeries,
                      boolean last)
               throws FormatException,
                      IOException
Description copied from interface: IFormatWriter
Saves the given byte array to the given series in the current file. If this is the last array in the series, the lastInSeries flag must be set. If this is the last array to be written, the last flag must be set.

Specified by:
saveBytes in interface IFormatWriter
Throws:
FormatException
IOException

saveImage

public void saveImage(Image image,
                      int series,
                      boolean lastInSeries,
                      boolean last)
               throws FormatException,
                      IOException
Description copied from interface: IFormatWriter
Saves the given image to the given series in the current file. If this image is the last one in the series, the lastInSeries flag must be set. If this image is the last one in the file, the last flag must be set.

Specified by:
saveImage in interface IFormatWriter
Throws:
FormatException
IOException

canDoStacks

public boolean canDoStacks()
Description copied from interface: IFormatWriter
Reports whether the writer can save multiple images to a single file.

Specified by:
canDoStacks in interface IFormatWriter

setMetadataRetrieve

public void setMetadataRetrieve(MetadataRetrieve retrieve)
Description copied from interface: IFormatWriter
Sets the metadata retrieval object from which to retrieve standardized metadata.

Specified by:
setMetadataRetrieve in interface IFormatWriter

getMetadataRetrieve

public MetadataRetrieve getMetadataRetrieve()
Description copied from interface: IFormatWriter
Retrieves the current metadata retrieval object for this writer. You can be assured that this method will never return a null metadata retrieval object.

Specified by:
getMetadataRetrieve in interface IFormatWriter
Returns:
A metadata retrieval object.

setColorModel

public void setColorModel(ColorModel model)
Description copied from interface: IFormatWriter
Sets the color model.

Specified by:
setColorModel in interface IFormatWriter

getColorModel

public ColorModel getColorModel()
Description copied from interface: IFormatWriter
Gets the color model.

Specified by:
getColorModel in interface IFormatWriter

setFramesPerSecond

public void setFramesPerSecond(int rate)
Description copied from interface: IFormatWriter
Sets the frames per second to use when writing.

Specified by:
setFramesPerSecond in interface IFormatWriter

getFramesPerSecond

public int getFramesPerSecond()
Description copied from interface: IFormatWriter
Gets the frames per second to use when writing.

Specified by:
getFramesPerSecond in interface IFormatWriter

getCompressionTypes

public String[] getCompressionTypes()
Description copied from interface: IFormatWriter
Gets the available compression types.

Specified by:
getCompressionTypes in interface IFormatWriter

setCompression

public void setCompression(String compress)
                    throws FormatException
Description copied from interface: IFormatWriter
Sets the current compression type.

Specified by:
setCompression in interface IFormatWriter
Throws:
FormatException

getPixelTypes

public int[] getPixelTypes()
Description copied from interface: IFormatWriter
Gets the supported pixel types.

Specified by:
getPixelTypes in interface IFormatWriter

isSupportedType

public boolean isSupportedType(int type)
Description copied from interface: IFormatWriter
Checks if the given pixel type is supported.

Specified by:
isSupportedType in interface IFormatWriter

setId

public void setId(String id,
                  boolean force)
           throws FormatException,
                  IOException
Description copied from interface: IFormatHandler
Sets the current file name.

Specified by:
setId in interface IFormatHandler
force - If set, the handler will be re-initialized no matter what.
Throws:
FormatException
IOException

canDoStacks

public boolean canDoStacks(String id)
                    throws FormatException
Deprecated. Replaced by canDoStacks()

Specified by:
canDoStacks in interface IFormatWriter
Throws:
FormatException

getPixelTypes

public int[] getPixelTypes(String id)
                    throws FormatException,
                           IOException
Deprecated. Replaced by getPixelTypes()

Specified by:
getPixelTypes in interface IFormatWriter
Throws:
FormatException
IOException

isSupportedType

public boolean isSupportedType(String id,
                               int type)
                        throws FormatException,
                               IOException
Deprecated. Replaced by isSupportedType(int type)

Specified by:
isSupportedType in interface IFormatWriter
Throws:
FormatException
IOException

save

public void save(String id,
                 Image image,
                 boolean last)
          throws FormatException,
                 IOException
Deprecated. Replaced by IFormatWriter.saveImage(Image, boolean)

Specified by:
save in interface IFormatWriter
Throws:
FormatException
IOException