public class ImportLibrary extends Object implements IObservable
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) {}});
}
FormatReader
,
OMEROMetadataStoreClient
,
ImportFixture
,
IObservable
,
IObserver
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ARRAYBUF_SIZE
Default arraybuf size for planar data transfer. (1MB)
|
Constructor and Description |
---|
ImportLibrary(OMEROMetadataStoreClient client,
OMEROWrapper reader)
The library will not close the client instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int DEFAULT_ARRAYBUF_SIZE
public ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader)
store
- not nullreader
- not nullpublic void setMetadataOnly(boolean isMetadataOnly)
isMetadataOnly
- Whether or not to perform metadata only imports
with this import library.public boolean isMetadataOnly()
public long getExperimenterID()
public InstanceProvider getInstanceProvider()
public void prepare(Map<Integer,omero.model.Image> existingMetadata)
existingMetadata
- Map of imageIndex or series vs. populated Image
source graph with the fetched objects defined above.public boolean addObserver(IObserver object)
IObservable
addObserver
in interface IObservable
object
- - observer objectpublic boolean deleteObserver(IObserver object)
IObservable
deleteObserver
in interface IObservable
object
- - observer to deletepublic void notifyObservers(ImportEvent event)
IObservable
notifyObservers
in interface IObservable
event
- - event that happenedpublic boolean importCandidates(ImportConfig config, ImportCandidates candidates)
config
- The configuration information.candidates
- Hosts information about the files to import.public List<omero.model.Pixels> importImage(ImportContainer container, int index, int numDone, int total) throws loci.formats.FormatException, IOException, Throwable
observers
of error states AND throws the exception to cancel
processing.
importCandidates(ImportConfig, ImportCandidates)
uses ImportConfig.contOnError
to act on these exceptions.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.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
public MessageDigest importData(Long pixId, String fileName, int series, ImportSize size) throws loci.formats.FormatException, IOException, omero.ServerError
ImportEvent.IMPORT_STEP
is raised with the number of the
iteration just completed.series
- loci.formats.FormatException
IOException
omero.ServerError
public void clear()
Version: 4.4.12-ice34-b116
Copyright © 2014 The University of Dundee & Open Microscopy Environment. All Rights Reserved.