visad.data.bio
Class LociForm
- java.lang.Object
-
- visad.data.FormNode
-
- visad.data.Form
-
- visad.data.bio.LociForm
-
- All Implemented Interfaces:
- FormBlockReader, FormFileInformer, FormProgressInformer, MetadataReader
- Direct Known Subclasses:
- AVIForm, BioRadForm, DeltavisionForm, FluoviewTiffForm, GatanForm, ICSForm, ImageProSeqForm, IPLabForm, IPWForm, LegacyZVIForm, LeicaForm, MetamorphForm, OpenlabForm, PerkinElmerForm, PictForm, QTForm, TiffForm, ZeissForm, ZVIForm
public class LociForm extends Form implements FormBlockReader, FormFileInformer, FormProgressInformer, MetadataReader
LociForm is the VisAD data adapter for images handled by the Bio-Formats package (loci.formats). It works by wrapping a loci.formats.IFormatReader and/or loci.formats.IFormatWriter object.
-
-
Constructor Summary
Constructors Constructor and Description LociForm()Constructs a new LociForm that handles anything from loci.formats.LociForm(loci.formats.IFormatReader reader)Constructs a new LociForm that handles the given reader.LociForm(loci.formats.IFormatReader reader, loci.formats.IFormatWriter writer)Constructs a new LociForm that handles the given reader/writer pair.LociForm(loci.formats.IFormatWriter writer)Constructs a new LociForm that handles the given writer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(java.lang.String id, Data data, boolean replace)Adds data to an existing image file.voidclose()Closes any open files.intgetBlockCount(java.lang.String id)Determines the number of images in the given image file.java.lang.String[]getDefaultSuffixes()Returns the default file suffixes for this file format.FormNodegetForms(Data data)Returns the data forms that are compatible with a data object.java.util.HashtablegetMetadata(java.lang.String id)Obtains the hashtable containing the metadata field/value pairs from the given image file.java.lang.ObjectgetMetadataValue(java.lang.String id, java.lang.String field)Obtains the specified metadata field's value for the given file.doublegetPercentComplete()Gets the percentage complete of the form's current operation.loci.formats.IFormatReadergetReader()Gets the IFormatReader backing this form's reading capabilities.javax.swing.filechooser.FileFilter[]getReaderFilters()Gets file filters for use with formats supported for reading.loci.formats.IFormatWritergetWriter()Gets the IFormatWriter backing this form's writing capabilities.javax.swing.filechooser.FileFilter[]getWriterFilters()Gets file filters for use with formats supported for writing.voidinitHandler(loci.formats.IFormatHandler h, java.lang.String id)booleanisThisType(byte[] block)Checks if the given block is a valid header for an image file.booleanisThisType(java.lang.String name)Checks if the given string is a valid filename for an image file.static voidmain(java.lang.String[] args)DataImplopen(java.lang.String id)Opens an existing image file from the given filename.DataImplopen(java.lang.String id, int block_number)Obtains the specified image from the given image file.DataImplopen(java.net.URL url)Opens an existing image file from the given URL.voidsave(java.lang.String id, Data data, boolean replace)Saves a VisAD Data object at the given location.voidsetFrameRate(int fps)Sets the frames per second to use when writing files.voidtestRead(java.lang.String[] args)A utility method for test reading a file from the command line, and displaying the results in a simple display.-
Methods inherited from class visad.data.Form
getMathType
-
-
-
-
Constructor Detail
-
LociForm
public LociForm()
Constructs a new LociForm that handles anything from loci.formats.
-
LociForm
public LociForm(loci.formats.IFormatReader reader)
Constructs a new LociForm that handles the given reader.
-
LociForm
public LociForm(loci.formats.IFormatWriter writer)
Constructs a new LociForm that handles the given writer.
-
LociForm
public LociForm(loci.formats.IFormatReader reader, loci.formats.IFormatWriter writer)Constructs a new LociForm that handles the given reader/writer pair.
-
-
Method Detail
-
getReader
public loci.formats.IFormatReader getReader()
Gets the IFormatReader backing this form's reading capabilities.
-
getWriter
public loci.formats.IFormatWriter getWriter()
Gets the IFormatWriter backing this form's writing capabilities.
-
setFrameRate
public void setFrameRate(int fps)
Sets the frames per second to use when writing files.
-
testRead
public void testRead(java.lang.String[] args) throws VisADException, java.io.IOExceptionA utility method for test reading a file from the command line, and displaying the results in a simple display.- Throws:
VisADExceptionjava.io.IOException
-
getReaderFilters
public javax.swing.filechooser.FileFilter[] getReaderFilters()
Gets file filters for use with formats supported for reading.
-
getWriterFilters
public javax.swing.filechooser.FileFilter[] getWriterFilters()
Gets file filters for use with formats supported for writing.
-
open
public DataImpl open(java.lang.String id) throws BadFormException, java.io.IOException, VisADException
Opens an existing image file from the given filename.- Specified by:
openin classFormNode- Returns:
- VisAD Data object containing image data
- Throws:
BadFormExceptionjava.io.IOExceptionVisADException
-
save
public void save(java.lang.String id, Data data, boolean replace) throws BadFormException, java.io.IOException, java.rmi.RemoteException, VisADExceptionSaves a VisAD Data object at the given location.- Specified by:
savein classFormNode- Throws:
BadFormExceptionjava.io.IOExceptionjava.rmi.RemoteExceptionVisADException
-
add
public void add(java.lang.String id, Data data, boolean replace) throws BadFormExceptionAdds data to an existing image file.- Specified by:
addin classFormNode- Throws:
BadFormException- Always thrown (this method not implemented).
-
open
public DataImpl open(java.net.URL url) throws BadFormException, java.io.IOException, VisADException
Opens an existing image file from the given URL.- Specified by:
openin classFormNode- Returns:
- VisAD data object containing image data
- Throws:
UnimplementedException- Always thrown (this method not implemented).BadFormExceptionjava.io.IOExceptionVisADException
-
getForms
public FormNode getForms(Data data)
Returns the data forms that are compatible with a data object.
-
open
public DataImpl open(java.lang.String id, int block_number) throws BadFormException, java.io.IOException, VisADException
Obtains the specified image from the given image file.- Specified by:
openin interfaceFormBlockReader- Parameters:
id- The file from which to load data blocks.block_number- The block number of the block to load.- Throws:
VisADException- If the block number is invalid.BadFormExceptionjava.io.IOException
-
getBlockCount
public int getBlockCount(java.lang.String id) throws BadFormException, java.io.IOException, VisADExceptionDetermines the number of images in the given image file.- Specified by:
getBlockCountin interfaceFormBlockReader- Parameters:
id- The file for which to get a block count.- Throws:
BadFormExceptionjava.io.IOExceptionVisADException
-
close
public void close() throws BadFormException, java.io.IOException, VisADExceptionCloses any open files.- Specified by:
closein interfaceFormBlockReader- Throws:
BadFormExceptionjava.io.IOExceptionVisADException
-
isThisType
public boolean isThisType(java.lang.String name)
Checks if the given string is a valid filename for an image file.- Specified by:
isThisTypein interfaceFormFileInformer- Parameters:
name- name of the file- Returns:
- true if the name is right for this type of form
-
isThisType
public boolean isThisType(byte[] block)
Checks if the given block is a valid header for an image file.- Specified by:
isThisTypein interfaceFormFileInformer- Parameters:
block- block of bytes from file- Returns:
- true if the magic number is right
-
getDefaultSuffixes
public java.lang.String[] getDefaultSuffixes()
Returns the default file suffixes for this file format.- Specified by:
getDefaultSuffixesin interfaceFormFileInformer- Returns:
- array of suffixes
-
getPercentComplete
public double getPercentComplete()
Gets the percentage complete of the form's current operation.- Specified by:
getPercentCompletein interfaceFormProgressInformer- Returns:
- The percentage complete (0.0 - 100.0), or Double.NaN if no operation is currently taking place.
-
getMetadataValue
public java.lang.Object getMetadataValue(java.lang.String id, java.lang.String field) throws BadFormException, java.io.IOException, VisADExceptionObtains the specified metadata field's value for the given file.- Specified by:
getMetadataValuein interfaceMetadataReader- Parameters:
field- the name associated with the metadata field- Returns:
- the value, or null if the field doesn't exist
- Throws:
BadFormExceptionjava.io.IOExceptionVisADException
-
getMetadata
public java.util.Hashtable getMetadata(java.lang.String id) throws BadFormException, java.io.IOException, VisADExceptionObtains the hashtable containing the metadata field/value pairs from the given image file.- Specified by:
getMetadatain interfaceMetadataReader- Parameters:
id- the filename- Returns:
- the hashtable containing all metadata from the file
- Throws:
BadFormExceptionjava.io.IOExceptionVisADException
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
initHandler
public void initHandler(loci.formats.IFormatHandler h, java.lang.String id) throws BadFormException, java.io.IOException- Throws:
BadFormExceptionjava.io.IOException
-
-
DMelt 3.0 © DataMelt by jWork.ORG