Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,6 @@ public ChannelSettings.Builder channelBuilder() {
public VolumeSettings.Builder volumeBuilder() {
return volumeBuilder_;
}

/**
* Creates an immutable instance of DefaultAcquisitionSettings
*
* @return Immutable version of DefaultAcquisitionSettings
*/
//@Override
//public abstract AcquisitionSettings build();

//public abstract T self();
}

/**
Expand Down Expand Up @@ -334,12 +324,6 @@ public VolumeSettings.Builder volumeBuilder() {
private final ChannelSettings channels;
private final VolumeSettings volume;

// public DefaultAcquisitionSettings() {
// saveNamePrefix_ = "";
// saveDirectory_ = "";
// demoMode_ = false;
// }

protected BaseAcquisitionSettings(Builder<?> builder) {
saveDirectory = builder.saveDirectory;
saveNamePrefix = builder.saveNamePrefix;
Expand Down Expand Up @@ -592,8 +576,4 @@ public static <T extends AcquisitionSettings> T fromJson(final String json, fina
return gson.fromJson(json, cls);
}

// public static DefaultAcquisitionSettingsDISPIM fromJson(final String json) {
// return new Gson().fromJson(json, DefaultAcquisitionSettingsDISPIM.class);
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,6 @@ private boolean isStageDevice() {
return deviceType_ == DeviceType.XYStageDevice || deviceType_ == DeviceType.StageDevice;
}

private void setRelativeXYPosition(final double dx, final double dy) {
try {
core_.setRelativeXYPosition(deviceName_, dx, dy);
} catch (Exception e) {
model_.studio().logs().showError("failed!");
}
}

private void setXYPosition(final double dx, final double dy) {
try {
core_.setXYPosition(deviceName_, dx, dy);
} catch (Exception e) {
model_.studio().logs().showError("failed!");
}
}

/////////////////////////

private void setRelativeXPosition(final double dx) {
Expand Down Expand Up @@ -314,7 +298,6 @@ private void setPosition(final double d) {

private void setOriginY() {
try {
//System.out.println("deviceName_: " + deviceName_);
core_.setOriginY(deviceName_);
} catch (Exception e) {
model_.studio().logs().showError("failed to set y origin!");
Expand All @@ -323,7 +306,6 @@ private void setOriginY() {

private void setOriginX() {
try {
//System.out.println("deviceName_: " + deviceName_);
core_.setOriginX(deviceName_);
} catch (Exception e) {
model_.studio().logs().showError("failed to set x origin!");
Expand Down Expand Up @@ -359,14 +341,6 @@ private void setOrigin() {

//// Galvo

private void setGalvoPosition(final double dx, final double dy) {
try {
core_.setGalvoPosition(deviceName_, dx, dy);
} catch (Exception e) {
model_.studio().logs().showError(propertyName_ + " " + deviceName_ + " failed!");
}
}

// the galvo position is read inside the try, so a failed read skips the move instead of
// moving with 0 in place of the unread position
private void setRelativeGalvoPositionX(final double dx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ public void createConfigGroup() {
try {
core_.defineConfigGroup(groupName);
} catch (Exception e) {
studio_.logs().logError("could not create the \"" + groupName + "\" configuration group.");
studio_.logs().logError("could not create the \"" + groupName + "\" configuration group: "
+ e.getMessage());
return; // early exit
}
}
Expand All @@ -540,7 +541,8 @@ public void createConfigGroup() {
try {
core_.defineConfig(groupName, configName);
} catch (Exception e) {
studio_.logs().logError("could not create the \"" + configName + "\" configuration preset.");
studio_.logs().logError("could not create the \"" + configName + "\" configuration preset: "
+ e.getMessage());
return; // early exit
}
}
Expand Down Expand Up @@ -577,7 +579,8 @@ private ArrayList<String> updateConfig(final String groupName, final String conf
try {
config = core_.getConfigData(groupName, configName);
} catch (Exception e) {
studio_.logs().showError("could not get configuration data!");
studio_.logs().showError("could not get the configuration data of " + groupName + "::"
+ configName + ": " + e.getMessage());
return newProperties; // early exit => could not get config data to compare
}

Expand All @@ -589,7 +592,8 @@ private ArrayList<String> updateConfig(final String groupName, final String conf
newProperties.add(propertyName);
} catch (Exception e) {
studio_.logs().logError("Could not create the \"" + propertyName
+ "\" property for the \"" + groupName + "\" configuration group.");
+ "\" property for the \"" + groupName + "\" configuration group: "
+ e.getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ public boolean prepareControllerForAcquisitionSide(
// round to nearest 0.0001 degrees, which is approximately the DAC resolution
sliceAmplitude = NumberUtils.roundToPlace(sliceAmplitude, 4);
sliceCenter = NumberUtils.roundToPlace(sliceCenter, 4);
studio_.logs().logMessage("Preparing the slices with slope " + sliceRate + ", offset "
+ sliceOffset + ", piezo center " + piezoCenter + " and slice center " + sliceCenter);

// Refuse a sweep that would drive the galvo past its travel limits. This has to run here,
// after the rounding and before either branch below writes to the card. The piezo check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,16 @@ private Optional<JSONObject> validateUserSettings(final String loadedSettings) {
loadedJson = new JSONObject(loadedSettings);
defaultJson = new JSONObject(defaultSettings);
} catch (JSONException e) {
model_.studio().logs().showError("could not validate the JSON data.");
model_.studio().logs().showError("could not validate the JSON data: " + e.getMessage());
return Optional.empty();
}
// add every default setting the loaded settings lack, including any whose key was renamed
try {
JsonUtils.addMissingKeys(defaultJson, loadedJson, MAX_RECURSION_DEPTH_JSON,
message -> model_.studio().logs().logMessage("UserSettings: " + message));
} catch (JSONException e) {
model_.studio().logs().showError("could not merge new default settings into loaded settings.");
model_.studio().logs().showError("could not merge new default settings into loaded settings: "
+ e.getMessage());
return Optional.empty();
}
return Optional.of(loadedJson);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public boolean hasProperty(final String propertyName) {
try {
result = core_.hasProperty(deviceName_, propertyName);
} catch (Exception e) {
studio_.logs().showError("Error: could not determine if " + propertyName + " exists.");
studio_.logs().showError("Error: could not determine if " + propertyName + " of "
+ deviceName_ + " exists: " + e.getMessage());
}
return result;
}
Expand Down Expand Up @@ -134,7 +135,8 @@ public boolean isPropertyPreInit(final String propertyName) {
try {
result = core_.isPropertyPreInit(deviceName_, propertyName);
} catch (Exception e) {
studio_.logs().logError(e.getMessage());
studio_.logs().logError("Could not tell whether the \"" + propertyName
+ "\" property of " + deviceName_ + " is pre-init: " + e.getMessage());
}
return result;
}
Expand All @@ -144,7 +146,8 @@ public boolean isPropertyReadOnly(final String propertyName) {
try {
result = core_.isPropertyReadOnly(deviceName_, propertyName);
} catch (Exception e) {
studio_.logs().logError(e.getMessage());
studio_.logs().logError("Could not tell whether the \"" + propertyName
+ "\" property of " + deviceName_ + " is read-only: " + e.getMessage());
}
return result;
}
Expand All @@ -170,7 +173,8 @@ public String[] getDevicePropertyNames() {
try {
devices = core_.getDevicePropertyNames(deviceName_);
} catch (Exception e) {
studio_.logs().logError(e.getMessage());
studio_.logs().logError("Could not get the property names of " + deviceName_ + ": "
+ e.getMessage());
}
return devices.toArray();
}
Expand All @@ -196,7 +200,7 @@ public void halt() {
try {
core_.stop(deviceName_);
} catch (Exception e) {
studio_.logs().logError("Error halting device: " + deviceName_);
studio_.logs().logError("Error halting device " + deviceName_ + ": " + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ public void setPosition(final double position) {
try {
core_.setPosition(deviceName_, position);
} catch (Exception e) {
studio_.logs().showError("could not set position for " + deviceName_);
studio_.logs().showError("could not move " + deviceName_ + " to " + position
+ ": " + e.getMessage());
}
}

public double getPosition() {
try {
return core_.getPosition(deviceName_);
} catch (Exception e) {
studio_.logs().showError("could not get position for " + deviceName_);
studio_.logs().showError("could not get position for " + deviceName_ + ": "
+ e.getMessage());
return 0.0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public Point2D.Double getXYPosition() {
try {
return core_.getXYStagePosition(deviceName_);
} catch (Exception e) {
studio_.logs().showError("could not get the xy position for " + deviceName_);
studio_.logs().showError("could not get the xy position for " + deviceName_ + ": "
+ e.getMessage());
return new Point2D.Double(0.0, 0.0);
}
}
Expand All @@ -47,7 +48,8 @@ public double getXPosition() {
try {
return core_.getXYStagePosition(deviceName_).x;
} catch (Exception e) {
studio_.logs().showError("could not get the x position for " + deviceName_);
studio_.logs().showError("could not get the x position for " + deviceName_ + ": "
+ e.getMessage());
return 0.0;
}
}
Expand All @@ -56,7 +58,8 @@ public double getYPosition() {
try {
return core_.getXYStagePosition(deviceName_).y;
} catch (Exception e) {
studio_.logs().showError("could not get the y position for " + deviceName_);
studio_.logs().showError("could not get the y position for " + deviceName_ + ": "
+ e.getMessage());
return 0.0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public String getName() {
try {
result = core_.getProperty(deviceName_, Properties.NAME);
} catch (Exception e) {
studio_.logs().logError("could not get the name property");
studio_.logs().logError("could not get the name property of "
+ deviceName_ + ": " + e.getMessage());
}
return result;
}
Expand All @@ -45,7 +46,8 @@ public String getDescription() {
try {
result = core_.getProperty(deviceName_, Properties.DESCRIPTION);
} catch (Exception e) {
studio_.logs().logError("could not get the description property");
studio_.logs().logError("could not get the description property of "
+ deviceName_ + ": " + e.getMessage());
}
return result;
}
Expand All @@ -54,7 +56,8 @@ public String getFirmwareBuild() {
try {
return core_.getProperty(deviceName_, Properties.FIRMWARE_BUILD);
} catch (Exception e) {
studio_.logs().logError("could not get the firmware build property");
studio_.logs().logError("could not get the firmware build property of "
+ deviceName_ + ": " + e.getMessage());
}
return "";
}
Expand All @@ -63,7 +66,8 @@ public String getFirmwareDate() {
try {
return core_.getProperty(deviceName_, Properties.FIRMWARE_DATE);
} catch (Exception e) {
studio_.logs().logError("could not get the firmware date property");
studio_.logs().logError("could not get the firmware date property of "
+ deviceName_ + ": " + e.getMessage());
}
return "";
}
Expand All @@ -72,7 +76,8 @@ public double getFirmwareVersion() {
try {
return Double.parseDouble(core_.getProperty(deviceName_, Properties.FIRMWARE_VERSION));
} catch (Exception e) {
studio_.logs().logError("could not get the firmware version property");
studio_.logs().logError("could not get the firmware version property of "
+ deviceName_ + ": " + e.getMessage());
}
return 0.0;
}
Expand All @@ -81,7 +86,8 @@ public String getCardAddress() {
try {
return core_.getProperty(deviceName_, Properties.TIGER_HEX_ADDRESS);
} catch (Exception e) {
studio_.logs().logError("could not get the Tiger hex address property");
studio_.logs().logError("could not get the Tiger hex address property of "
+ deviceName_ + ": " + e.getMessage());
}
return "";
}
Expand All @@ -90,15 +96,17 @@ public void setRefreshPropertyValues(final boolean state) {
try {
core_.setProperty(deviceName_, Properties.REFRESH_PROPERTY_VALUES, state ? Values.YES : Values.NO);
} catch (Exception e) {
studio_.logs().logError("setRefreshPropertyValues failed.");
studio_.logs().logError("setRefreshPropertyValues failed for "
+ deviceName_ + ": " + e.getMessage());
}
}

public boolean isRefreshPropertyValuesOn() {
try {
return core_.getProperty(deviceName_, Properties.REFRESH_PROPERTY_VALUES).equals(Values.YES);
} catch (Exception e) {
studio_.logs().logError("getRefreshPropertyValues failed.");
studio_.logs().logError("isRefreshPropertyValuesOn failed for "
+ deviceName_ + ": " + e.getMessage());
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public Point2D.Double getXYPosition() {
try {
return core_.getXYStagePosition(deviceName_);
} catch (Exception e) {
studio_.logs().showError("could not get the position for " + deviceName_);
studio_.logs().showError("could not get the position for " + deviceName_ + ": "
+ e.getMessage());
return new Point2D.Double(0.0, 0.0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,26 @@ public void setPosition(final double position) {
try {
core_.setPosition(deviceName_, position);
} catch (Exception e) {
studio_.logs().showError("could not set position for " + deviceName_);
studio_.logs().showError("could not move " + deviceName_ + " to " + position
+ ": " + e.getMessage());
}
}

public void setRelativePosition(final double position) {
try {
core_.setRelativePosition(deviceName_, position);
} catch (Exception e) {
studio_.logs().showError("could not set relative position for " + deviceName_);
studio_.logs().showError("could not move " + deviceName_ + " by " + position
+ ": " + e.getMessage());
}
}

public double getPosition() {
try {
return core_.getPosition(deviceName_);
} catch (Exception e) {
studio_.logs().showError("could not get position for " + deviceName_);
studio_.logs().showError("could not get position for " + deviceName_ + ": "
+ e.getMessage());
return 0.0;
}
}
Expand Down
Loading