Skip to main content

FindImage

Find images that satisfy the specified constraints.

This command enables visual operations, using the operations parameter.

Images are returned as blobs in the array of blobs.

Parameters

  • [optional] as_format: Specify the format of the returned bounding boxes ["jpg", "png"]. By default, the images will keep their original format.
  • [optional] blobs: indicates whether pixel data will be returned as part of the response (Default: false).
  • [optional] urls: indicates whether URLs of the matched images will be returned as part of the response (Default: false).
  • [optional] with_url: Provide a valid URL to match as a constraint
  • [optional] operations

Details

The *as_format** parameter can be used to re-encode the image in a format different from the one stored in ApertureDB. The encoding will be performed on-the-fly and will not affect the original image stored in ApertureDB. By default, the images will be returned in their 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.

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 defined in operations parameter will be performed on-the-fly and will not affect the original image stored in ApertureDB.

By default, the blob corresponding to the encoded image will be returned in the array of blobs:. It is possible to specify the blob not to be returned by setting the blobs parameter to "false".

If only one ref parameter is used in the is_connected_to array, the resulting objects obtained after traversing the given connection can be associated with their source objects by specifying the parameter group_by_source as true. The parameter is ignored if is_connected_to is absent. It is set to false by default.

Examples

Find images which has the "year_captured" property less than 1970, and resize them to 224x224, and retrieve the "year_captured" property for each image:


[{
"FindImage": {
"constraints": {
"year_captured": ["<=", 1970]
},
"operations": [{
"type": "resize",
"width": 224,
"height": 224
}],
"blobs": true,
"results": {
"list": ["year_captured"]
}
}
}]

Successful response:


[{
"FindImage": {
"blobs_start": 0,
"entities": [{
"year_captured": 1970,
"_blob_index": 0
}],
"returned": 1,
"status": 0
}
}]

Find all the images connected to an Entity of class "Patient" with a specific "patient_id" property, resize the images to 1024x1024, and encode the images using "png" format:


[{
"FindEntity": {
"_ref": 1,
"with_class": "Patient",
"unique": true,
"constraints": {
"patient_id": ["==", "TCGA-02-0070"]
}
}
}, {
"FindImage": {
"as_format": "png",
"operations": [{
"type": "resize",
"width": 1024,
"height": 1024
}],
"blobs": true,
"is_connected_to": {
"ref": 1
}
}
}]

Successful response:


[{
"FindEntity": {
"status": 0,
"returned": 0
}
}, {
"FindImage": {
"blobs_start": 0,
"returned": 1,
"status": 0
}
}]