ome.formats.importer
Class ImportLibrary

java.lang.Object
  extended by ome.formats.importer.ImportLibrary
All Implemented Interfaces:
IObservable

public class ImportLibrary
extends Object
implements IObservable

support class for the proper usage of OMEROMetadataStoreClient and FormatReader instances. This library was factored out of ImportHandler to support ImportFixture The general workflow for this class (as seen in ImportFixture is: ImportLibrary library = new ImportLibrary(store,reader,files); for (File file : files) { String fileName = file.getAbsolutePath(); library.open(fileName); int count = library.calculateImageCount(fileName); long pixId = library.importMetadata(); library.importData(pixId, fileName, new ImportLibrary.Step(){ public void step(int i) {}}); }

Since:
3.0-M3
Version:
$Revision: 1167 $, $Date: 2006-12-15 10:39:34 +0000 (Fri, 15 Dec 2006) $
Author:
Josh Moore, josh.moore at gmx.de
See Also:
FormatReader, OMEROMetadataStoreClient, ImportFixture, IObservable, IObserver

Field Summary
static int DEFAULT_ARRAYBUF_SIZE
          Default arraybuf size for planar data transfer. (1MB)
 
Constructor Summary
ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader)
          The library will not close the client instance.
 
Method Summary
 boolean addObserver(IObserver object)
          Add observer for notification
 void clear()
           
 boolean deleteObserver(IObserver object)
          Delete observer
 long getExperimenterID()
           
 InstanceProvider getInstanceProvider()
           
 boolean importCandidates(ImportConfig config, ImportCandidates candidates)
          Primary user method for importing a number
 MessageDigest importData(Long pixId, String fileName, int series, ImportSize size)
          saves the binary data to the server.
 List<omero.model.Pixels> importImage(ImportContainer container, int index, int numDone, int total)
          Perform an image import.
 boolean isMetadataOnly()
          Retrieves the metadata only flag.
 void notifyObservers(ImportEvent event)
          Notify observers of event
 void prepare(Map<Integer,omero.model.Image> existingMetadata)
          Prepares the metadata store using existing metadata that has been pre-registered by OMERO.fs.
 void setMetadataOnly(boolean isMetadataOnly)
          Sets the metadata only flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ARRAYBUF_SIZE

public static final int DEFAULT_ARRAYBUF_SIZE
Default arraybuf size for planar data transfer. (1MB)

See Also:
Constant Field Values
Constructor Detail

ImportLibrary

public ImportLibrary(OMEROMetadataStoreClient client,
                     OMEROWrapper reader)
The library will not close the client instance. The reader will be closed between calls to import.

Parameters:
store - not null
reader - not null
Method Detail

setMetadataOnly

public void setMetadataOnly(boolean isMetadataOnly)
Sets the metadata only flag.

Parameters:
isMetadataOnly - Whether or not to perform metadata only imports with this import library.

isMetadataOnly

public boolean isMetadataOnly()
Retrieves the metadata only flag.

Returns:
See above.

getExperimenterID

public long getExperimenterID()

getInstanceProvider

public InstanceProvider getInstanceProvider()

prepare

public void prepare(Map<Integer,omero.model.Image> existingMetadata)
Prepares the metadata store using existing metadata that has been pre-registered by OMERO.fs. The expected graph should be fully loaded:

Parameters:
existingMetadata - Map of imageIndex or series vs. populated Image source graph with the fetched objects defined above.

addObserver

public boolean addObserver(IObserver object)
Description copied from interface: IObservable
Add observer for notification

Specified by:
addObserver in interface IObservable
Parameters:
object - - observer object
Returns:
true if added

deleteObserver

public boolean deleteObserver(IObserver object)
Description copied from interface: IObservable
Delete observer

Specified by:
deleteObserver in interface IObservable
Parameters:
object - - observer to delete
Returns:
true if deleted

notifyObservers

public void notifyObservers(ImportEvent event)
Description copied from interface: IObservable
Notify observers of event

Specified by:
notifyObservers in interface IObservable
Parameters:
event - - event that happened

importCandidates

public boolean importCandidates(ImportConfig config,
                                ImportCandidates candidates)
Primary user method for importing a number


importImage

public List<omero.model.Pixels> importImage(ImportContainer container,
                                            int index,
                                            int numDone,
                                            int total)
                                     throws loci.formats.FormatException,
                                            IOException,
                                            Throwable
Perform an image import. Note: this method both notifies observers of error states AND throws the exception to cancel processing. importCandidates(ImportConfig, ImportCandidates) uses ImportConfig.contOnError to act on these exceptions.

Parameters:
container - The import container which houses all the configuration values and target for the import.
index - Index of the import in a set. 0 is safe if this is a singular import.
numDone - Number of imports completed in a set. 0 is safe if this is a singular import.
total - Total number of imports in a set. 1 is safe if this is a singular import.
Returns:
List of Pixels that have been imported.
Throws:
loci.formats.FormatException - If there is a Bio-Formats image file format error during import.
IOException - If there is an I/O error.
omero.ServerError - If there is an error communicating with the OMERO server we're importing into.
Throwable
Since:
OMERO Beta 4.2.1.

importData

public MessageDigest importData(Long pixId,
                                String fileName,
                                int series,
                                ImportSize size)
                         throws loci.formats.FormatException,
                                IOException,
                                omero.ServerError
saves the binary data to the server. After each successful save, an ImportEvent.IMPORT_STEP is raised with the number of the iteration just completed.

Parameters:
series -
Returns:
The SHA1 message digest for the Pixels saved.
Throws:
loci.formats.FormatException
IOException
omero.ServerError

clear

public void clear()


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.