This commit is contained in:
@@ -16,6 +16,7 @@ public class Eiger extends Panel {
|
||||
ChannelInteger bitDepth;
|
||||
ChannelInteger mode;
|
||||
ChannelDouble exposure;
|
||||
ChannelDouble threshold;
|
||||
|
||||
public Eiger() {
|
||||
initComponents();
|
||||
@@ -33,6 +34,7 @@ public class Eiger extends Panel {
|
||||
bitDepth = ((ChannelInteger)getDevice("eiger_bit_depth"));
|
||||
mode = ((ChannelInteger) getDevice("eiger_mode"));
|
||||
exposure = ((ChannelDouble) getDevice("eiger_exposure"));
|
||||
threshold = ((ChannelDouble) getDevice("eiger_threshold"));
|
||||
startTimer(1000,10);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
@@ -70,10 +72,15 @@ public class Eiger extends Panel {
|
||||
try{
|
||||
spinnerExposure.setValue(exposure.take());
|
||||
} catch (Exception ex){
|
||||
}
|
||||
}
|
||||
try{
|
||||
spinnerThreshold.setValue(threshold.take());
|
||||
} catch (Exception ex){
|
||||
}
|
||||
comboDepth.setEnabled(bitDepth.isInitialized());
|
||||
comboMode.setEnabled(mode.isInitialized());
|
||||
spinnerExposure.setEnabled(exposure.isInitialized());
|
||||
spinnerExposure.setEnabled(exposure.isInitialized());
|
||||
spinnerThreshold.setEnabled(threshold.isInitialized());
|
||||
|
||||
} finally{
|
||||
updatingControls=false;
|
||||
@@ -131,6 +138,9 @@ public class Eiger extends Panel {
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
textFOV = new javax.swing.JTextField();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
spinnerThreshold = new javax.swing.JSpinner();
|
||||
deviceValuePanel5 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
|
||||
renderer.setDeviceName("image");
|
||||
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Stretch);
|
||||
@@ -249,6 +259,23 @@ public class Eiger extends Panel {
|
||||
textFOV.setDisabledTextColor(new java.awt.Color(0, 0, 0));
|
||||
textFOV.setEnabled(false);
|
||||
|
||||
jLabel8.setText("Threshold [eV]:");
|
||||
|
||||
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(0.0d, null, null, 1.0d));
|
||||
spinnerThreshold.setEnabled(false);
|
||||
spinnerThreshold.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerThresholdStateChanged(evt);
|
||||
}
|
||||
});
|
||||
spinnerThreshold.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
|
||||
public void propertyChange(java.beans.PropertyChangeEvent evt) {
|
||||
spinnerThresholdPropertyChange(evt);
|
||||
}
|
||||
});
|
||||
|
||||
deviceValuePanel5.setDeviceName("eiger_threshold_rbv");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -278,16 +305,26 @@ public class Eiger extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(textFOV, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel8)
|
||||
.addGap(10, 10, 10)))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
@@ -307,7 +344,7 @@ public class Eiger extends Panel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGap(39, 39, 39))))
|
||||
.addGap(166, 166, 166))))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure, textFOV});
|
||||
@@ -338,9 +375,13 @@ public class Eiger extends Panel {
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(36, 36, 36)
|
||||
@@ -527,6 +568,27 @@ public class Eiger extends Panel {
|
||||
|
||||
}//GEN-LAST:event_spinnerMinStateChanged
|
||||
|
||||
private void spinnerThresholdStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerThresholdStateChanged
|
||||
try{
|
||||
if (!updatingControls){
|
||||
ch.psi.pshell.device.Camera eiger = (ch.psi.pshell.device.Camera) getDevice("eiger");
|
||||
if (eiger.isStarted()){
|
||||
buttonDoneActionPerformed(null);
|
||||
eiger.waitState(State.Ready, 10000); //Timeout of 10s
|
||||
}
|
||||
//((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
|
||||
//TimeUnit.SECONDS.sleep(1);
|
||||
threshold.write((Double)spinnerThreshold.getValue());
|
||||
}
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_spinnerThresholdStateChanged
|
||||
|
||||
private void spinnerThresholdPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_spinnerThresholdPropertyChange
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_spinnerThresholdPropertyChange
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAquire;
|
||||
private javax.swing.JButton buttonCloseVG10;
|
||||
@@ -541,6 +603,7 @@ public class Eiger extends Panel {
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel3;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel4;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel5;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
@@ -548,10 +611,12 @@ public class Eiger extends Panel {
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private ch.psi.pshell.imaging.Renderer renderer;
|
||||
private javax.swing.JSpinner spinnerExposure;
|
||||
private javax.swing.JSpinner spinnerMax;
|
||||
private javax.swing.JSpinner spinnerMin;
|
||||
private javax.swing.JSpinner spinnerThreshold;
|
||||
private javax.swing.JTextField textFOV;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user