public class OmeroBrowser extends Object implements Closeable
Constructor and Description |
---|
OmeroBrowser(String user,
String pass,
String host,
int port)
Initialise browser.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect()
Connect to Omero.
|
void |
download(ImageData image,
Path path)
Download image and attachment.
|
DatasetData |
findDataset(Long id)
Find dataset of specified id.
|
DatasetData |
findDataset(String name)
Find dataset of specified name.
|
ImageData |
findImage(Long imageId,
DatasetData name)
Find image of specified id in dataset.
|
ImageData |
findImage(String imageName,
DatasetData name,
boolean allowDuplicates)
Find image of specified name in the dataset.
|
List<DatasetData> |
listDatasets()
List datasets.
|
List<ProjectData> |
listProjects()
List projects.
|
static void |
main(String[] args)
Dummy tests.
|
Collection<ImageData> |
openDataset(DatasetData name)
Open dataset.
|
void |
silentClose()
Close Omero without exception.
|
void |
upload(String[] pathsToImages,
DatasetData name)
Upload specified image to dataset.
|
void |
upload(String imageName,
String pathToAttach,
DatasetData name)
Upload attachment and attach it to image from dataset.
|
public void connect() throws DSOutOfServiceException, QuimpException, URISyntaxException, ServerError, Glacier2.PermissionDeniedException, Glacier2.CannotCreateSessionException
All fields provided to OmeroBrowser(String, String, String, int)
must contain
nonempty strings. Throw exception if connection unsuccessful.
DSOutOfServiceException
- connection errorQuimpException
- if any of fields: user/pass/host is empty or nullURISyntaxException
- on Omero errorGlacier2.CannotCreateSessionException
- on Omero errorGlacier2.PermissionDeniedException
- on Omero errorServerError
- on Omero errorpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void silentClose()
public List<ProjectData> listProjects() throws DSOutOfServiceException, DSAccessException, ExecutionException
DSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorExecutionException
- on Omero errorpublic List<DatasetData> listDatasets() throws DSOutOfServiceException, DSAccessException, ExecutionException
DSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorExecutionException
- on Omero errorpublic Collection<ImageData> openDataset(DatasetData name) throws ExecutionException, DSOutOfServiceException, DSAccessException
name
- dataset nameExecutionException
- on Omero errorDSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorpublic DatasetData findDataset(String name) throws DSOutOfServiceException, DSAccessException, ExecutionException
name
- name of datasetDSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorExecutionException
- on Omero errorpublic DatasetData findDataset(Long id) throws DSOutOfServiceException, DSAccessException, ExecutionException
id
- id of datasetDSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorExecutionException
- on Omero errorpublic ImageData findImage(String imageName, DatasetData name, boolean allowDuplicates) throws ExecutionException, DSOutOfServiceException, DSAccessException, QuimpException
If there is more than 1 image with specified name, then depending on allowDuplicates the newest will be returned (true) or exception thrown (false).
imageName
- image name to look forname
- dataset nameallowDuplicates
- if true newest image is returned if there is more than 1 image with
imageName in the dataset, otherwise exception is thrownExecutionException
- omero errorDSOutOfServiceException
- omero errorDSAccessException
- omero errorQuimpException
- if there are multiple images with the same name and
allowDuplicates==falsepublic ImageData findImage(Long imageId, DatasetData name) throws ExecutionException, DSOutOfServiceException, DSAccessException
imageId
- id to findname
- dataset nameExecutionException
- on Omero errorDSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorpublic void upload(String[] pathsToImages, DatasetData name) throws Exception
pathsToImages
- list paths of imagesname
- dataset nameException
- on errorpublic void upload(String imageName, String pathToAttach, DatasetData name) throws IOException, DSOutOfServiceException, DSAccessException, ServerError, ExecutionException, QuimpException
Image is already in dataset.
imageName
- image name in datasetpathToAttach
- path to attachmentname
- dataset nameIOException
- on file errorDSOutOfServiceException
- on Omero errorDSAccessException
- on Omero errorServerError
- on Omero errorExecutionException
- on Omero errorQuimpException
- on Omero error - no image in datasetpublic void download(ImageData image, Path path) throws DSOutOfServiceException, ServerError, DSAccessException, ExecutionException, IOException, URISyntaxException, Glacier2.PermissionDeniedException, Glacier2.CannotCreateSessionException
image
- image with attachment (if no attachment only image is downloaded)path
- path to file (should be not file name)DSOutOfServiceException
- on Omero errorServerError
- on Omero errorDSAccessException
- on Omero errorExecutionException
- on Omero errorIOException
- on file errorURISyntaxException
- on Omero errorGlacier2.PermissionDeniedException
- on Omero errorGlacier2.CannotCreateSessionException
- on Omero errorpublic static void main(String[] args)
args
- argsCopyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.