Skip to content

PlantDB REST APILink

Hereafter we introduce the URLS to use to communicate via the REST API. The Python implementation is done in the plantdb.rest_api module and the CLI to start a Flask server is in fsdb_rest_api.

REST URLsLink

/scansLink

Here are the specifications for the /scans URL:

/scans/<scan_id>Link

Here are the specifications for the /scans/<scan_id> URLs:

Warning

This requires the Colmap task! In other words it will fail (response 500) if this task is missing from the dataset.

/files/<path>Link

Here are the specifications for the /files/<path> URLs:

/archive/<scan_id>Link

Here are the specifications for the /archive/<scan_id> URLs:

/image/<scan_id>/<fileset_id>/<file_id>Link

Here are the specifications for the /image/<scan_id>/<fileset_id>/<file_id> URLs:

/pointcloud/<scan_id>/<fileset_id>/<file_id>Link

Here are the specifications for the /pointcloud/<scan_id>/<fileset_id>/<file_id> URLs:

/pcGroundTruth/<scan_id>/<fileset_id>/<file_id>Link

Here are the specifications for the /pcGroundTruth/<scan_id>/<fileset_id>/<file_id> URLs:

  • Resource: plantdb.rest_api.PointCloudGroundTruth
  • Arguments: size in {orig, preview} or a float to control the voxel-size of the pointcloud to returns.
  • Returns: The ground-truth pointcloud file, original size by default.

/mesh/<scan_id>/<fileset_id>/<file_id>Link

Here are the specifications for the /mesh/<scan_id>/<fileset_id>/<file_id> URLs:

/refreshLink

Refresh the list of scans in the plantdb.fsdb.FSDB database.

Here are the specifications for the /refresh URL:

Scan summaryLink

Information about scans dataset, obtained with the '/scans' URL, are grouped in a JSON dictionary. The template can be accessed here: plantdb.rest_api.get_scan_template

It is organized as follows:

{
  "id": "scan_id",
  "metadata": {
    "date": "01-01-00 00:00:00",
    "species": "N/A",
    "plant": "N/A",
    "environment": "N/A",
    "nbPhotos": 0,
    "files": {
      "metadatas": null,
      "archive": null
    }
  },
  "thumbnailUri": "",
  "hasPointCloud": false,
  "hasMesh": false,
  "hasSkeleton": false,
  "hasTreeGraph": false,
  "hasAngleData": false,
  "hasAutomatedMeasures": false,
  "hasManualMeasures": false,
  "hasSegmentation2D": false,
  "hasPcdGroundTruth": false,
  "hasPointCloudEvaluation": false,
  "hasSegmentedPointCloud": false,
  "error": false
  }

idLink

The name of the corresponding scan dataset.

metadataLink

Some metadata gathered from the corresponding scan dataset.

JSON dictionary with fields:

  • "date": String, example "2019-02-01 13:35:42"
  • "plant": String
  • "species": String
  • "nbPhotos": Number
  • "environment": String
  • "files": Object
    • "files.metadatas": String, URL, example "/files//metadata/metadata.json"
    • "files.archive": String, URL, example "/files//Visualization/scan.zip"

thumbnailUriLink

A path to the thumbnail image to use as "preview" to represent the dataset in the webapp.
* thumbnailUri: example "/files//Visualization/thumbnail_pict20190201_134037_0.jpg"

has*Link

All of the has* entries indicate if there is an output for a list of selected tasks:

  • hasPointCloud: output of the task PointCloud has a PointCloud.ply file
  • hasMesh: output of the task TriangleMesh has a TriangleMesh.ply file
  • hasSkeleton: output of the task CurveSkeleton has a CurveSkeleton.json file
  • hasAngleData: output of the task AngleAndInternodes has a AnglesAndInternodes.json file
  • hasAutomatedMeasures: output of the task AutomatedMeasures has a AnglesAndInternodes file
  • hasSegmentation2D: output of the task Segmentation2D has a `` file
  • hasSegmentedPcdEvaluation: output of the task Segmentation2DEvaluation has a `` file
  • hasPointCloudEvaluation: output of the task PointCloudEvaluation has a `` file
  • hasSegmentedPointCloud: output of the task SegmentedPointCloud has a SegmentedPointCloud.ply file
  • hasPcdGroundTruth: output of the task PointCloudGroundTruth has a PointCloudGroundTruth.ply file

Finally, hasManualMeasures refers to the presence of a JSON file with manual measurements saved as measures.json. This file should be present at the scan dataset root directory.

Scan detailed summaryLink

Information about a specific scan dataset, obtained with the '/scans/' URL, are grouped in a JSON dictionary.

It has the same information as those gathered with the '/scans' URL, but also add: * the files URI when the following has* entries are True: * hasPointCloud, under "filesUri"/"pointCloud" * hasMesh, under "filesUri"/"mesh" * hasSkeleton, under "filesUri"/"skeleton" * hasTreeGraph, under "filesUri"/"tree" * the files data when the following has* entries are True: * hasSkeleton, under "data"/"skeleton" * hasAngleData, under: * "data"/"angles"/"angles" for the angle values * "data"/"angles"/"internodes" for the internodes values * hasManualMeasures, under: * "data"/"angles"/"measured_angles" for the angle values * "data"/"angles"/"measured_internodes" for the internodes values * the reconstruction bounding-box (formerly known as 'workspace') under "workspace", for example "{"x": [340, 440], "y": [330, 410], "z": [-180, 105]}" * the camera model and its intrinsics parameters under "camera"/"model", see here for more details * the list of camera poses, a.k.a. extrinsic parameters, under "camera"/"poses", see here for more details

Camera modelLink

The details about the camera poses accessible under "camera"/"model" are: * id: the id of the camera model, should always be 1 if we use a single camera * model: the name of the camera model, should always be 'OPENCV' as this is how we save it * width: the width of the images * height: the height of the images * params: the 'OPENCV' intrinsic camera parameters, that is fx, fy, cx, cy, k1, k2, p1, p2.

For example with the first image:

{
  "id": 1,
  "model": "OPENCV",
  "width": 1440,
  "height": 1080,
  "params": [1166.9518889440105, 1166.9518889440105, 720, 540, -0.0013571157486977348, -0.0013571157486977348, 0, 0]
}

Camera posesLink

The details about the camera poses accessible under "camera"/"poses" are: * "id": index of the picture (starts at 1 by COLMAP convention) * "rotmat": Rotation matrix, 3x3 array * "tvec": Translation vector, 3x1 array * "thumbnailUri": URI to the thumbnail image, example "/images//images/?size=thumb.jpg" * "photoUri": URI to the original image, example "/images//images/?size=orig.jpg"

For example with the first image:

{
  "id": 1,
  "tvec": [369.4279687732083, 120.36109311437637, -62.07043190848918],
  "rotmat": [
    [0.06475585405884698, -0.9971710205080586, 0.038165890845442085],
    [-0.3390191175518756, -0.0579549181538338, -0.9389926865509284],
    [0.9385481965778085, 0.04786630673761355, -0.34181295964290737]
  ],
  "photoUri": "/tmp/ROMI_DB/real_plant_analyzed/images/00000_rgb.jpg",
  "thumbnailUri": "/tmp/ROMI_DB/real_plant_analyzed/webcache/6fbae08f195837c511af7c2864d075dd5cd153bc.jpeg", 
  "isMatched": true
}