Introduction

Minerva is a microscopy imaging software platform which allows visualizing, analyzing and storing high-dimensional microscopy image data. Minerva is designed to be cloud-native, taking full advantage of cloud features such as object storage and serverless computing. It is composed of several integrated applications:

Minerva Cloud

Minerva Cloud is a system where image data can be imported and stored in repositories. The images can be served either as raw image tile data or as composited colorized tiled images.

Minerva Author

Minerva Author is a web tool to build narrated stories around images via selection of specific channel groupings and image views.

Minerva Story

Minerva Story is a web based narrated story based on an image or a set of images. It is the end-product of Minerva Author.

Minerva Analysis

Minerva Analysis TBD

Minerva Atlas

Minerva Atlas TBD

Authentication

Minerva API uses Amazon Cognito for authentication. Clients must authenticate using username and password to obtain an id token for the user. It’s recommended to use a Cognito client library, such as amazon-cognito-identity-js.

Id token must be included in HTTP request headers with each request to Minerva API. Authorization: Bearer ID_TOKEN

Example (Javascript)

import {
  CognitoUserPool,
  AuthenticationDetails,
  CognitoUser
} from 'amazon-cognito-identity-js';

const minervaUserPool = new CognitoUserPool({
    UserPoolId: 'USER_POOL_ID',
    ClientId: 'CLIENT_ID'
});

const cognitoUser = new CognitoUser({
    Username: 'USER_NAME',
    Pool: minervaUserPool
});

const authenticationDetails = new AuthenticationDetails({
    Username: 'USER_NAME',
    Password: 'PASSWORD'
});

cognitoUser.authenticateUser(authenticationDetails, {
    onSuccess: result => success(result),
    onFailure: err => fail(err)
});

Response

{
    "AuthenticationResult": {
        "AccessToken":"ACCESS_TOKEN",
        "ExpiresIn":36000,
        "IdToken":"ID_TOKEN",
        "RefreshToken":"REFRESH_TOKEN",
        "TokenType":"Bearer"
    },
    "ChallengeParameters":{}
}

Response status codes

Success

Successful request will return Status: 200 OK

If a new resource is created as a result of the request, the response may be Status: 201 Created

Error

In case of error, the response will contain an object with a detailed error message.

Status: 403 Forbidden

{
    error: 'Unauthorized operation',
}

Status codes

Status code Description
200 Request OK
400 Request is invalid or malformed
403 No permission for the image or other operation
404 Image or tile not found
422 Request is invalid
500 Server error

Minerva CLI

Minerva Command Line Interface

Minerva CLI can be used to import images into Minerva Cloud from the command line. Images can also be exported from Minerva Cloud into local disk.

Install Minerva CLI

# Use Python >= 3.7
pip install minerva-cli
minerva configure

Importing

Import a directory into Minerva Cloud. All images within the directory will be imported. The given repository will be created if it does not exist already. By default the image will be processed server side.

minerva import -r repository_name -d /home/user/images

Optionally when importing OME-TIFF files, the image can be processed client side by passing the argument –local. Local import can be faster when importing just a single or few files.

minerva import --local -r repository_name -f /home/user/images/single_image.ome.tif

Check importing process status.

minerva status

Exporting

Export an image from Minerva Cloud into local disk. Image uuid has to be given with argument –id.

minerva export --id 123e4567-e89b-12d3-a456-426614174000

Minerva CLI code is available from GitHub

Importing images

About importing images

This section describes the low-level mechanics of image importing. The easiest way to import images is to use either Minerva Cloud web interface or Minerva CLI.

Multichannel microscopy images tend to be large, a typical image might be in the range of 10-200 GBs. Importing them takes several minutes to one hour. AWS Lambda timeout is not enough and therefore the image importing process is run in a background AWS Batch job. The import process generates a tiled image pyramid (or uses an existing pyramid) and stores it in S3 as OME-ZARR, a highly scalable tile structure. The original image file is either discarded or it can be archived in low-cost S3 Glacier.

Import steps

1. Create a repository

Create a new repository to put the image in. You can skip this step when using an existing repository.

curl -X POST -H "Content-Type: application/json" -d '{"name": "Repository 1", "raw_storage": "Destroy"}' https://$BASE_URL/repository

The response will contain a repository uuid which must be used in the next step.

2. Create an import

First we need a new import object which will be used for tracking the progress.

curl -X POST -H "Content-Type: application/json" -d '{"name": "Import 1", "repository_uuid": "123e4567-e89b-12d3-a456-426614174000"}' https://$BASE_URL/import

The response will contain an import uuid which must be used in the next step.

3. Get S3 credentials for the import key

Next we must request temporary AWS credentials to obtain upload access to Minerva’s S3 bucket.

curl -X GET https://$BASE_URL/import/{import_uuid}/credentials

The response will contain AWS credentials, S3 bucket name and key to upload the import into.

4. Upload the image to the S3 bucket/key

Upload the image to the given S3 bucket and key, using the provided AWS temporary credentials (NOT the user’s credentials). You can use e.g. AWS CLI or any programmatic client like boto3 for Python.

import boto3

# Replace values of AccessKeyId, SecretAccessKey, SessionToken, Bucket, Key with values obtained from the previous step.

s3 = boto3.client("s3", aws_access_key_id="AccessKeyId",
                    aws_secret_access_key="SecretAccessKey",
                    aws_session_token="SessionToken",
                    region_name="us-east-1")

s3.upload_file("/images/image1.ome.tif", "Bucket", "Key/Image_Name.ome.tif")

5. After the upload has finished, mark the import complete

Marking the import complete will trigger the AWS Batch Job, so it must be done only after uploading has finished.

curl -X PUT -H "Content-Type: application/json" -d '{"complete": true }' https://$BASE_URL/import/{import_uuid}

6. Wait for the import Batch Job to finish

The import Batch Job may take around 10-60 mins, depending on image size and EC2 instance availability. The status of the import can be checked with:

curl -X GET https://$BASE_URL/import/{import_uuid}/filesets

GET /image/{uuid}/render-tile/{x}/{y}/{z}/{t}/{level}/{channels+} Render tile

Render a tile from an image.

Request

Parameter Description
uuid Image uuid
x Tile X coordinate
y Tile Y coordinate
z Tile Z coordinate
t Time, integer (use 0 for single images)
level Pyramid level (0=highest detail)
channels Channel rendering settings, see the details below.


Channel rendering settings

Pattern for settings is: index1,color1,min1,max1/index2,color2,min2,max2/… 0,FFFFFF,0.1,0.9/1,00FF00,0.2,0.8

  • index - Index of the channel (integer, indexing starts from 0)
  • color - RGB in hex format, e.g. the representation for color blue is 0000FF
  • min - Min intensity value (floating point 0-1.0)
  • max - Max intensity value (floating point 0-1.0)

Response

Image tile encoded as 8-bit per RGB channel JPEG (binary).

Example

curl -X GET -H "Authorization: Bearer ID_TOKEN" https://DOMAIN/STAGE/image/123e4567-e89b-12d3-a456-426614174000/render-tile/1/2/0/0/1/0,FFFFFF,0.1,0.9/1,00FF00,0.2,0.8

This request will render the following tile:

  • Image uuid 123e4567-e89b-12d3-a456-426614174000
  • X = 1
  • Y = 2
  • Z = 0
  • T = 0
  • Level = 1
  • Channel 0 as white with intensity scaled between 0.1-0.9
  • Channel 1 as green with intensity scaled between 0.2-0.8

GET /image/{uuid}/prerendered-tile/{x}/{y}/{z}/{t}/{level}/{rs_uuid} Prerendered tile

Get a prerendered tile from an image.

This endpoint is similar to render-tile, but it uses rendering settings stored in the database. This allows caching frequently used tiles and rendering settings.

Request

Parameter Description
uuid Image uuid
x Tile X coordinate
y Tile Y coordinate
z Tile Z coordinate
t Time, integer (use 0 for single images)
level Pyramid level (0=highest detail)
rs_uuid Rendering settings uuid


Response

Image tile encoded as 8-bit JPEG (binary).

Example

curl -X GET -H "Authorization: Bearer ID_TOKEN" https://DOMAIN/STAGE/image/123e4567-e89b-12d3-a456-426614174000/prerendered-tile/1/2/0/0/1/123e4567-e89b-12d3-a456-426614174000

GET /repository List repositories

Lists all repositories which the user is authorized to access.

Request

Response

Returns a list of repository UUIDs and the user’s permission levels. The response includes a full list of Repository objects.

{
  "data": [
    {
      "subject_uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "repository_uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "permission": "Admin"
    }, 
    {
      "subject_uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "repository_uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "permission": "Read"
    }
  ], 
  "included": 
    {
      "repositories": [
        {
          "uuid": "123e4567-e89b-12d3-a456-426614174000", 
          "name": "Repository 1", 
          "raw_storage": "Destroy", 
          "access": "Private"
        },
        {
          "uuid": "123e4567-e89b-12d3-a456-426614174000", 
          "name": "Repository 2", 
          "raw_storage": "Destroy",
          "access": "PublicRead"
        }
      ]
    }
}

GET /repository/{uuid}/images List images in a repository

Lists all images in a repository.

Request

Parameter Description
uuid Repository uuid

Response

Returns a list of Image objects.

{
  "data": [
    {
      "repository_uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "tile_size": 1024, 
      "format": "tiff", 
      "pyramid_levels": 6, 
      "fileset_uuid": "123e4567-e89b-12d3-a456-426614174000",
      "uuid": "123e4567-e89b-12d3-a456-426614174000", 
      "name": "image.ome", 
      "deleted": false, 
      "compression": "zstd"
    }
  ],
  "included": {}
}

GET /image/{uuid} Get image details

Get image details.

Request

Parameter Description
uuid Image uuid

Response

{
  "data": 
  {
    "repository_uuid": "123e4567-e89b-12d3-a456-426614174000", 
    "format": "tiff", 
    "uuid": "123e4567-e89b-12d3-a456-426614174000", 
    "deleted": false, 
    "name": "image.ome", 
    "fileset_uuid": "123e4567-e89b-12d3-a456-426614174000", 
    "pyramid_levels": 6, 
    "compression": "zstd", 
    "tile_size": 1024
  }, 
  "included":
  {
    "rendering_settings": [
      {
        "label": "Channel group 1", 
        "uuid": "123e4567-e89b-12d3-a456-426614174000", 
        "image_uuid": "123e4567-e89b-12d3-a456-426614174000", 
        "channels": [
          {
            "id": 0, 
            "max": 0.5, 
            "min": 0, 
            "color": "ff00ff", 
            "label": "Channel 0"
          },
          {
            "id": 1, 
            "max": 0.5, 
            "min": 0, 
            "color": "00ff00", 
            "label": "Channel 1"
          }
        ]
      }]
    }
  }

GET /image/{uuid}/metadata Get image metadata

Get image OME metadata as OME-XML.

Request

Parameter Description
uuid Image uuid


Response

<OME>
    <Image ID="Image">
        ...
    </Image>
</OME>

Repository

Repository object describes an image repository, which is a collection of images.

Repository

Attribute Description
uuid Repository uuid (universally unique identifier)
name Repository name (must be unique)
raw_storage Controls whether original image is kept after importing (Archive, Live, Destroy)
access Does repository control read access (Private, PublicRead)

Image

Image object describes a single image. Does not contain pixel data (which is stored in S3 object storage).

Image

Attribute Description
uuid Image uuid (universally unique identifier)
name Image name
deleted Image has been marked for deletion
format File format of the underlying object storage (tiff, zarr, etc.)
compression Method used for compressing raw image data (zstd, png, etc.)
tile_size Tile size for the image pyramid (default 1024)
pyramid_levels Number of detail levels in the image pyramid
fileset_uuid Fileset uuid, can be null
repository_uuid Repository uuid