AddImage

Add a new image and properties associated with it.

Either an encoded image must be provided in the array of blobs or you can provide a url where the image is.

Parameters

  • [optional] _ref: Reference to be used within the transaction.

  • [optional] format: Specify the format used to store the image.

  • [optional] url: Provide a valid URL instead of passing a blob.

  • [optional] properties

  • [optional] if_not_found

  • [optional] connect

  • [optional] operations

Details

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

if_not_found can be used to turn this command into “conditional add”. Check if_not_found for more details.

connect can be used to create a connection between the added object and other object(s). Check connect for more details.

The format parameter can be used to re-encode the image into a format different from the original one passed in the array of blobs.

Instead of passing a blob to this command, if you would like to add an image without moving it away from a remote storage location such as a cloud bucket that it currently is present in, you can specify a valid URL to that image.

An object pointed to by the url can be modified outside of the scope of the server. It might also be subject to a retention policy as determined by the storage target policies. When accessing this object through a Find* command, appropriate error will be returned if the object is no longer accessible.

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

The idea behind using url is typically to avoid moving data from its storage. Therefore, format or operations are not permitted since it would mean downloading the object locally or assuming write permissions at the remote location of the original data.

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": {
        "_ref": 1,
        "with_class": "patient",
        "constraints" : {
            "unique_id": [ "==", "TCGA-02-0070" ]
        }
    }
}, {
    "AddImage": {
        "format": "jpg",
        "operations": [
            {
                "type": "rotate",
                "angle": 45.6
            }
        ],
        "connect": {
            "ref": 1,
            "class": "ScanToPatient",
            "direction": "in"
       }
    }
} ]

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