Change Neuroglancer state

51 views
Skip to first unread message

Andrei Mancu

unread,
May 6, 2021, 8:27:09 AM5/6/21
to Neuroglancer
Hi,

we have been trying to get Neuroglancer to query only a subset of segment ids by querying the celltype in the segment_query search bar. The backend for this querying task is already set up.

For this, we added a callback, so we get the wanted celltype from the frontend with the viewer.shared_state.add_changed_callback(self.on_state_changed) (line 57) function. The  on_state_changed() function looks like this:

Screenshot from 2021-05-06 14-19-05.png

The set_state_segment_ids() creates a deep copy of the viewer state and sets the segment query of this state to a subset of the segment ids and returns it (new_state line 74)

This approach results in a block, as the execution doesn't go past set_state (line 76)  method. It stops at _dispatch_changed_callbacks(), as add_changed_callback() (line 57) already acquired the lock.

Is this approach faulty? How could we set a new state for Neuroglancer Viewer with our preferred segmentation ids?

Thank you in advance!

Best regards,
Andrei Mancu

Andrei Mancu

unread,
May 7, 2021, 7:39:39 AM5/7/21
to Neuroglancer
As a follow-up:

The deadlock happens because the StateHandler also acquiring the lock for dispatching, but for receive_update() (sockjs_handler.py line 98), just before we want to use set_state. We tried to use the StateHandler to set the new state, but we did not find a way to access it.

Is there a way around this?

Jeremy Maitin-Shepard

unread,
May 7, 2021, 11:56:44 AM5/7/21
to Andrei Mancu, Neuroglancer
To avoid deadlock, use the viewer.defer_callback method or run longer running computations on a separate thread.

--
You received this message because you are subscribed to the Google Groups "Neuroglancer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neuroglancer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/neuroglancer/171f4db7-a26b-4f1b-85c0-496114abc2cfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages