Technical Questions/suggestions

The return value is an ID that allows stopping the setInterval() function somewhere in the code, if needed.
To be honest, at first I thought, that’s a number of menus already created, but then I thought a little bit and understood it a little better.

1 Like

Thanks for the explanation, there is an improvement after pasting the code, can’t say if its a big or small improvement b/c i’m guessing it’s also got to do with how many segments one has active, but there is an improvement!

1 Like

Yes, it’s very dependent on the number of segments. Previously I was working with around 200 cells, I was seeing slowness after about an hour. Now I have 2 groups of over 600 segments, the problem was being noticeable after 10 minutes or so - that’s why I wrote this piece of code above.
You can also shorten the time between the cleanings. The last number in the code (60000) is time between cleaning in milliseconds.

1 Like

thanks! Will it become slower having to do this very often if i make the 60k into 6/60/600?

The cleaning might be not noticable or visible as a slight stop for a moment. If it isn’t visible to you, you can type 1000. It will be launched every 1s.
Also, I’ve noticed, there’s a problem, that sometimes the menu isn’t available for the last segment in the list, after that segment had been altered (splitted or merged). For now, I know the reason, but don’t know, how to solve it.

1 Like

I’ve created a little TamperMonkey script, so there’s no need to paste the code to the console after each refresh.
Here’s the whole script:

// ==UserScript==
// @name         Temporary fix for menu duplication
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Fix
// @author       Krzysztof Kruk
// @match        https://ngl.flywire.ai/*
// @grant        none
// ==/UserScript==
/* globals viewer */


(function() {
    'use strict';

    setInterval(() => {
        let menus = document.getElementsByClassName('neuroglancer-layer-group-viewer-context-menu')
        let segmentsLength = viewer.saver.pull().state.layers[1].segments.length + viewer.saver.pull().state.layers[1].hiddenSegments.length
        if (menus.length > segmentsLength) {
            for (let i = menus.length - 11; i > segmentsLength + 10; i--) {
                menus[i].remove()
            }
        }
    }, 5000)
})();

To use it, click on the TamperMonkey icon in your browser and select “add new script…”, then replace the presented content with the code above and press Ctrl+S to save the changes. Refresh FW page and the script should work.
The code above is set to do the cleaning every 5s.

2 Likes

I made an update for the script. Now it shouldn’t have the problem with the last segments not having their menus.

// ==UserScript==
// @name         Temporary fix for menu duplication
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Fix
// @author       Krzysztof Kruk
// @match        https://ngl.flywire.ai/*
// @grant        none
// ==/UserScript==
/* globals viewer */


(function() {
    'use strict';

    setInterval(() => {
        const existing = []
        const menus = document.getElementsByClassName('neuroglancer-layer-group-viewer-context-menu')
        const segmentsLength = viewer.saver.pull().state.layers[1].segments.length + viewer.saver.pull().state.layers[1].hiddenSegments.length
        if (menus.length > segmentsLength) {
            for (let i = menus.length - 1; i > 0; i--) {
                const id = menus[i].firstChild.nextSibling.href.split('input_field=')[1].split('=')[0]
                if (existing.includes(id)) {
                    menus[i].remove()
                }
                else {
                    existing.push(id)
                }
            }
        }
    }, 10000)
})()

To update it, just open TamperMonkey Dashboard, open the old script and replace the content with the new one.





New version
(as Edit, because I can’t post more than 3 consecutive posts)

Fix for an error in the console, when there weren’t any visible segments or any hidden segments:

// ==UserScript==
// @name         Temporary fix for menu duplication
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  Fix
// @author       Krzysztof Kruk
// @match        https://ngl.flywire.ai/*
// @grant        none
// ==/UserScript==
/* globals viewer */


(function() {
    'use strict';

    setInterval(() => {
        const existing = []
        const menus = document.getElementsByClassName('neuroglancer-layer-group-viewer-context-menu')
        const layer = viewer.saver.pull().state.layers[1]
        const segmentsLength = (layer.segments ? layer.segments.length : 0) + (layer.hiddenSegments ? layer.hiddenSegments.length : 0)
        if (menus.length > segmentsLength) {
            for (let i = menus.length - 1; i > 0; i--) {
                const id = menus[i].firstChild.nextSibling.href.split('input_field=')[1].split('=')[0]
                if (existing.includes(id)) {
                    menus[i].remove()
                }
                else {
                    existing.push(id)
                }
            }
        }
    }, 10000)
})();
3 Likes

when we are moving ever closer too the completion of the dataset, i was wondering if someone from HQ has tough about the possibility for the ai too help identify the cells by “face recognition technology” i have noticed a lot of the cells follow the same pattern so if you had lots of points/synapses with the same distance betwheen them on different cells it would probably be the same celltype. Beeing able to even group 10 identical cells togheter in average in each group like that would probably save thousands of hours of manually labour identifying the cells for both this and future projects.

4 Likes

Actually I was thinking about something like this. But only thinking, I’m not planning (currently) to do any addon for that. But you’re right, the cells of the same type are quite similar and should be easy (?) to recognize by an automated system. Or at least, recognize most of them and leave only the harder ones to the players.

4 Likes

Alternatively, when we finish fixing the cells, we could group them by main types (T, Tm + TmY, C, Y, L, itd.). Then recognizing each subtype would be easier, if one person would work with only one type. But still, automatic recognition would be much faster.

2 Likes

That is the way i am doing it currently since that goes much faster than finding the the correct subtype other than a few that are mostly easy to spot like c2/c3 or most T types

5 Likes

This is a great question - we have a similar tool for neurons of the central brain. It recommends a label based on previous labels. Let me ask about deploying it for optic lobe.

1 Like

@annkri @Krzysztof_Kruk is this the most up to date list of labels you guys have been using?

Centrifugal; C
Distal medulla; Dm
Lamina intrinsic; Lai
Lamina monopolar; L
Lamina wide field; Lawf
Lobula columnar; Lc
Lobula-complex columnar; Lccn
Lobula intrinsic; Li
Lobula plate intrinsic; Lpi
Lobula tangential; Lt
Medulla intrinsic; Mi
Medulla tangential; Mt
Optic lobe tangential; Olt
Proximal medulla; Pm
Retinula axon; R
T
Translobula; Tl
Translobula-plate; Tlp
Transmedullary; Tm
Transmedullary Y; TmY
Y

Yes, I believe, it is.

2 Likes

Ok great we are looking into this!

Would it be beneficial if it was easier to see whether a cell already had a label within FW? Any other changes that would improve labeling? I was thinking it might be nice if there was a way to sort through completed, unlabeled cells by primary neuropil. At least that would make it easier to find cells that need labels

1 Like

Yes, it would definitely help, if the info, if the cell is already labeled, was visible directly in FW. It would be even more useful, if the label itself was directly visible. It would help finding misidentified cells and fixing them.

2 Likes

@Amy would definitely be very helpful beeing able to see if there is a label in FW, and beeing able to see what that label is directly in FW would be useful.

Beeing able to sort trough completed, unlabeled cells etc would probably be useful, when we get the dataset completed enogh that the primary consern is labeling old cells instead of trasing new ones. The problem i think is that there is 100 different way to label one cell type and we need to have a consistent way to label each cell to make it searchable (the list made by kk help a lot in this) but still not every entry will have the same details like tm instead of tm2 and they would need to be gone trough another time to get the exact label, and having the ai help suggest names would probably help here, but is there any way the ai could go trough every cell in the neuropil and suggest batches without us having to manually open every cell?
Opening batches with say 10-50 cells (not sure how many cells you could have without it beeing too much) and looking for/ removing/ marking any that are different from the main type before naming the whole batch, would be much easier than opening one at a time.

1 Like

Hi Krzysztof, I’m attempting to reproduce this trick about changing the resolution through the “Choose image server” dropdown as you describe here. I was able to do this the other week but now I feel like I’m looking in the wrong place. Would you be able to explain this more in depth or confirm for me that the feature seems to have disappeared?

2 Likes

Hi,
You can change the resolution on any image server. Just go the the right panel (make sure, you’re in the segmentation with graph tab) and in the Rendering tab find “Resolution (slice)” thing. Move over it to select the target resolution (e.g. 5px) and click on that bar.

3 Likes

Huh, interestingly I still don’t feel like this is where this info was located when I modified things last week. I could have sworn there were fields to directly input 5 px and then set something to 19/19. I’ve done what you describe but there’s no fields, just that slider, and it’s set to 5 px 27/27. How did you make it 5 px 19/19?

1 Like