GuillaumeMougeot / simple-omero-client

Maven project to easily connect to OMERO.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java CI with Maven codecov

simple-omero-client

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.

How to use:

Connection:

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);

Repository objects (projects, datasets, images)

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);
    //...
}

Annotations

For each type of objects (project, dataset or image), annotations can be retrieved/added, such as:

  • Tags:

TagAnnotationWrapper tag = new TagAnnotationWrapper(client, "name", "description");
dataset.addTag(client, tag);
List<TagAnnotationWrapper> tags = dataset.getTags(client);
  • Key/Value pairs:

dataset.addPairKeyValue(client, "key", "value");
String value = dataset.getValue(client, "key");
  • Tables:

TableWrapper table = new TableWrapper(columnCount, "name");
dataset.addTable(client, table);
List<TableWrapper> tables = dataset.getTables(client);
  • Files:

File file = new File("file.csv");
dataset.addFile(client, file);

Images

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

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();

License

GPLv2+

About

Maven project to easily connect to OMERO.

License:GNU General Public License v2.0


Languages

Language:Java 99.2%Language:Shell 0.7%Language:Dockerfile 0.0%