Repository navigation
get_seg_edits
jaybgager edited this page Oct 1, 2026
·
2 revisions
Gets the tracertools-format edit history for a given segment as a Pandas DataFrame object.
Arguments:
-
datastack(string, mandatory)- the name of the CAVE datastack the segment ID is from
-
seg_id(integer, mandatory)- the ID of the segment you want to get the edit history for
-
op_column(string, optional, default="operation_id")- the name of the column in the changelog that holds the operation ids for each edit
- the default of
"operation_id"should always work - if a future dataset uses a different term, you can manually pass it here
Returns:
-
final_df(pandas DataFrame object)- a DataFrame containing relevant information for each edit made to a segment
- the DataFrame will contain the following columns:
-
operation_id(integer)- a unique number CAVE uses to identify each edit, useful for more detailed lookups
-
is_merge(boolean)- whether or not the edit was a merge (True = merge, False = split)
-
point_coords((2,3)-shape list of integers)- x,y,z coordinates for each side of the edit
- for merges these are the actual points the user chose
- for splits, these are the average of all the points automatically generated by the cut tool
-
before_segs(list of integers)- the one (for splits) or two (for merges) segment IDs before the edit was made
-
after_segs(list of integers)- the one (for merges) or two (for splits) segment IDs after the edit was made
-
seg_pair(list)- two segment IDs that are either the pre-edit segments (for merges) or post-edit segments (for splits)
- useful to have as a single category for certain analysis tasks
- e.g. calculating supervoxel addition/subtraction sums (when paired with the
is_mergecolumn)
-
user(integer)- the unique number identifying which user made the edit
- useful for assigning credit when calculating user contributions in supervoxels to a given segment
- or for assigning blame when grumbling about terrible migraine-inducing merges
-
The code below gets the edits for the segment 720575941703820762 in the brain_and_nerve_cord datastack.
INPUT:
import tracertools as tt
cl_df = tt.get_seg_edits(
datastack = "brain_and_nerve_cord",
seg_id = 720575941703820762,
)
cl_df.head()
OUTPUT:
(user ID column has been redacted for privacy in this example)
Note
When looped repeatedly in a short time, as might happen when using this to get the edit histories for each item in a long list of segment IDs, this function can get throttled by the CAVE service due to repeatedly setting the client. An update for batch submission is planned for the future, but for now, keep the request rate below 60/min.