It wouldn’t be a problem, if the visible names wouldn’t refresh itself automatically, as it is now with the cell status (complete, outdated, etc.). That’s the only reason I mentioned it.
Agree, that the problem with changes after identification is a separate issue.
You’re right, that the name should be associated with the point, the name was added at (in cases of the Names script, that’s not the case, so that’s why I talked about it).
@Nseraf 4 numbers would definitely be too small for all the segments. That’d give you 10 000 various possibilies (including 0000), but the number of the neurons themselves is about 150 000. And each neuron contains thousands of fragments, plus all the glia and other segments.
Actually, the programmers went to great lengths to implement 64-bit integer numbers (at that time, BigInt type wasn’t available in browsers). With 64 bits, you can have 2^64 = 18 446 744 073 709 551 616 possibilites .
However, 4 digits displayed locally out of that 20, is perferctly fine number. Probability of repeating numbers is: 1−k!/(k^n(k−n)!), where k = 10000 and n - number of added segments. So it’s 0.00449130944 or 0.45% for 10 segments (thanks Google and WolframAlpha ).
Also, it would have to be the last 4 digits, because the first ones are mostly the same for all the segments.
From my point of view it would be very useful that the names would refresh automatically. If you have many open cell some of them will be changed and given new name while you work at them and would be useful to know.
But i am thinking you should have that 4 digits locally preferably you would get a number assigned locally to each segment you work on in that tab, starting on 0001, 0002 … 9999, 0001 etc or you could change them to anything you like. That would probably make the chance of getting the same digits as low as you can.
When you have 10 segments the posibility to have the same digits is very low using the last four diggits, but when you perhaps have 200 cells with several segments each the posibility are soon going to be higher using the last four digits of id, but understand that this would probably be easier out from a programming view.
I guess, the best solution would be to have the identification and the local name/number displayed separately. From visual point of view that could still look the same as it is now, but technically, there could be 2 fields, one next to each other. Sort of “my name | their name”.
if cell id is placed on the point/coordinates of mouse cursor etc, then it could be a simple solution in a potential split, the segment that still retains the voxel/segment that was ID’ed retains the name/id, the split off part(s) acquire a “needs ID” or some such or lose the id and retain only the 4-### numbers indicating they need to be re-id’ed. Could work?
Got a question: in 2D/3D settings in rendering, the resolution (from 1px to 5px) if it is closer to 1px ive noticed is better and 5px is worse, having it to one end or the other does it also impact loading time(s)? ie: loads faster closer to 5px and slower closer to 1px? thnx.
Yes, the resolution is the actual resolution of the pixels of the images visible in 2D and of the cross-sections of segments (it doesn’t affect 3D, afaik), so 1px will always be better than 5px. However, when the zoom is 300nm, 5px is usable, espiecially for quick scans of main branches on slower internet speeds. The difference is significant.
Every 2 minutes the context menus for all the segments added are recreated. Old menus aren’t removed. That leads to site slowness, especially when working with many segments and for a longer period of time without refreshing. Also reported here: Context menus duplication · Issue #602 · seung-lab/neuroglancer · GitHub
lol, yeah, its 35300 nodes every 2 minutes. It might slow down any computer very quickly. Some say, that about 1500 nodes is a resonable maximum for a fast website, so… there’s that :D. I think, the issue might also be the cause of the problem you have with opening new tabs via the “actions” menu.
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.
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!
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.
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.
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.