Repository navigation
get_current_seg_ids
Gets the most likely candidates for the current versions of a list of potentially-stale segment ids. Useful when re-analyzing or comparing older records.
Arguments:
-
datastack(str, mandatory)- the name of the CAVE datastack the segment id is from
-
seg_ids(list of ints, mandatory)- the potentially-outdated IDs of the segments you want the current IDs for
-
include_ratio(boolean, optional, default=False)- if set to
True, will include proportion of stale segment's supervoxels that are contained within the fresh segment - this can be useful to asses the confidence of the match
- if set to
-
full_list(boolean, optional, default=False)- if set to
True, will return list of all fresh IDs associated with supervoxels from "stale" ID instead of just top candidate - these will be in descending order of confidence
- if set to
-
skip_fresh(boolean, optional, default=True)- if False, skips checking if the ID is already current
- mainly useful for a slight speed increase on a long (1,000+) list of IDs known to definitely all be outdated
-
detailed_errors(bool, optional, default=False)- by default, this function returns a string of "ERROR" if an error is encountered
- if this is set to
Trueit will instead return a more detailed error message for troubleshooting
Returns:
-
result(varies, see description)- by default returns a list of integer segment ids of the most likely current segments
- if
include_ratioisTrue, returns a list of 2-item lists [seg_id,ratio] - if
full_listisTrue, returns a list of lists of all candidate current ids as ints - if both
include_ratioandfull_listareTrue, returns list of lists of 2-item lists [seg_id,ratio]
Note
When looped repeatedly in a short time, as might happen when using this function to update a spreadsheet of old IDs one line at a time, it can get throttled by the CAVE service due to repeatedly setting the client. Workarounds include batching, parallelization, or simply setting a sleep delay to lower the request rate below 60 requests per minute.
Note
Extremely large neurons (e.g. the CT1 cells in Drosophila) may exceed the request limit for the supervoxel query and cause an HTTP 413 Client Error.
The code below shows various ways to update three stale IDs 720575941473274509, 720575941524660200, and 720575941565377335 from the brain_and_nerve_cord datastack.
INPUT:
import tracertools as tt
fresh = tt.get_current_seg_ids(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941473274509,
720575941524660200,
720575941565377335,
],
)
print(fresh)
OUTPUT:
[
720575941441350235,
720575941519923628,
720575941703820762
]
INPUT:
import tracertools as tt
fresh = tt.get_current_seg_ids(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941473274509,
720575941524660200,
720575941565377335,
],
include_ratio = True,
)
print(fresh)
OUTPUT:
[
[720575941441350235, 0.9747508490618563],
[720575941519923628, 0.8846842105263157],
[720575941703820762, 0.9805467429911376]
]
INPUT:
import tracertools as tt
fresh = tt.get_current_seg_ids(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941473274509,
720575941524660200,
720575941565377335,
],
full_list = True,
)
print(fresh)
OUTPUT:
[
[
720575941441350235,
720575941560423027,
720575941521525579,
720575941488792551,
720575941504192535
],
[
720575941519923628,
720575941586998071,
720575941690721688,
720575941493018032,
720575941524058615,
720575941520296920,
720575941537520922
],
[
720575941703820762,
720575941560578472,
720575941459558800,
720575941575975176,
720575941428854868,
720575941405357936
]
]
INPUT:
import tracertools as tt
fresh = tt.get_current_seg_ids(
datastack = "brain_and_nerve_cord",
seg_ids = [
720575941473274509,
720575941524660200,
720575941565377335,
],
full_list = True,
include_ratio = True
)
print(fresh)
OUTPUT:
[
[
[720575941441350235, 0.9747508490618563],
[720575941560423027, 0.008444221739695265],
[720575941521525579, 0.007154390067368187],
[720575941488792551, 0.007005920234582336],
[720575941504192535, 0.002644618896497968]
],
[
[720575941519923628, 0.8846842105263157],
[720575941586998071, 0.06591228070175438],
[720575941690721688, 0.0387719298245614],
[720575941493018032, 0.005070175438596491],
[720575941524058615, 0.0040526315789473685],
[720575941520296920, 0.0010701754385964912],
[720575941537520922, 0.0004385964912280702]
],
[
[720575941703820762, 0.9805467429911376],
[720575941560578472, 0.01842304907065761],
[720575941459558800, 0.00046984378771681783],
[720575941575975176, 0.00046553329425152594],
[720575941428854868, 7.32783889099624e-05],
[720575941405357936, 2.1552467326459532e-05]
]
]
Note
This output was generated on 2026/06/09 and may vary when the example code is run in the future.