Skip to content

AddImage

Chaunte W. Lacewell edited this page Aug 9, 2023 · 5 revisions

AddImage Command

This call allows the application to add an image in VDMS. The bare minimum requirement for this call is the image blob. The binary image blob should follow the json string. While the application can choose to associate no properties or no collections with this image, it will make it harder to find the image later in such situations. In all scenarios, this call will also lead to an addition of an entity with class "Image" into the metadata database. If an operation is specified, the operation is performed before storing the image. If a collection is defined, it will link the image with that collection. If information is provided to link this image with some previously searched or added entity through a user/application specified id, then such a link is also added in the metadata database.

Parameters

  • [optional] _ref: for reference.
  • [optional] format: Specify the format used to store the image [jpg, png, tdb]. By default, the image will be kept in its original format.

Blocks

  • [optional] operations
  • [optional] properties
  • [optional] constraints
  • [optional] link

Inference Image Format

When ingesting an image, VDMS uses OpenCV calls to read the image and extract metadata (imread). This image is then saved (imwrite). This can result in a change in image quality more for lossy image formats (jpg). The resulting loss has been shown to impact the accuracy of inference algorithms. If VDMS is being integrated into an inference workflow, it is recommended to use 'png', a lossless format.

Examples

// Insert an image, save it as png, and apply a threshold operation
// before storing.
[
    {
        "AddImage":
        {
            "format": "png",
            "operations": [
                {
                    "type": "threshold",
                    "value": 155
                }
            ],

            "properties":
            {
                "type": "scan",
                "part": "brain"
            }
        }
    }
]
+blob // the actual image as a blob


// Insert an image linked to a patient found using FindEntity
[
    {
        "FindEntity":
        {
            "_ref": 34,
            "class": "patient",
            "constraints" : {
                "bcr_patient_barc": [ "==", "TCGA-02-0070" ]
            }
        },
        "AddImage":
        {
            "format": "jpg",
            "operations": [
                {
                "type": "threshold",
                "value": 155
                }
            ],
            "link": {
                "class": "scan_for",
                "ref": 34,
                "direction": "in"
            }
        }
    }
]
+ blob

Note: For full example, please see Wiki: Images Example, C++ Test: add_image, or Python Test: insertImage.

Clone this wiki locally