Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should updateDraw be used? #1752

Closed
xgrg opened this issue Sep 10, 2024 · 7 comments
Closed

How should updateDraw be used? #1752

xgrg opened this issue Sep 10, 2024 · 7 comments
Labels
question Further information is requested
Milestone

Comments

@xgrg
Copy link

xgrg commented Sep 10, 2024

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

@ivmartel ivmartel added the question Further information is requested label Sep 12, 2024
@ivmartel ivmartel added this to the 0.34.0 milestone Sep 12, 2024
@ivmartel
Copy link
Owner

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.

@xgrg
Copy link
Author

xgrg commented Sep 12, 2024

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.

@ivmartel
Copy link
Owner

Ah, got it, getDrawDisplayDetails returns a DrawDetails[] and udpateDraw expects a single DrawDetails.

@xgrg
Copy link
Author

xgrg commented Sep 12, 2024

Oh! Fantastic! Thank you so much @ivmartel, it helps a lot.

@xgrg
Copy link
Author

xgrg commented Sep 12, 2024

Just wondering, are you suggesting that moving to DICOM SR will have an impact on the support of vector-based annotations?

@ivmartel
Copy link
Owner

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.

@xgrg
Copy link
Author

xgrg commented Sep 12, 2024

Understood. In our use case I assume we are going to keep needing the support of vector-based data. We will see how it develops then. Thank you @ivmartel!

@xgrg xgrg closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants