Skip to content
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 @@ -115,5 +115,5 @@ interface Builder<T extends Builder<T>> {
*
* @return the autofocus settings
*/
DefaultAutofocusSettings autofocusSettings();
DefaultAutofocusSettings autofocus();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface AcquisitionSettingsDispim extends AcquisitionSettings {
*
* @return immutable DefaultChannelSettings instance.
*/
DefaultChannelSettings channels();
ChannelSettings channels();

/**
* Returns the immutable DefaultTimingSettings instance.
Expand Down Expand Up @@ -100,13 +100,6 @@ public interface AcquisitionSettingsDispim extends AcquisitionSettings {
*/
boolean isUsingTimePoints();

/**
* Returns true if using autofocus.
*
* @return true if using autofocus.
*/
boolean isUsingAutofocus();

/**
* Returns true if using multiple positions.
*
Expand All @@ -121,13 +114,6 @@ public interface AcquisitionSettingsDispim extends AcquisitionSettings {
*/
boolean isUsingHardwareTimePoints();

/**
* Returns true if using stage scanning.
*
* @return true if using stage scanning.
*/
boolean isUsingStageScanning();

/**
* Returns true if using advanced timing settings.
*
Expand Down Expand Up @@ -184,14 +170,6 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
T useTimePoints(final boolean state);

/**
* Sets the acquisition to use autofocus.
*
* @param state true to use autofocus
* @return {@code this} builder
*/
T useAutofocus(final boolean state);

/**
* Sets the acquisition to use multiple positions.
*
Expand All @@ -208,14 +186,6 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
T useHardwareTimePoints(final boolean state);

/**
* Sets the acquisition to use stage scanning.
*
* @param state true to use stage scanning
* @return {@code this} builder
*/
T useStageScanning(final boolean state);

/**
* Sets the acquisition to use advanced timing settings.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.micromanager.lightsheetmanager.api.data.AcquisitionMode;
import org.micromanager.lightsheetmanager.api.data.CameraData;
import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.api.internal.DefaultChannelSettings;
import org.micromanager.lightsheetmanager.api.internal.DefaultSheetCalibration;
import org.micromanager.lightsheetmanager.api.internal.DefaultSliceCalibration;
import org.micromanager.lightsheetmanager.api.internal.DefaultSliceSettings;
Expand All @@ -27,7 +26,7 @@ public interface AcquisitionSettingsScape extends AcquisitionSettings {
*
* @return immutable DefaultChannelSettings instance.
*/
DefaultChannelSettings channels();
ChannelSettings channels();

/**
* Returns the immutable DefaultTimingSettings instance.
Expand Down Expand Up @@ -62,14 +61,14 @@ public interface AcquisitionSettingsScape extends AcquisitionSettings {
*
* @return immutable DefaultSheetCalibration instance.
*/
DefaultSheetCalibration sheetCalibration(final int view);
DefaultSheetCalibration sheetCalibration();

/**
* Returns the immutable DefaultSliceCalibration instance.
*
* @return immutable DefaultSliceCalibration instance.
*/
DefaultSliceCalibration sliceCalibration(final int view);
DefaultSliceCalibration sliceCalibration();

/**
* Returns the acquisition mode.
Expand Down Expand Up @@ -99,13 +98,6 @@ public interface AcquisitionSettingsScape extends AcquisitionSettings {
*/
boolean isUsingTimePoints();

/**
* Returns true if using autofocus.
*
* @return true if using autofocus.
*/
boolean isUsingAutofocus();

/**
* Returns true if using multiple positions.
*
Expand All @@ -120,13 +112,6 @@ public interface AcquisitionSettingsScape extends AcquisitionSettings {
*/
boolean isUsingHardwareTimePoints();

/**
* Returns true if using stage scanning.
*
* @return true if using stage scanning.
*/
boolean isUsingStageScanning();

/**
* Returns true if using advanced timing settings.
*
Expand Down Expand Up @@ -160,26 +145,26 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
/**
* Sets the acquisition mode.
*
* @param acqMode the acquisition mode
* @param mode the acquisition mode
* @return {@code this} builder
*/
T acquisitionMode(final AcquisitionMode acqMode);
T acquisitionMode(final AcquisitionMode mode);

/**
* Sets the camera mode.
*
* @param cameraMode the camera mode.
* @param mode the camera mode.
* @return {@code this} builder
*/
T cameraMode(final CameraMode cameraMode);
T cameraMode(final CameraMode mode);

/**
* Sets the imaging camera order.
*
* @param cameraOrder the imaging camera order
* @param order the imaging camera order
* @return {@code this} builder
*/
T imagingCameraOrder(final CameraData[] cameraOrder);
T imagingCameraOrder(final CameraData[] order);

/**
* Sets the acquisition to use time points.
Expand All @@ -189,14 +174,6 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
T useTimePoints(final boolean state);

/**
* Sets the acquisition to use autofocus.
*
* @param state true to use autofocus
* @return {@code this} builder
*/
T useAutofocus(final boolean state);

/**
* Sets the acquisition to use multiple positions.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package org.micromanager.lightsheetmanager.api;


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

/**
* Autofocus settings.
*
*/
public interface AutofocusSettings {

interface Builder {

/**
* Return true if channels are enabled.
*
* @param state true if channels are enabled
*/
Builder enabled(final boolean state);

/**
* Sets the number of images to capture in the autofocus routine.
*
Expand Down Expand Up @@ -106,6 +111,13 @@ interface Builder {
*/
Builder copyBuilder();

/**
* Return true if channels are enabled.
*
* @return true if channels are enabled
*/
boolean enabled();

/**
* Returns the number of images used in for autofocus routine.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import org.micromanager.lightsheetmanager.api.data.ChannelMode;
import org.micromanager.lightsheetmanager.model.channels.ChannelSpec;

import java.util.Map;

public interface ChannelSettings {

Builder copyBuilder();

boolean enabled();

int count();
Expand All @@ -21,6 +25,13 @@ public interface ChannelSettings {

ChannelSpec[] data();

/**
* Returns an immutable shallow copy of the map.
*
* @return an immutable shallow copy of the map
*/
Map<String, ChannelSpec[]> groups();

interface Builder {

Builder enabled(final boolean state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Builder {
*
* @param slicePeriodMs the slice period in milliseconds
*/
Builder slicePeriod(final double slicePeriodMs);
Builder period(final double slicePeriodMs);

/**
* Sets the sample exposure time in milliseconds.
Expand All @@ -22,7 +22,7 @@ interface Builder {
*
* @param state true to minimize the slice period
*/
Builder minimizeSlicePeriod(final boolean state);
Builder minimizePeriod(final boolean state);

/**
* Creates an immutable instance of SliceSettings
Expand All @@ -44,7 +44,7 @@ interface Builder {
*
* @return the slice period in milliseconds
*/
double slicePeriod();
double period();

/**
* Returns the sample exposure time in milliseconds.
Expand All @@ -58,5 +58,5 @@ interface Builder {
*
* @return true if slice period is minimized
*/
boolean isSlicePeriodMinimized();
boolean periodMinimized();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public interface StageScanSettings {
*/
Builder copyBuilder();

/**
* Returns true if the autofocus settings are enabled.
*
* @return true if the autofocus settings are enabled
*/
boolean enabled();

/**
* Returns the acceleration factor.
*
Expand Down Expand Up @@ -67,6 +74,14 @@ public interface StageScanSettings {

interface Builder {

/**
* Enable or disable the autofocus settings.
*
* @param state true to enable stage scanning
* @return {@code this} builder
*/
Builder enabled(final boolean state);

/**
* Sets the acceleration factor.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import org.micromanager.lightsheetmanager.api.AcquisitionSettings;
import org.micromanager.lightsheetmanager.api.ChannelSettings;
import org.micromanager.lightsheetmanager.api.StageScanSettings;
import org.micromanager.lightsheetmanager.model.DataStorage;

Expand All @@ -24,13 +26,13 @@ public abstract static class Builder<T extends Builder<T>> implements Acquisitio
public Builder() {
}

public Builder(final BaseAcquisitionSettings settings) {
saveDirectory_ = settings.saveDirectory_;
saveNamePrefix_ = settings.saveNamePrefix_;
saveDuringAcq_ = settings.saveDuringAcq_;
demoMode_ = settings.demoMode_;
saveMode_ = settings.saveMode_;
afBuilder_ = settings.autofocusSettings_.copyBuilder();
public Builder(final AcquisitionSettings settings) {
saveDirectory_ = settings.saveDirectory();
saveNamePrefix_ = settings.saveNamePrefix();
saveDuringAcq_ = settings.isSavingImagesDuringAcquisition();
demoMode_ = settings.demoMode();
saveMode_ = settings.saveMode();
afBuilder_ = settings.autofocus().copyBuilder();
}

/**
Expand Down Expand Up @@ -122,7 +124,7 @@ public DefaultAutofocusSettings.Builder autofocusSettingsBuilder() {
private final boolean demoMode_;
private final DataStorage.SaveMode saveMode_;

private final DefaultAutofocusSettings autofocusSettings_;
private final DefaultAutofocusSettings autofocus_;

// public DefaultAcquisitionSettings() {
// saveNamePrefix_ = "";
Expand All @@ -136,7 +138,7 @@ protected BaseAcquisitionSettings(Builder<?> builder) {
saveDuringAcq_ = builder.saveDuringAcq_;
demoMode_ = builder.demoMode_;
saveMode_ = builder.saveMode_;
autofocusSettings_ = builder.afBuilder_.build();
autofocus_ = builder.afBuilder_.build();
}

/**
Expand Down Expand Up @@ -195,8 +197,8 @@ public DataStorage.SaveMode saveMode() {
* @return the autofocus settings
*/
@Override
public DefaultAutofocusSettings autofocusSettings() {
return autofocusSettings_;
public DefaultAutofocusSettings autofocus() {
return autofocus_;
}

@Override
Expand All @@ -218,11 +220,16 @@ public String toPrettyJson() {

public static <T extends AcquisitionSettings> T fromJson(final String json, final Class<T> cls) {
Gson gson = new GsonBuilder()
.registerTypeAdapter(StageScanSettings.class, (com.google.gson.JsonDeserializer<StageScanSettings>)
.registerTypeAdapter(StageScanSettings.class, (JsonDeserializer<StageScanSettings>)
(jsonElement, typeOfT, context) -> {
// This forces Gson to use the concrete implementation class
return context.deserialize(jsonElement, DefaultStageScanSettings.class);
})
.registerTypeAdapter(ChannelSettings.class, (JsonDeserializer<ChannelSettings>)
(jsonElement, typeOfT, context) -> {
// This forces Gson to use the concrete implementation class
return context.deserialize(jsonElement, DefaultChannelSettings.class);
})
.create();
return gson.fromJson(json, cls);
}
Expand Down
Loading
Loading