Skip to content

NIS Bridge Setup, Python Script - #3

Open
qquais wants to merge 10 commits into
mainfrom
physarum-imaging-and-estop
Open

qquais wants to merge 10 commits into
mainfrom
physarum-imaging-and-estop

Conversation

@qquais

@qquais qquais commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

A JOBS Python task that, while running, serves /status, /move (relative,
capped at 1 mm), /objective (4x/10x only), /capture (save as ND2),
/nd/run (load a saved ND experiment and run it), /nd/finish and
/shutdown on 127.0.0.1:8766. Motion and acquisition answer only POST;
nothing moves or starts while the e-stop file exists; Z is never moved.
NIS calls stay on the job thread, HTTP threads only queue them.

Macro signatures are from the NIS 6.20 reference on the microscope PC.
Checked off the scope over real HTTP with a stand-in DLL; not yet run
inside NIS.
NISBridge wraps the bridge job's HTTP API: status, move_relative,
change_objective, capture, nd_run, nd_finish, shutdown. The e-stop is
checked here before any motion or acquisition request is sent, so a
stopped microscope does not rely on the NIS side alone; ending an ND
run and shutting the bridge down are always allowed. An unreachable
bridge raises BridgeUnavailable with a pointer to the setup notes.
Tools that go through the NIS bridge: nis_status, nis_move_relative,
nis_change_objective, nis_capture, nis_run_experiment and
nis_finish_experiment, plus the shared estop. Everything that moves or
acquires needs confirm=True, like backend='sdk' in loop_tools; captures
go only to the data folder by plain file name; finishing an ND run and
the e-stop never need confirm.

A server of its own because server_loop's tool set is fixed by team
direction and deliberately free of NIS-Elements; loop_tools.py and
server_loop.py are unchanged.
Runs the real bridge HTTP server and queue, the real client and the
real MCP tools against a stand-in for g5_regprocs.dll that records
every macro call. Covers status, relative moves and the 1 mm cap,
GET never moving anything, the 4x/10x allow-list, the e-stop in both
client and bridge (with finishing an ND run still allowed), ND2
captures that never overwrite, ND run guards, the confirm gate,
capture file names confined to the capture folder, and the NIS
server's exact tool set.
docs/nis-bridge.md explains how the bridge, client and NIS MCP server
fit together, how to run the bridge as a JOBS task, and the step-by-step
test plan for the microscope - including the open questions (does NIS
stay usable, does ChangeObjective turn the nosepiece, does
ND_RunExperiment block). README and CHANGELOG point at it.
scipy, scikit-image, nd2, imageio-ffmpeg and opencv-python were imported by
the analysis scripts but not declared, so a fresh install could not run them.
They are now the 'analysis' group, included in 'all'.
The stage_positions demo loaded protocols/example_protocol.yaml, which is not
in this repo, so it always failed; that step is removed. Comments citing
docs/microscope-notes.md, run_protocol.py and the calibration tests now name
ConfocalOrchestrator, and old names (mcp_server/server.py,
acquisition_tools.py) are replaced with the current ones.
@qquais qquais self-assigned this Oct 1, 2026
Canvas, fonts, centred text and an ffmpeg writer (x264 + AAC in one pass,
or preview stills) used by the Physarum and C. elegans Shorts.
Runs the combined analysis script's alignment, draws the smoothed on-agar
area under the time-lapse and wipes to growth_start_to_end_colour.jpg,
which is the same frame so needs no registration.
Re-links tracks at 0.5 mm with a 3-frame position median, features the
longest-followed adults named by speed, and states the Explorer/Homebody
ratio as the smaller of the raw and filtered figures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant