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

Segmentation saved successfully but not showing after reload #84

Closed
katjaq opened this issue Jan 2, 2025 · 4 comments
Closed

Segmentation saved successfully but not showing after reload #84

katjaq opened this issue Jan 2, 2025 · 4 comments

Comments

@katjaq
Copy link
Member

katjaq commented Jan 2, 2025

after segmenting slice 54 and 55 here https://microdraw.pasteur.fr/project/FIINDv2?source=https%3A%2F%2Fmicrodraw.pasteur.fr%2FF117_P32_Nissl%2FF117_P32_Nissl.json&project=FIINDv2&slice=53
The segmentations were “successfully saved”. I was the only user connected. After reload, the segmentations were not showing anymore.
Idea: These slices are part of the “differently named” slices, so in the json file for the data there is a name array, where we add info on slice names (like in these slices). My hope is that my segmentations just don’t show currently, but are well in the database and will reappear once the error is fixed.

segmented using Safari iOS
Checked in chrome
these are the error messages in the console
microdraw.js:476 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Regions')
at Object.newRegion (microdraw.js:476:33)
at Object._addRegions (microdraw.js:1339:14)
at Object.initAnnotationOverlay (microdraw.js:1422:34)

could you have a look at this @ntraut ? That would be fantastic! ❤️

@r03ert0
Copy link
Member

r03ert0 commented Jan 3, 2025

the problem seems to be line 1329 in microdraw.js:
const match = data[0].fileID.match(/slice=(\d+)/);
For slice index 53, the display name is "54 (NSA 57)". The code assumes that the slice index and the display name are the same, and furthermore, that the display name is a string that can be converted into a number.
Only the slice index (0 based) should be used for indexing data, and the display name only for display. Fortunately, it seems that data is already saved in the database using the slice index, and not the display name.

@r03ert0
Copy link
Member

r03ert0 commented Jan 3, 2025

argh.. no, in fact the data is indexed using the display name: https://microdraw.pasteur.fr/F117_P32_Nissl/F117_P32_Nissl.json&slice=54 (NSA 57) instead of https://microdraw.pasteur.fr/F117_P32_Nissl/F117_P32_Nissl.json&slice=53.

Here's, for example, one of the DB entries:

{
    "_id" : ObjectId("6776dbf547fc2a75bee48234"),
    "fileID" : "https://microdraw.pasteur.fr/F117_P32_Nissl/F117_P32_Nissl.json&slice=54 (NSA 57)",
    "user" : "katjaq",
    "project" : "FIINDv2",
    "Hash" : "-5edfaa41",
    "annotation" : {
        "path" : ["..."],
        "name" : "Region 1",
        "uid" : "9d819dcde390d8"
    },
    "backup" : true
}

We will need to fix the code, and fix the database...

@r03ert0
Copy link
Member

r03ert0 commented Jan 4, 2025

In commit 42f4372 I did a temporary fix for the bug. Instead of matching only numbers in the slice field, I match any string. That fixes the problem for the moment. However, the real solution is to use slice indices exclusively, and to cleanup the database accordingly (plus, the current method maybe allows for xss attacks!)

@r03ert0
Copy link
Member

r03ert0 commented Jan 5, 2025

the additional enhancement is described in issue #86

@r03ert0 r03ert0 closed this as completed Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants