syntax = "proto3";

package biopb.image;

option java_package = "biopb.image";
option java_multiple_files = true;


import "biopb/image/roi.proto";
import "biopb/image/bindata.proto";

// The Pixels element represent generic 5D pixel data. The time axis is
// currently not being utilized, but is defined here for futire extensibility.
// This is modeled after OME-XML's Pixel structure.
message Pixels {

    // Pixel values
    BinData bindata = 3;

    // A string describing the dimension order of the pixel data, e.g. "XYZCT"
    // The string must be a permutaion of these 5 letters even if some of the
    // dimension doesn't exist in the data.
    string dimension_order = 4;

    // A string describing the data type using numpy's convention. E.g., 'i8'
    // represent int64. Endianness indicator, e.g. '=i8', is allowed but will be
    // ignored. Instead the endianness will be determined by the field within
    // the Bindata structure.
    string dtype = 5;

    // Dimensional size of pixel data array [units:none]
    uint32 size_x = 9;

    uint32 size_y = 10;

    uint32 size_z = 11;

    uint32 size_c = 12;

    uint32 size_t = 13;

    // Physical size of a pixel. 
    optional float physical_size_x = 14;

    optional float physical_size_y = 15;

    optional float physical_size_z = 16;

    // physical size unit, default "µm"
    string physical_size_unit = 17;

    // time_increment is used for time series that have a global timing
    // specification instead of per-timepoint timing info. For example in a
    // video stream. Units are set by TimeIncrementUnit.
    optional float time_increment = 18;

    // time unit, default "s"
    string time_increment_unit = 21;

    // for large image dataset, it is necessary to send a stream of image
    // patches instead of one monolithic data structure of the whole dataset.
    // The offset values allows one to specify the relative locations of each
    // patch.
    optional uint32 offset_x = 22;

    optional uint32 offset_y = 23;

    optional uint32 offset_z = 24;

    optional uint32 offset_t = 25;

}

// Additional annotation of the image, which may be used for the analysis.
//
message ImageAnnotation {

    // a list of region of interest 
    repeated ROI rois = 1;

    // additional text annotation
    string annotation = 2;
}

message ImageData {

    // Encapsulated image data
    Pixels pixels = 1;

    // Optional additional information regarding the image that will be utilized
    // by the RPC call. For example, some SegmentAnything type models may ask
    // the user to provide a tentative bounding box for the objects that the
    // users are interested in.
    ImageAnnotation image_annotation = 2;

}
