Skip to content

Commit

Permalink
Merge pull request micro-manager#2036 from nicost/PairedStageControl
Browse files Browse the repository at this point in the history
LightSheetControl renamed to PairedStageControl.
  • Loading branch information
nicost authored Dec 17, 2024
2 parents 352b97b + 957b7da commit 239da63
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 94 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<project name="LightSheetControl" default="jar">
<project name="PairedStageControl" default="jar">
<import file="../javapluginbuild.xml"/>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
*
* @author kthorn
*/

package org.micromanager.pairedstagecontrol;

import java.util.Iterator;
import mmcorej.DeviceType;
import mmcorej.StrVector;
import org.micromanager.MenuPlugin;
import org.micromanager.Studio;
import org.scijava.plugin.Plugin;
import org.scijava.plugin.SciJavaPlugin;

@Plugin(type = MenuPlugin.class)
public class PairedStageControl implements MenuPlugin, SciJavaPlugin {
public static final String menuName = "Paired Stage Control";
public static final String tooltipDescription =
"Combines the movement of two stages through the Utilities-MultiStage device.";
private Studio studio_;
private PairedStageControlFrame myFrame_;

@Override
public String getSubMenu() {
return "Device Control";
}

@Override
public void onPluginSelected() {
if (myFrame_ == null) {
String multiStageName = "";
//Find multi stage device
StrVector stages = studio_.core().getLoadedDevicesOfType(DeviceType.StageDevice);
final Iterator<String> stageIter = stages.iterator();
while (stageIter.hasNext()) {
String devName = "";
String devLabel = stageIter.next();
try {
devName = studio_.core().getDeviceName(devLabel);
} catch (Exception ex) {
studio_.logs().logError(ex, "Error when requesting stage name");
}
if (devName.equals("Multi Stage")) {
multiStageName = devLabel;
}
}
if (multiStageName.isEmpty()) {
studio_.logs().showError("Cannot find multi stage device. "
+ "This plugin does not work without one. "
+ "Use the Hardware Configuration wizard and select Utilities > MultiStage");
return;
}
myFrame_ = new PairedStageControlFrame(studio_, multiStageName);
}
myFrame_.setVisible(true);
}

@Override
public void setContext(Studio studio) {
studio_ = studio;
}

@Override
public String getName() {
return menuName;
}

@Override
public String getHelpText() {
return "Plugin for controlling AZ100 light sheet microscope in the Nikon Imaging Center,"
+ " UCSF. See Kurt Thorn with questions.";
}

@Override
public String getVersion() {
return "v0.2";
}

@Override
public String getCopyright() {
return "University of California, 2016, 2024";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.micromanager.lightsheetcontrol;
package org.micromanager.pairedstagecontrol;

import java.awt.event.ActionEvent;
import java.io.File;
Expand All @@ -8,21 +8,15 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.AbstractListModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.LayoutStyle;
import javax.swing.WindowConstants;
import mmcorej.DeviceType;
import mmcorej.StrVector;
import net.miginfocom.swing.MigLayout;
import org.apache.commons.math3.stat.regression.SimpleRegression;
import org.micromanager.Studio;
Expand All @@ -34,7 +28,7 @@
* UI part of the LightSheetControlFrame. ALso does the fitting,
* and sets the slope and intercept of stage 2 based on data.
*/
public class LightSheetControlFrame extends JFrame {
public class PairedStageControlFrame extends JFrame {

private final Studio studio_;
private String stage1_ = "";
Expand All @@ -49,31 +43,11 @@ public class LightSheetControlFrame extends JFrame {
*
* @param studio - what do we do without it?
*/
public LightSheetControlFrame(Studio studio) {
public PairedStageControlFrame(Studio studio, String multiStageName) {
studio_ = studio;
rpm_ = new RPModel();
multiStageName_ = multiStageName;

//Find multi stage device
StrVector stages = studio_.core().getLoadedDevicesOfType(DeviceType.StageDevice);
final Iterator<String> stageIter = stages.iterator();
while (stageIter.hasNext()) {
String devName = "";
String devLabel = stageIter.next();
try {
devName = studio_.core().getDeviceName(devLabel);
} catch (Exception ex) {
studio_.logs().logError(ex, "Error when requesting stage name");
}
if (devName.equals("Multi Stage")) {
multiStageName_ = devLabel;
}
}
if (multiStageName_.isEmpty()) {
studio_.logs().showError("Cannot find multi stage device. "
+ "This plugin does not work without one. <br>"
+ "Use the Hardware Configuration wizard and select Utilities > MultiStage");
return;
}
try {
stage1_ = studio_.core().getProperty(multiStageName_, "PhysicalStage-1");
} catch (Exception ex) {
Expand Down Expand Up @@ -335,7 +309,7 @@ private class Helper extends Thread {
public void run() {
try {
ij.plugin.BrowserLauncher.openURL(
"http://micro-manager.org/wiki/LightSheetControl");
"http://micro-manager.org/wiki/PairedStageControl");
} catch (IOException e1) {
studio_.logs().showError(e1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author kthorn
*/

package org.micromanager.lightsheetcontrol;
package org.micromanager.pairedstagecontrol;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author kthorn
*/

package org.micromanager.lightsheetcontrol;
package org.micromanager.pairedstagecontrol;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.micromanager.lightsheetcontrol;
package org.micromanager.pairedstagecontrol;

import java.awt.Color;
import java.awt.geom.Ellipse2D;
Expand Down

0 comments on commit 239da63

Please sign in to comment.