863 lines
44 KiB
Java
863 lines
44 KiB
Java
import ch.psi.pshell.core.Context;
|
|
import ch.psi.pshell.imaging.Overlay;
|
|
import ch.psi.pshell.imaging.Overlays.Rect;
|
|
import ch.psi.pshell.imaging.Renderer;
|
|
import ch.psi.pshell.imaging.RendererListener;
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.utils.State;
|
|
import java.awt.Rectangle;
|
|
import java.util.HashMap;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class Imaging extends Panel {
|
|
static double NaNd = Double.NaN; //Bug on editor?
|
|
|
|
public Imaging() {
|
|
initComponents();
|
|
renderer.addListener(rendererListener);
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
try {
|
|
setGlobalVar("IMAGING_RENDERER", renderer);
|
|
setRoi(getRoi());
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
buttonAbort.setEnabled(state.isProcessing());
|
|
updateButtons();
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
|
|
//Callback to perform update - in event thread
|
|
@Override
|
|
protected void doUpdate() {
|
|
}
|
|
|
|
void updateButtons(){
|
|
boolean enabled = getState()==State.Ready;
|
|
boolean hasRoi = false;
|
|
try{
|
|
hasRoi = getRoi()!=null;
|
|
} catch (Exception ex){
|
|
}
|
|
buttonStartAutoFocus.setEnabled(hasRoi && enabled);
|
|
buttonStartAutoIntensity.setEnabled(enabled);
|
|
buttonRoiClear.setEnabled(hasRoi && enabled);
|
|
buttonRoiSet.setEnabled(!hasRoi && enabled);
|
|
spinnerAverage.setEnabled(enabled);
|
|
spinnerRuns.setEnabled(enabled);
|
|
spinnerExposition.setEnabled(enabled);
|
|
spinnerRangeObj.setEnabled((radioObjective.isSelected() || radioAll.isSelected()) && enabled);
|
|
spinnerStepObj.setEnabled(spinnerRangeObj.isEnabled());
|
|
spinnerRangeStig.setEnabled((!radioObjective.isSelected()) && enabled);
|
|
spinnerStepStig.setEnabled(spinnerRangeStig.isEnabled());
|
|
radioObjective.setEnabled(enabled);
|
|
radioStigA.setEnabled(enabled);
|
|
radioStigB.setEnabled(enabled);
|
|
radioAll.setEnabled(enabled);
|
|
}
|
|
|
|
@Override
|
|
protected void onShow() {
|
|
super.onShow();
|
|
renderer.setDeviceName("image");
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void onHide() {
|
|
super.onHide();
|
|
renderer.setDeviceName(null);
|
|
}
|
|
|
|
Rectangle getRoi(){
|
|
return (Rectangle) getGlobalVar("IMAGING_ROI");
|
|
}
|
|
|
|
void setRoi(Rectangle roi){
|
|
setGlobalVar("IMAGING_ROI", roi);
|
|
try{
|
|
renderer.clearOverlays();
|
|
if (roi!=null){
|
|
Rect ov = new Rect(renderer.getPenProfile(), roi.getLocation(), roi.getSize());
|
|
ov.setMovable(true);
|
|
renderer.addOverlay(ov);
|
|
}
|
|
} finally {
|
|
updateButtons();
|
|
}
|
|
}
|
|
|
|
|
|
final RendererListener rendererListener = new RendererListener(){
|
|
@Override
|
|
public void onMoveFinished(Renderer renderer, Overlay overlay) {
|
|
setGlobalVar("IMAGING_ROI", overlay.getBounds());
|
|
}
|
|
|
|
@Override
|
|
public void onDeleted(Renderer renderer, Overlay overlay) {
|
|
if (getRoi()!=null){
|
|
setRoi(null);
|
|
}
|
|
}
|
|
};
|
|
|
|
void showArrows(boolean show) throws Exception{
|
|
if (show){
|
|
setGlobalVar("IMAGING_RENDERER", renderer);
|
|
evalAsync("start_arrows(renderer=IMAGING_RENDERER)");
|
|
} else {
|
|
setGlobalVar("IMAGING_RENDERER", renderer);
|
|
evalAsync("stop_arrows(renderer=IMAGING_RENDERER)");
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
buttonGroup1 = new javax.swing.ButtonGroup();
|
|
renderer = new ch.psi.pshell.imaging.Renderer();
|
|
jPanel4 = new javax.swing.JPanel();
|
|
jPanel2 = new javax.swing.JPanel();
|
|
buttonStartAutoIntensity = new javax.swing.JButton();
|
|
jLabel12 = new javax.swing.JLabel();
|
|
spinnerExpositionIntensity = new javax.swing.JSpinner();
|
|
processVariablePanel1 = new ch.psi.pshell.swing.ProcessVariablePanel();
|
|
processVariablePanel2 = new ch.psi.pshell.swing.ProcessVariablePanel();
|
|
jPanel1 = new javax.swing.JPanel();
|
|
buttonRoiSet = new javax.swing.JButton();
|
|
buttonRoiClear = new javax.swing.JButton();
|
|
jLabel1 = new javax.swing.JLabel();
|
|
spinnerSize = new javax.swing.JSpinner();
|
|
jPanel3 = new javax.swing.JPanel();
|
|
buttonStartAutoFocus = new javax.swing.JButton();
|
|
jLabel3 = new javax.swing.JLabel();
|
|
spinnerAverage = new javax.swing.JSpinner();
|
|
jLabel4 = new javax.swing.JLabel();
|
|
spinnerRuns = new javax.swing.JSpinner();
|
|
jPanel5 = new javax.swing.JPanel();
|
|
radioObjective = new javax.swing.JRadioButton();
|
|
radioStigA = new javax.swing.JRadioButton();
|
|
radioStigB = new javax.swing.JRadioButton();
|
|
radioAll = new javax.swing.JRadioButton();
|
|
jLabel9 = new javax.swing.JLabel();
|
|
spinnerExposition = new javax.swing.JSpinner();
|
|
jLabel5 = new javax.swing.JLabel();
|
|
jLabel6 = new javax.swing.JLabel();
|
|
jLabel14 = new javax.swing.JLabel();
|
|
jLabel15 = new javax.swing.JLabel();
|
|
spinnerRangeObj = new javax.swing.JSpinner();
|
|
spinnerStepObj = new javax.swing.JSpinner();
|
|
jLabel7 = new javax.swing.JLabel();
|
|
jLabel8 = new javax.swing.JLabel();
|
|
spinnerRangeStig = new javax.swing.JSpinner();
|
|
spinnerStepStig = new javax.swing.JSpinner();
|
|
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
|
|
jLabel10 = new javax.swing.JLabel();
|
|
jLabel13 = new javax.swing.JLabel();
|
|
deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
|
|
checkMeasurements = new javax.swing.JCheckBox();
|
|
jLabel11 = new javax.swing.JLabel();
|
|
checkArrows = new javax.swing.JCheckBox();
|
|
buttonAbort = new javax.swing.JButton();
|
|
|
|
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Stretch);
|
|
|
|
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("X-ray illumination"));
|
|
|
|
buttonStartAutoIntensity.setText("Auto");
|
|
buttonStartAutoIntensity.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonStartAutoIntensityActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel12.setText("Exposure:");
|
|
|
|
spinnerExpositionIntensity.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.01d, 100.0d, 1.0d));
|
|
spinnerExpositionIntensity.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerExpositionIntensityStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
processVariablePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Girder X [mm]"));
|
|
processVariablePanel1.setDeviceName("girder_x");
|
|
processVariablePanel1.setPreferredSize(new java.awt.Dimension(188, 112));
|
|
processVariablePanel1.setShowLimitButtons(false);
|
|
processVariablePanel1.setShowSlider(false);
|
|
processVariablePanel1.setShowStop(false);
|
|
processVariablePanel1.setStepIncrement(0.01);
|
|
processVariablePanel1.setStepSize(0.01);
|
|
|
|
processVariablePanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Girder Y [mm]"));
|
|
processVariablePanel2.setDeviceName("girder_y");
|
|
processVariablePanel2.setShowLimitButtons(false);
|
|
processVariablePanel2.setShowSlider(false);
|
|
processVariablePanel2.setShowStop(false);
|
|
processVariablePanel2.setStepIncrement(0.01);
|
|
processVariablePanel2.setStepSize(0.01);
|
|
|
|
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
|
jPanel2.setLayout(jPanel2Layout);
|
|
jPanel2Layout.setHorizontalGroup(
|
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel2Layout.createSequentialGroup()
|
|
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
|
.addComponent(processVariablePanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
|
|
.addGap(12, 12, 12)
|
|
.addComponent(jLabel12)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(spinnerExpositionIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGap(69, 69, 69)
|
|
.addComponent(buttonStartAutoIntensity))
|
|
.addComponent(processVariablePanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
jPanel2Layout.setVerticalGroup(
|
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel2Layout.createSequentialGroup()
|
|
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel12)
|
|
.addComponent(spinnerExpositionIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(buttonStartAutoIntensity))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(processVariablePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(processVariablePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
|
|
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("ROI"));
|
|
|
|
buttonRoiSet.setText("Set");
|
|
buttonRoiSet.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonRoiSetActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonRoiClear.setText("Clear");
|
|
buttonRoiClear.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonRoiClearActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel1.setText("Size:");
|
|
|
|
spinnerSize.setModel(new javax.swing.SpinnerListModel(new String[] {"16", "32", "64", "128", "256", "512"}));
|
|
spinnerSize.setValue("256");
|
|
spinnerSize.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerSizeStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
|
jPanel1.setLayout(jPanel1Layout);
|
|
jPanel1Layout.setHorizontalGroup(
|
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(buttonRoiClear)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(buttonRoiSet, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addComponent(jLabel1)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(spinnerSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
);
|
|
|
|
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonRoiClear, buttonRoiSet});
|
|
|
|
jPanel1Layout.setVerticalGroup(
|
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(buttonRoiClear)
|
|
.addComponent(buttonRoiSet)
|
|
.addComponent(jLabel1)
|
|
.addComponent(spinnerSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addContainerGap())
|
|
);
|
|
|
|
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Auto-Focus"));
|
|
|
|
buttonStartAutoFocus.setText("Start");
|
|
buttonStartAutoFocus.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonStartAutoFocusActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel3.setText("Average:");
|
|
|
|
spinnerAverage.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));
|
|
spinnerAverage.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerAverageStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
jLabel4.setText("Runs:");
|
|
|
|
spinnerRuns.setModel(new javax.swing.SpinnerNumberModel(1, 0, 10, 1));
|
|
spinnerRuns.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerRunsStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
buttonGroup1.add(radioObjective);
|
|
radioObjective.setSelected(true);
|
|
radioObjective.setText("Objective");
|
|
radioObjective.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioObjectiveActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonGroup1.add(radioStigA);
|
|
radioStigA.setText("Stigmator A");
|
|
radioStigA.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioStigAActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonGroup1.add(radioStigB);
|
|
radioStigB.setText("Stigmator B");
|
|
radioStigB.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioStigBActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonGroup1.add(radioAll);
|
|
radioAll.setText("All");
|
|
radioAll.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioAllActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
|
|
jPanel5.setLayout(jPanel5Layout);
|
|
jPanel5Layout.setHorizontalGroup(
|
|
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel5Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(radioObjective)
|
|
.addComponent(radioStigA)
|
|
.addComponent(radioStigB)
|
|
.addComponent(radioAll))
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
jPanel5Layout.setVerticalGroup(
|
|
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel5Layout.createSequentialGroup()
|
|
.addGap(0, 0, 0)
|
|
.addComponent(radioObjective)
|
|
.addGap(0, 0, 0)
|
|
.addComponent(radioStigA)
|
|
.addGap(0, 0, 0)
|
|
.addComponent(radioStigB)
|
|
.addGap(0, 0, 0)
|
|
.addComponent(radioAll)
|
|
.addGap(0, 0, 0))
|
|
);
|
|
|
|
jLabel9.setText("Exposure:");
|
|
|
|
spinnerExposition.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.01d, 100.0d, 1.0d));
|
|
spinnerExposition.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerExpositionStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel5.setText("Range:");
|
|
|
|
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel6.setText("Step:");
|
|
|
|
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel14.setText("Obj.");
|
|
|
|
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel15.setText("Obj.");
|
|
|
|
spinnerRangeObj.setModel(new javax.swing.SpinnerNumberModel(4.0d, 1.0d, 10.0d, 1.0d));
|
|
spinnerRangeObj.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerRangeObjStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
spinnerStepObj.setModel(new javax.swing.SpinnerNumberModel(0.2d, 0.1d, 1.0d, 0.1d));
|
|
spinnerStepObj.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerStepObjStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel7.setText("Stig.");
|
|
|
|
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel8.setText("Stig.");
|
|
|
|
spinnerRangeStig.setModel(new javax.swing.SpinnerNumberModel(20.0d, 1.0d, 40.0d, 1.0d));
|
|
spinnerRangeStig.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerRangeStigStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
spinnerStepStig.setModel(new javax.swing.SpinnerNumberModel(2.0d, 1.0d, 10.0d, 1.0d));
|
|
spinnerStepStig.addChangeListener(new javax.swing.event.ChangeListener() {
|
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
spinnerStepStigStateChanged(evt);
|
|
}
|
|
});
|
|
|
|
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
|
jPanel3.setLayout(jPanel3Layout);
|
|
jPanel3Layout.setHorizontalGroup(
|
|
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGap(18, 18, 18)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(spinnerAverage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerRuns, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerExposition, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addComponent(jLabel5)
|
|
.addGap(18, 18, 18)
|
|
.addComponent(jLabel14))
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addComponent(jLabel6)
|
|
.addGap(18, 18, 18)
|
|
.addComponent(jLabel15)))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addComponent(buttonStartAutoFocus)
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(spinnerRangeObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerStepObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jLabel7)
|
|
.addComponent(jLabel8))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(spinnerRangeStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerStepStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addContainerGap(12, Short.MAX_VALUE))))
|
|
);
|
|
|
|
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerAverage, spinnerExposition, spinnerRuns});
|
|
|
|
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7, jLabel8});
|
|
|
|
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerRangeObj, spinnerRangeStig, spinnerStepObj, spinnerStepStig});
|
|
|
|
jPanel3Layout.setVerticalGroup(
|
|
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addGap(4, 4, 4)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel3)
|
|
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(4, 4, 4)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel4)
|
|
.addComponent(spinnerRuns, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(4, 4, 4)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel9)
|
|
.addComponent(spinnerExposition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addGap(12, 12, 12)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel5)
|
|
.addComponent(jLabel14)
|
|
.addComponent(spinnerRangeObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel7)
|
|
.addComponent(spinnerRangeStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel6)
|
|
.addComponent(jLabel15)
|
|
.addComponent(spinnerStepObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel8)
|
|
.addComponent(spinnerStepStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
|
|
.addComponent(buttonStartAutoFocus))
|
|
);
|
|
|
|
deviceValuePanel1.setDeviceName("temp_readout");
|
|
|
|
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel10.setText("T (K):");
|
|
|
|
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel13.setText("FOV:");
|
|
|
|
deviceValuePanel2.setDeviceName("fov");
|
|
|
|
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
|
jPanel4.setLayout(jPanel4Layout);
|
|
jPanel4Layout.setHorizontalGroup(
|
|
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap(19, Short.MAX_VALUE))
|
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
.addGap(6, 6, 6)
|
|
.addComponent(jLabel10)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
|
.addContainerGap())))
|
|
);
|
|
jPanel4Layout.setVerticalGroup(
|
|
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
|
.addGap(9, 9, 9)
|
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jLabel10)
|
|
.addComponent(jLabel13))))
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
|
|
checkMeasurements.setText("measurements");
|
|
checkMeasurements.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
checkMeasurementsActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel11.setText("Reference arrows:");
|
|
|
|
checkArrows.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
|
checkArrows.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
checkArrowsActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonAbort.setText("Abort");
|
|
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonAbortActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
this.setLayout(layout);
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(71, 71, 71)
|
|
.addComponent(checkMeasurements)
|
|
.addGap(34, 34, 34)
|
|
.addComponent(jLabel11)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(checkArrows)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonAbort))
|
|
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap(17, Short.MAX_VALUE))
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(renderer, javax.swing.GroupLayout.PREFERRED_SIZE, 638, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(checkMeasurements)
|
|
.addComponent(jLabel11))
|
|
.addComponent(checkArrows)
|
|
.addComponent(buttonAbort))
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void buttonRoiClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiClearActionPerformed
|
|
try {
|
|
setRoi(null);
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonRoiClearActionPerformed
|
|
|
|
private void buttonRoiSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiSetActionPerformed
|
|
try {
|
|
Rectangle roi = new Rectangle(0,0,Integer.valueOf(spinnerSize.getValue().toString()),Integer.valueOf(spinnerSize.getValue().toString()));
|
|
setRoi(roi);
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonRoiSetActionPerformed
|
|
|
|
private void spinnerSizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerSizeStateChanged
|
|
try {
|
|
Rectangle roi = getRoi();
|
|
if (roi!=null){
|
|
roi.width = Integer.valueOf(spinnerSize.getValue().toString());
|
|
roi.height = Integer.valueOf(spinnerSize.getValue().toString());
|
|
setRoi(roi);
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_spinnerSizeStateChanged
|
|
|
|
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
|
try {
|
|
abort();
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonAbortActionPerformed
|
|
|
|
private void buttonStartAutoIntensityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartAutoIntensityActionPerformed
|
|
try {
|
|
//String cmd = "scan_contrast(girder_x, 0.05, 0.005, average=3)";
|
|
Double exposure = (Double) spinnerExpositionIntensity.getValue();
|
|
String cmd = "auto_intensity(roi=IMAGING_ROI" +
|
|
", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
|
|
")";
|
|
this.evalAsync(cmd).handle((ret, t) -> {
|
|
if ((t != null) && (!getContext().isAborted())) {
|
|
showException((Exception) t);
|
|
}
|
|
return t;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonStartAutoIntensityActionPerformed
|
|
|
|
private void checkArrowsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkArrowsActionPerformed
|
|
try{
|
|
showArrows(checkArrows.isSelected());
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_checkArrowsActionPerformed
|
|
|
|
private void spinnerExpositionIntensityStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpositionIntensityStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerExpositionIntensityStateChanged
|
|
|
|
private void spinnerStepStigStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStepStigStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerStepStigStateChanged
|
|
|
|
private void spinnerRangeStigStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRangeStigStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerRangeStigStateChanged
|
|
|
|
private void spinnerStepObjStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStepObjStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerStepObjStateChanged
|
|
|
|
private void spinnerRangeObjStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRangeObjStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerRangeObjStateChanged
|
|
|
|
private void spinnerExpositionStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpositionStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerExpositionStateChanged
|
|
|
|
private void radioAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioAllActionPerformed
|
|
updateButtons();
|
|
}//GEN-LAST:event_radioAllActionPerformed
|
|
|
|
private void radioStigBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioStigBActionPerformed
|
|
updateButtons();
|
|
}//GEN-LAST:event_radioStigBActionPerformed
|
|
|
|
private void radioStigAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioStigAActionPerformed
|
|
updateButtons();
|
|
}//GEN-LAST:event_radioStigAActionPerformed
|
|
|
|
private void radioObjectiveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioObjectiveActionPerformed
|
|
updateButtons();
|
|
}//GEN-LAST:event_radioObjectiveActionPerformed
|
|
|
|
private void spinnerRunsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRunsStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerRunsStateChanged
|
|
|
|
private void spinnerAverageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerAverageStateChanged
|
|
// TODO add your handling code here:
|
|
}//GEN-LAST:event_spinnerAverageStateChanged
|
|
|
|
private void buttonStartAutoFocusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartAutoFocusActionPerformed
|
|
try {
|
|
HashMap args = new HashMap();
|
|
String scan_type = "all";
|
|
if (radioObjective.isSelected()){
|
|
scan_type = "obj";
|
|
} else if (radioStigA.isSelected()){
|
|
scan_type = "stiga";
|
|
} else if (radioStigB.isSelected()){
|
|
scan_type = "stigb";
|
|
}
|
|
int average = (Integer)spinnerAverage.getValue();
|
|
int runs = (Integer)spinnerRuns.getValue();
|
|
Double exposure = (Double) spinnerExposition.getValue();
|
|
|
|
//runAsync("templates/AutoFocus", args).handle((ret, t) -> {
|
|
//auto_focus(range_obj=4.0, step_obj=0.2, range_stig=20.0, step_stig=2.0, average=1, runs=2, roi=None):
|
|
String cmd = "auto_focus(scan_type='" + scan_type + "'" +
|
|
", range_obj=" + spinnerRangeObj.getValue() +
|
|
", step_obj=" + spinnerStepObj.getValue() +
|
|
", range_stig=" + spinnerRangeStig.getValue() +
|
|
", step_stig=" + spinnerStepStig.getValue() +
|
|
", average=" + average +
|
|
", runs=" + runs +
|
|
", renderer=IMAGING_RENDERER"+
|
|
", roi=IMAGING_ROI"+
|
|
", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
|
|
")";
|
|
this.evalAsync(cmd).handle((ret, t) -> {
|
|
if ((t != null) && (!getContext().isAborted())) {
|
|
showException((Exception) t);
|
|
}
|
|
return t;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonStartAutoFocusActionPerformed
|
|
|
|
private void checkMeasurementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkMeasurementsActionPerformed
|
|
try {
|
|
if (checkMeasurements.isSelected()){
|
|
setGlobalVar("PLUGIN_RENDERER", renderer);
|
|
evalAsync("start_measurements(renderer=PLUGIN_RENDERER)");
|
|
} else {
|
|
evalAsync("stop_measurements()");
|
|
}
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_checkMeasurementsActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton buttonAbort;
|
|
private javax.swing.ButtonGroup buttonGroup1;
|
|
private javax.swing.JButton buttonRoiClear;
|
|
private javax.swing.JButton buttonRoiSet;
|
|
private javax.swing.JButton buttonStartAutoFocus;
|
|
private javax.swing.JButton buttonStartAutoIntensity;
|
|
private javax.swing.JCheckBox checkArrows;
|
|
private javax.swing.JCheckBox checkMeasurements;
|
|
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
|
|
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2;
|
|
private javax.swing.JLabel jLabel1;
|
|
private javax.swing.JLabel jLabel10;
|
|
private javax.swing.JLabel jLabel11;
|
|
private javax.swing.JLabel jLabel12;
|
|
private javax.swing.JLabel jLabel13;
|
|
private javax.swing.JLabel jLabel14;
|
|
private javax.swing.JLabel jLabel15;
|
|
private javax.swing.JLabel jLabel3;
|
|
private javax.swing.JLabel jLabel4;
|
|
private javax.swing.JLabel jLabel5;
|
|
private javax.swing.JLabel jLabel6;
|
|
private javax.swing.JLabel jLabel7;
|
|
private javax.swing.JLabel jLabel8;
|
|
private javax.swing.JLabel jLabel9;
|
|
private javax.swing.JPanel jPanel1;
|
|
private javax.swing.JPanel jPanel2;
|
|
private javax.swing.JPanel jPanel3;
|
|
private javax.swing.JPanel jPanel4;
|
|
private javax.swing.JPanel jPanel5;
|
|
private ch.psi.pshell.swing.ProcessVariablePanel processVariablePanel1;
|
|
private ch.psi.pshell.swing.ProcessVariablePanel processVariablePanel2;
|
|
private javax.swing.JRadioButton radioAll;
|
|
private javax.swing.JRadioButton radioObjective;
|
|
private javax.swing.JRadioButton radioStigA;
|
|
private javax.swing.JRadioButton radioStigB;
|
|
private ch.psi.pshell.imaging.Renderer renderer;
|
|
private javax.swing.JSpinner spinnerAverage;
|
|
private javax.swing.JSpinner spinnerExposition;
|
|
private javax.swing.JSpinner spinnerExpositionIntensity;
|
|
private javax.swing.JSpinner spinnerRangeObj;
|
|
private javax.swing.JSpinner spinnerRangeStig;
|
|
private javax.swing.JSpinner spinnerRuns;
|
|
private javax.swing.JSpinner spinnerSize;
|
|
private javax.swing.JSpinner spinnerStepObj;
|
|
private javax.swing.JSpinner spinnerStepStig;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|