A Maven project to easily connect to OMERO.
This library presents a simplified API to put/get objects on an OMERO server.
It can be used from Maven.
The JAR can be put into the ImageJ plugins folder to use it from scripts.
The main entry point is the Client class, which can be used to retrieve, save or delete objects.
To use it, a connection has to be established first:
Client client = new Client();
client.connect("host", 4064, "username", password, groupId);
It can then be used to retrieve all the repository objects the user has access to, like projects or datasets:
List<ProjectWrapper> projects = client.getProjects();
List<DatasetWrapper> datasets = client.getDatasets();
These objects can then be used to retrieve their children:
for(DatasetWrapper dataset:datasets){
List<ImageWrapper> images = dataset.getImages(client);
//...
}
For each type of objects (project, dataset or image), annotations can be retrieved/added, such as:
TagAnnotationWrapper tag = new TagAnnotationWrapper(client, "name", "description");
dataset.addTag(client, tag);
List<TagAnnotationWrapper> tags = dataset.getTags(client);
dataset.addPairKeyValue(client, "key", "value");
String value = dataset.getValue(client, "key");
TableWrapper table = new TableWrapper(columnCount, "name");
dataset.addTable(client, table);
List<TableWrapper> tables = dataset.getTables(client);
File file = new File("file.csv");
dataset.addFile(client, file);
Pixel intensities can be downloaded from images to a Java array or as an ImagePlus:
double[][][][][] pixels = image.getPixels().getAllPixels(client);
ImagePlus imp = image.toImagePlus(client);
Thumbnails of the specified size can be retrieved:
int size = 128;
BufferedImage thumbnail = image.getThumbnail(client, size);
ROIs can be added to images or retrieved from them:
ROIWrapper roi = new ROIWrapper();
roi.addShape(new RectangleWrapper(0, 0, 5, 5));
roi.setImage(image);
image.saveROI(client, roi);
List<ROIWrapper> rois = image.getROIs(client);
They can also be converted from or to ImageJ Rois:
// The property is a string used to create 3D/4D ROIs in OMERO, by grouping shapes sharing the same value
List<ROIWrapper> omeroRois = ROIWrapper.fromImageJ(ijRois, property);
ROIWrapper roi = new ROIWrapper();
roi.addShape(new RectangleWrapper(0, 0, 5, 5));
List<Roi> imagejRois = roi.toImageJ();