How should `updateDraw` be used?
Closed this issue · 7 comments
Hi @ivmartel ,
I looked for some example on how to use DrawController.updateDraw
but I could not find any.
I understood from the documentation that the function takes some drawing details and updates a corresponding drawing with the provided data.
Therefore what I don't understand is why the following gives an error.
dc = app.getActiveLayerGroup().getActiveDrawLayer().getDrawController()
details = dc.getDrawStoreDetails()
dc.updateDraw(details)
[updateDraw] Cannot find group with id: undefined
details
looks like:
{
"88nj4fuzrvx": {
"meta": {
"textExpr": "{surface}",
"quantification": {
"width": {
"value": 50.72241379310344,
"unit": "mm"
},
"height": {
"value": 52.11206896551724,
"unit": "mm"
},
"surface": {
"value": 26.432499256837094,
"unit": "cm²"
},
"min": {
"value": 0
},
"max": {
"value": 2747
},
"mean": {
"value": 2133.9873076923077
},
"stdDev": {
"value": 891.3628205819605
}
}
}
}
}
I can't figure where the problem comes from. I am trying to load some annotations from a set of coordinates/metadata provided in a text file.
Thank you again for your valuable help.
Greg
Hi, I admit the api is confusing here, the details that you want are the draw display details that you get from app.getDrawDisplayDetails()
. You can find examples of it in the https://github.com/ivmartel/dwv-jqmobile project.
Side note: I'm working on #1020 to store annotations as DICOM SR that will change quite a lot the draw api.
Thank you very much for your quick reply. I actually had tested it with:
dc = app.getActiveLayerGroup().getActiveDrawLayer().getDrawController()
details = dc.getDrawDisplayDetails()
dc.updateDraw(details)
But I am getting the same error as with getDrawStoreDetails()
with the message [updateDraw] Cannot find group with id: undefined
.
I am looking for a way to load vector-based annotations (namely bounding boxes and polygons - therefore Rectangle
and Roi
in dwv
terminology) by providing their coordinates.
Any help would be highly appreciated! Thank you again.
Ah, got it, getDrawDisplayDetails
returns a DrawDetails[]
and udpateDraw
expects a single DrawDetails
.
Just wondering, are you suggesting that moving to DICOM SR will have an impact on the support of vector-based annotations?
Yes! The problem with the current annotations is that their format is not standard and that they lack 3D information. With DICOM SR I wish to improve this and allow for easier annotation sharing with external tools.