Files
x11ma/plugins/Eiger.java
2022-05-24 10:16:16 +02:00

560 lines
28 KiB
Java
Executable File

import ch.psi.pshell.epics.ChannelDouble;
import ch.psi.pshell.epics.ChannelInteger;
import ch.psi.pshell.imaging.ColormapSource;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.io.IOException;
import java.util.logging.Level;
import java.util.concurrent.TimeUnit;
import javax.swing.SwingUtilities;
/**
*
*/
public class Eiger extends Panel {
boolean updatingControls=true;
ChannelInteger bitDepth;
ChannelInteger mode;
ChannelDouble exposure;
public Eiger() {
initComponents();
}
void initializeDevices() throws IOException, InterruptedException{
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
try {
this.stopTimer();
renderer.clearOverlays();
bitDepth = ((ChannelInteger)getDevice("eiger_bit_depth"));
mode = ((ChannelInteger) getDevice("eiger_mode"));
exposure = ((ChannelDouble) getDevice("eiger_exposure"));
startTimer(1000,10);
} catch (Exception ex) {
showException(ex);
}
}
@Override
public void onStateChange(State state, State former) {
if (former==State.Initializing){
if (checkMeasurements.isSelected()){
checkMeasurementsActionPerformed(null);
}
}
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
@Override
public void onTimer() {
updatingControls=true;
//initializeDevices();
try{
try{
String value = String.valueOf(bitDepth.take());
comboDepth.setSelectedItem(value);
} catch (Exception ex){
comboDepth.setSelectedIndex(comboDepth.getItemCount()-1); //Set "Unknown"
}
try{
comboMode.setSelectedIndex(mode.take());
} catch (Exception ex){
}
try{
spinnerExposure.setValue(exposure.take());
} catch (Exception ex){
}
comboDepth.setEnabled(bitDepth.isInitialized());
comboMode.setEnabled(mode.isInitialized());
spinnerExposure.setEnabled(exposure.isInitialized());
} finally{
updatingControls=false;
}
}
@Override
protected void onShow() {
super.onShow();
new Thread(()->{
String fov="";
try {
fov = String.valueOf(eval("fov.take()", true));
} catch (Exception ex) {
}
String label =fov;
SwingUtilities.invokeLater(()->{
textFOV.setText(label);
});
}).start();
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
renderer = new ch.psi.pshell.imaging.Renderer();
jLabel1 = new javax.swing.JLabel();
comboDepth = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
comboMode = new javax.swing.JComboBox<>();
jLabel3 = new javax.swing.JLabel();
spinnerExposure = new javax.swing.JSpinner();
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceValuePanel3 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceValuePanel4 = new ch.psi.pshell.swing.DeviceValuePanel();
buttonShowDetectorPanel = new javax.swing.JButton();
checkMeasurements = new javax.swing.JCheckBox();
buttonAquire = new javax.swing.JButton();
buttonDone = new javax.swing.JButton();
buttonOpenVG10 = new javax.swing.JButton();
buttonCloseVG10 = new javax.swing.JButton();
comboScale = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
spinnerMax = new javax.swing.JSpinner();
spinnerMin = new javax.swing.JSpinner();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
textFOV = new javax.swing.JTextField();
renderer.setDeviceName("image");
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Stretch);
jLabel1.setText("Bit Depth:");
comboDepth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "8", "16", "32" }));
comboDepth.setEnabled(false);
comboDepth.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboDepthActionPerformed(evt);
}
});
jLabel2.setText("Mode:");
comboMode.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Single", "Continuous" }));
comboMode.setEnabled(false);
comboMode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboModeActionPerformed(evt);
}
});
jLabel3.setText("Exposure [s]:");
spinnerExposure.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 300.0d, 1.0d));
spinnerExposure.setEnabled(false);
spinnerExposure.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerExposureStateChanged(evt);
}
});
deviceValuePanel1.setDeviceName("eiger_mode_rbv");
deviceValuePanel2.setDeviceName("eiger_bit_depth_rbv");
deviceValuePanel3.setDeviceName("eiger_exposure_rbv");
deviceValuePanel4.setDeviceName("eiger_status");
buttonShowDetectorPanel.setText("Control Panel");
buttonShowDetectorPanel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonShowDetectorPanelActionPerformed(evt);
}
});
checkMeasurements.setText("Measurements");
checkMeasurements.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkMeasurementsActionPerformed(evt);
}
});
buttonAquire.setText("Start");
buttonAquire.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAquireActionPerformed(evt);
}
});
buttonDone.setText("Stop");
buttonDone.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDoneActionPerformed(evt);
}
});
buttonOpenVG10.setText("Open VG10");
buttonOpenVG10.setMaximumSize(new java.awt.Dimension(68, 27));
buttonOpenVG10.setMinimumSize(new java.awt.Dimension(68, 27));
buttonOpenVG10.setPreferredSize(new java.awt.Dimension(68, 27));
buttonOpenVG10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonOpenVG10ActionPerformed(evt);
}
});
buttonCloseVG10.setText("Close VG10");
buttonCloseVG10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCloseVG10ActionPerformed(evt);
}
});
comboScale.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Auto", "Manual" }));
comboScale.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboScaleActionPerformed(evt);
}
});
jLabel4.setText("Scale:");
spinnerMax.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerMaxStateChanged(evt);
}
});
spinnerMin.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerMinStateChanged(evt);
}
});
jLabel5.setText("Max:");
jLabel6.setText("Min:");
jLabel7.setText("FOV:");
textFOV.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textFOV.setDisabledTextColor(new java.awt.Color(0, 0, 0));
textFOV.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkMeasurements)
.addComponent(comboScale, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(jLabel6)
.addComponent(jLabel5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spinnerMax, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerMin, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(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)
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(86, 86, 86)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(310, 310, 310)
.addComponent(buttonDone, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(118, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure, textFOV});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER, false)
.addComponent(jLabel2)
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER, false)
.addComponent(jLabel1)
.addComponent(comboDepth, 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(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonDone, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel3)
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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)
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(checkMeasurements)
.addGap(45, 45, 45)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExposure, textFOV});
}// </editor-fold>//GEN-END:initComponents
private void comboDepthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboDepthActionPerformed
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
}
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()) {
Integer value = Integer.valueOf((String)comboDepth.getSelectedItem());
bitDepth.write(value);
}
}
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_comboDepthActionPerformed
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
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
}
Integer value = comboMode.getSelectedIndex();
if (value==1){
value++;
}
mode.write(value);
}
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_comboModeActionPerformed
private void spinnerExposureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExposureStateChanged
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);
exposure.write((Double)spinnerExposure.getValue());
}
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_spinnerExposureStateChanged
private void buttonShowDetectorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowDetectorPanelActionPerformed
try {
showDevicePanel("eiger");
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonShowDetectorPanelActionPerformed
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
private void buttonDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDoneActionPerformed
try {
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonDoneActionPerformed
private void buttonAquireActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAquireActionPerformed
try {
((ch.psi.pshell.device.Camera) getDevice("eiger")).start();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAquireActionPerformed
private void buttonOpenVG10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenVG10ActionPerformed
try {
evalAsync("open_vg10()").handle((ret,ex)->{
if (ex!=null){
showException((Exception)ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonOpenVG10ActionPerformed
private void buttonCloseVG10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCloseVG10ActionPerformed
try {
evalAsync("close_vg10()").handle((ret,ex)->{
if (ex!=null){
showException((Exception)ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonCloseVG10ActionPerformed
private void comboScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboScaleActionPerformed
ColormapSource source = (ColormapSource) renderer.getOrigin();
try{
if (!updatingControls){
Integer value = comboScale.getSelectedIndex();
if(value == 0){
source.getConfig().colormapAutomatic = true;
}
else if(value == 1){
source.getConfig().colormapAutomatic = false;
}
source.getConfig().save();
}
} catch (Exception ex){
getLogger().log(Level.WARNING, null, ex);
}
}//GEN-LAST:event_comboScaleActionPerformed
private void spinnerMaxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMaxStateChanged
ColormapSource source = (ColormapSource) renderer.getOrigin();
try {
source.getConfig().colormapMax = ((Integer)spinnerMax.getValue());
source.getConfig().save();
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
}//GEN-LAST:event_spinnerMaxStateChanged
private void spinnerMinStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMinStateChanged
ColormapSource source = (ColormapSource) renderer.getOrigin();
try {
source.getConfig().colormapMin = ((Integer)spinnerMin.getValue());
source.getConfig().save();
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
}//GEN-LAST:event_spinnerMinStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAquire;
private javax.swing.JButton buttonCloseVG10;
private javax.swing.JButton buttonDone;
private javax.swing.JButton buttonOpenVG10;
private javax.swing.JButton buttonShowDetectorPanel;
private javax.swing.JCheckBox checkMeasurements;
private javax.swing.JComboBox<String> comboDepth;
private javax.swing.JComboBox<String> comboMode;
private javax.swing.JComboBox<String> comboScale;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel3;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
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 ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spinnerExposure;
private javax.swing.JSpinner spinnerMax;
private javax.swing.JSpinner spinnerMin;
private javax.swing.JTextField textFOV;
// End of variables declaration//GEN-END:variables
}