AddImage

Add a new image and properties associated with it.

An encoded image must be provided in the array of blobs.

Parameters

  • [optional] _ref: Reference to be used within the transaction.
  • [optional] format: Specify the format used to store the image.

Blocks

Details

The format parameter can be used to re-encode the image in a format different from the one passes in the array of blobs. By default, the image will be returned in its original format. The only exception is when the image is stored in the “tdb” format, in which case the image will be returned as “jpg” by default.

The properties are key-value pairs associated with the entity. Check properties for more details.

Using the constraints block in AddEntity makes it a “conditional add”. Check constraints for more details.

Operations can be specified through the operations block, all of which will be performed before persisting the image in ApertureDB.

Examples

Insert an image, save it as png, and apply a threshold operation before storing:

[ {
    "AddImage": {
        "properties": {
            "type": "scan",
            "part": "brain"
        }
        "format": "png",
        "operations": [
            {
                "type": "threshold",
                "value": 155
            }
        ]
    }
} ]

# A blob must be passed together with the JSON Query.

Insert an image as a JPG, rotate 45.6 degrees, and create a connection to a “Patient” referenced using FindEntity:

[ {
    "FindEntity": {
        "class": "patient",
        "_ref": 1,
        "constraints" : {
            "unique_id": [ "==", "TCGA-02-0070" ]
        }
    }
}, {
    "AddImage": {
        "format": "jpg",
        "operations": [
            {
                "type": "rotate",
                "angle": 45.6
            }
        ],
        "link": {
            "class": "ScanToPatient",
            "ref": 1,
            "direction": "in"
       }
    }
} ]

# A blob must be passed together with the JSON Query.