Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start of using MM's internal autofocus #302

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.micromanager.lightsheetmanager.model.DeviceManager;
import org.micromanager.lightsheetmanager.model.PluginSettings;
import org.micromanager.lightsheetmanager.model.UserSettings;
import org.micromanager.lightsheetmanager.model.XYZGrid;
import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngine;
import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngineDISPIM;
import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngineSCAPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin {
public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2024";
public static final String description = "A plugin to control various types of light sheet microscopes.";
public static final String menuName = "Light Sheet Manager";
public static final String version = "0.4.5";
public static final String version = "0.4.6";

private Studio studio_;
private LightSheetManager model_;
Expand Down Expand Up @@ -71,4 +71,5 @@ public String getCopyright() {
public String getHelpText() {
return description;
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.micromanager.lightsheetmanager.api;


import org.micromanager.lightsheetmanager.api.data.AutofocusFitType;
import org.micromanager.lightsheetmanager.api.data.AutofocusMode;
import org.micromanager.lightsheetmanager.api.data.AutofocusType;

Expand All @@ -20,76 +19,77 @@ interface Builder {
*/
Builder numImages(final int numImages);

/**
* Set the channel to run the autofocus routine on.
*
* @param channel the channel to run autofocus on
*/
Builder channel(final String channel);

/**
* Sets the spacing between images in the autofocus routine.
*
* @param stepSize the step size in microns
*/
Builder stepSize(final double stepSize);
Builder stepSizeUm(final double stepSize);

/**
* Selects whether to fix the piezo or the sheet for an autofocus routine.
*
* @param mode the autofocus mode
*/
Builder mode(final AutofocusMode mode);
// /**
// * Sets the tolerance in microns for the autofocus algorithm.
// *
// * @param value the tolerance in microns
// */
// Builder toleranceUm(final double value);

/**
* Sets the type of scoring algorithm to use when running autofocus.
* Set to {@code true} to show the images in the live view window.
*
* @param type the scoring algorithm
* @param state {@code true} to show images
*/
Builder scoringAlgorithm(final AutofocusType type);
Builder showImages(final boolean state);

/**
* Sets the type of curve fitting algorithm to use with autofocus..
* Set to {@code true} to show a graph of the data.
*
* @param type the curve fitting algorithm
*/
Builder fit(final AutofocusFitType type);

// TODO: maybe denote that these are related to acquisitions

/**
* Sets the amount of time to delay between acquiring time points.
* @param state {@code true} to show the graph
*/
Builder timePointInterval(final int timePointInterval);
Builder showGraph(final boolean state);

/**
* Run autofocus every time we move to the next channel during an acquisition.
* Selects whether to fix the piezo or the sheet for an autofocus routine.
*
* @param state true to enable autofocus every stage pass
* @param mode the autofocus mode
*/
Builder useEveryStagePass(final boolean state);
Builder mode(final AutofocusMode mode);

/**
* Run an autofocus routine before starting the acquisition.
* Sets the type of scoring algorithm to use when running autofocus.
*
* @param state true or false
* @param type the scoring algorithm
*/
Builder useBeforeAcquisition(final boolean state);

///////////////////////////
Builder scoringMethod(final AutofocusType type);

/**
* Sets the coefficient of determination for the autofocus algorithm.
* Set the channel to run the autofocus routine on.
*
* @param value the coefficient of determination
* @param channel the channel to run autofocus on
*/
Builder r2(final double value);

Builder maxOffset(final double maxOffset); // +/- um
Builder channel(final String channel);

Builder autoUpdateOffset(final boolean state);
// TODO: maybe denote that these are related to acquisitions

Builder autoUpdateMaxOffset(final double um);
// /**
// * Run autofocus every time we move to the next channel during an acquisition.
// *
// * @param state true to enable autofocus every stage pass
// */
// Builder useEveryStagePass(final boolean state);
//
// /**
// * Run an autofocus routine before starting the acquisition.
// *
// * @param state true or false
// */
// Builder useBeforeAcquisition(final boolean state);


// Builder maxOffset(final double maxOffset); // +/- um
//
// Builder autoUpdateOffset(final boolean state);
//
// Builder autoUpdateMaxOffset(final double um);

/**
* Creates an immutable instance of AutofocusSettings
Expand Down Expand Up @@ -118,7 +118,14 @@ interface Builder {
*
* @return the step size in microns
*/
double stepSize();
double stepSizeUm();

// /**
// * Returns the coefficient of determination used in the autofocus routine.
// *
// * @return the coefficient of determination
// */
// double toleranceUm();

/**
* Returns the autofocus mode being used.
Expand All @@ -132,37 +139,7 @@ interface Builder {
*
* @return the type of scoring algorithm
*/
AutofocusType scoringAlgorithm();

AutofocusFitType fit();

/**
* Returns the coefficient of determination used in the autofocus routine.
*
* @return the coefficient of determination
*/
double r2();

/**
* Returns the amount of time to delay between acquiring time points.
*
* @return the amount of time to delay between acquiring time points
*/
int timePointInterval();

/**
* Returns true if autofocus is run every stage pass.
*
* @return true if autofocus is run every stage pass
*/
boolean useEveryStagePass();

/**
* Returns true if we run an autofocus routine before starting an acquisition.
*
* @return true if enabled
*/
boolean useBeforeAcquisition();
AutofocusType scoringMethod();

/**
* Returns the channel autofocus is being run on.
Expand All @@ -171,15 +148,29 @@ interface Builder {
*/
String channel();

// /**
// * Returns true if autofocus is run every stage pass.
// *
// * @return true if autofocus is run every stage pass
// */
// boolean useEveryStagePass();
//
// /**
// * Returns true if we run an autofocus routine before starting an acquisition.
// *
// * @return true if enabled
// */
// boolean useBeforeAcquisition();

/**
* What is this?
*
* @return
*/
double maxOffset(); // used during acquisitions

boolean autoUpdateOffset();

double autoUpdateMaxOffset();
// double maxOffset(); // used during acquisitions
//
// boolean autoUpdateOffset();
//
// double autoUpdateMaxOffset();

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* The type of scoring algorithm for the general autofocus settings.
*/
public enum AutofocusType {
NONE("None"),
EDGES("Edges"),
STD_DEV("StdDev"),
MEAN("Mean"),
Expand Down Expand Up @@ -38,7 +37,7 @@ public static String[] toArray() {
}

public static AutofocusType fromString(final String symbol) {
return stringToEnum.getOrDefault(symbol, AutofocusType.NONE);
return stringToEnum.getOrDefault(symbol, AutofocusType.EDGES);
}

@Override
Expand Down
Loading
Loading