OpenFlexure Microscope MATLAB Client

版本 0.1.0 (7.4 KB) 作者: Samuel McDermott
These MATLAB classes make it easy for you to connect and control an OpenFlexure Microscope over a network.
12.0 次下载
更新时间 2021/1/27

A MATLAB client for the OpenFlexure Microscope

These MATLAB classes make it easy for you to connect and control an OpenFlexure Microscope over a network. You are able to move the microscope and get the images from the microscope, as well as run extensions.

Installation:

You just need to download/clone this repository and make sure the files are added to your MATLAB path.

Usage:

To connect to your microscope, you can either:

* Use `microscope.local`.

microscope = OFMClient('microscope.local');

* Use the microscope's **hostname** or **IP address**.

microscope = OFMClient('example.host.name');
microscope = OFMClient('XXX.XXX.XXX.XXX');

If necessary you can also set the port (default is `5000`):

microscope = OFMClient('example.host.name','port');

Check the connection:

To test if your connection has worked, you can run the following block (it is also a script in the repository called `check_the_connection.m`.):

%Test the stage movement
pos = microscope.position_as_matrix();
starting_pos = pos;
pos(1) = pos(1) + 100;
microscope.move(pos);
disp("Is the microscope in the starting position?");
disp(isequal(microscope.position_as_matrix(),starting_pos));
pos(1) = pos(1) - 100;
microscope.move(pos);
disp("Is the microscope in the starting position?");
disp(isequal(microscope.position_as_matrix(),starting_pos));

%Test the autofocus
ret = microscope.autofocus();

%Acquire an image
image = microscope.grab_image();
figure;
imagesc(image);

%List the extensions
disp("Active microscope extensions");
disp(microscope.extensions);

This will test the stage movement, run the autofocus routine, show a picture taken by the microscope and list the extensions that are on the microscope.

See a live video preview:

You can view a video preview in MATLAB using

microscope.preview();

This will launch a window with the video preview direct from the microscope. To use this functionality you will need to install the IP Camera Support from MATLAB. MATLAB should prompt you to install this on first use.

Basic Commands:

The `MicroscopeClient` object has a few basic methods. If you created an instance of the object with the name `microscope` as above, the commands can be found in the readme.

For more information, run `help OFMClient`.

Extensions:

To run methods provided by the microscope extensions, you can use the `extensions` `struct` to make `get` or `post` requests.

**However**, due to MATLAB struct limitation, you need to replace any `.` in your extension name to `_DOT_` and any `-` to `_DASH_`. For example, the extension `org.openflexure.autofocus` should be written as `org_DOT_openflexure_DOT_autofocus`.

For a post request, `data` can be a `struct`, `character vector`, `numeric`, `cell` etc. The full list of supported types for post requests is in the MATLAB documentation: https://uk.mathworks.com/help/matlab/ref/webwrite.

引用格式

Samuel McDermott (2024). OpenFlexure Microscope MATLAB Client (https://github.com/openflexure/openflexure-microscope-matlab-client/releases/tag/v0.1.0), GitHub. 检索来源 .

MATLAB 版本兼容性
创建方式 R2020b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
0.1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库