epam / cloud-pipeline

Cloud agnostic genomics analysis, scientific computation and storage platform
https://cloud-pipeline.com
Apache License 2.0
145 stars 58 forks source link

Preview for the HCS images #2489

Open NShaforostov opened 2 years ago

NShaforostov commented 2 years ago

Background

In similar way as we've implemented the support of the "Patology images" previews in the Cloud-Pipeline, we should implement the support of previews of HCS images received by confocal microscopy methods.

Approach

For our issue, each HCS image represents a scope of raw tiff images and metadata xml file(s) united by one measurement. We shall implement the ability to preview that image bunches as united objects.

Short description of HCS image in context of our issue:

Data structure

The minimal intended structure for the raw images data in the object data storage should be the following:

Open preview

There shall be the following ways to open a preview for the HCS images:

Preview pop-up

Preview pop-up shall contain:

In general case, the preview pop-up should look like the following: image

Plate panel

For each HCS measurement, there are one or several plates that include own bunches of images. Plates are defined inside the <Plates> tag of the index.xml file. At the Plate section, there should be:

Well panel

This panel should include:

On the symbolic "map", should be shown:

Each well includes one or several field. An own raw set of tiff files corresponds to each field. So, the whole well image consists from all available fields.

Field of the image can be defined by the tag <FieldID> inside the <Image> tag. Position of the fields on the well image can be defined by tags <PositionX> and <PositionY> inside the <Image> tag.

Channel panel

This panel shall include all channels list corresponds to the current plate. Total image in the image preview frame should be shown as additive blending of well images of the selected channels. By default, all channels should be selected. Full list of channels can be received from inside the <Map> tags - entries with ChannelID option.

For each channel item at the Channel panel, there should be:

Example of the image above with the disabled violet channel (Ch_1): image

Example of the image above with expanded violet channel settings and regulation of the channel contrast by the slider: image

Stack panel

This panel shall allow to change the plane of the displayed well image (i.e. to view images on different depth by z-coordinate). The count of well planes can be defined as max value of the PlaneID values (<PlaneID> tags inside the <Image> tags). Stack panel should be shown for the plate, only if the count of planes is more than 1.

This panel should contain:

Example of the Stack panel for the well with 4 planes: image

This panel should be located under Well panel (when the count of planes is more than 1). Let's suggest that well image from the main scheme above has 3 planes and we've switched to another one. The view should be like: image

Time series

Well images can be scanned in different time points. The series of the same well images in different time points are united in sequences. Note: often, all images are made in a single time point of a single sequence

If there are several sequences for the plate or in any sequence the count of time points is greater than 1, the Time series panel should appear under the image preview. By this panel, user shall have the ability to select a sequence or/and a time point in a sequence - to receive the well images corresponding this time moment.

The count of sequences can be defined as max value of the SequenceID values (<SequenceID> tags inside the <Image> tags). The count of time points in a sequences can be defined as max value of the TimepointID values (<TimepointID> tags inside the <Image> tags) for the same SequenceID.

Time series panel should contain:

Example of the Time series panel with 3 sequences: image

Wedds commented 2 years ago

Preview files layout

This section describes the proposal regarding the structure of files to be consumed by a previewer. Each sequence will be presented by a separate OME-TIFF file. OME-TIFF is a multi-paged TIFF image, it supports wells' structure and allows working with image channels.

Besides, some previewers support index files to be used with OME-TIFF for optimizing the load time of remote files (ex. viv).

Assuming, that raw HCS data is stored in s3://hcs-data/Measurement123 directory, following files should be generated:

├── Measurement123/                   // raw HCS
├── Measurement123.hcs                // previewer entrypoint, called an 'additional synthetic file' before
└── .hcsparser/ 
│   ├── Measurement123/
│   │   ├── 1/                        // sequence level
│   │   │   ├── data.ome.tiff         // sequence data 
│   │   │   ├── data.offsets.json     // load-optimizing index
│   │   │   ├── wells_map.json        // navigation mapping

<ExperimentName>.hcs is a JSON file with the following schema:

{
    "sourceDir": "s3://hcs-data/Measurement123", 
    "previewDir": "s3://hcs-data/.hcsparser/Measurement123", 
    "plate_height": "8", 
    "plate_width": "12", 
    "time_series_details": { // map of (sequence: list<timepoints>) entries
        "1": ["1", "2"],
        "2": ["1", "2", "3"]
    }
}

wells_map.json is a 'navigation' mapping, which helps to call a suitable OME well/field according to the values, selected in the previewer. It is required since not all the wells (and their fields) contain meaningful info, besides, OME-TIFF elements have continuous 'flat' indexing instead of 2 coordinates.

{    
    "2_2": {  // well (2;2) details
        "width": 12,
        "height": 12,
        "round_radius": 5.335, // radius from the center, informs whether the round line should be drawn; draw nothing in case `null` or missing
        "to_ome_wells_mapping": {
            "6_6": "ImageID:1", 
            "6_7": "ImageID:2",
            "7_6": "ImageID:3",
            "7_7": "ImageID:4" 
        }            
    },     
    ...
    "4_2": {  
        "width": 12,
        "height": 12,
        "round_radius": 5.335,
        "to_ome_wells_mapping": {           
            "7_6": "ImageID:23",
            "7_7": "ImageID:24"
        }            
    },     
    ...
    "7_3": {  
        "width": 12,
        "height": 12,
        "round_radius": 5.335,
        "to_ome_wells_mapping": {
            "6_6": "ImageID:45", 
            "6_7": "ImageID:46",
            "7_6": "ImageID:47",
            "7_7": "ImageID:48" 
        }            
    }    
}
maryvictol commented 1 year ago

Test case was created by #2786 and located here.