Imaging ROI in scan roi selection panel.

This commit is contained in:
gac-x11ma
2023-01-26 16:11:57 +01:00
parent e8d2641c57
commit 8488d81c80
5 changed files with 105 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
#Thu Jan 26 14:35:28 CET 2023
#Thu Jan 26 15:36:34 CET 2023
HARMONIC_ID_1=1
RSYNC_USER=
CFF=2.25

View File

@@ -1,4 +1,4 @@
#Thu Dec 22 17:00:25 CET 2022
LastRunDate=221222
FileSequentialNumber=18358
DaySequentialNumber=43
#Thu Jan 26 15:42:52 CET 2023
LastRunDate=230126
FileSequentialNumber=18359
DaySequentialNumber=1

View File

@@ -13,9 +13,11 @@ import ch.psi.utils.Serializer;
import ch.psi.utils.State;
import ch.psi.utils.Str;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
@@ -140,6 +142,12 @@ public class DataAcquisition extends Panel {
modelRois = (DefaultTableModel) tableRoi.getModel();
new File(ABSORTION_SPECTRUM_PATH).mkdirs();
new File(ROIS_PATH).mkdirs();
imagingRoiOverlay = new Rect(new Pen(Color.GREEN.darker(),0));
imagingRoiOverlay.setSelectable(false);
imagingRoiOverlay.setMovable(false);
imagingRoiOverlay.setSolid(false);
rendererRoi.addOverlay(imagingRoiOverlay);
}
//Overridable callbacks
@@ -157,7 +165,8 @@ public class DataAcquisition extends Panel {
textOutliersMask.setText(String.valueOf(getSetting("OUTLIERS_MASK_FILE")));
} catch (IOException ex) {
showException(ex);
} }
}
}
@Override
public void onStateChange(State state, State former) {
@@ -182,6 +191,20 @@ public class DataAcquisition extends Panel {
textFOV.setText(label);
});
}).start();
Rectangle imagingRoi = getImagingRoi();
if (imagingRoi==null){
imagingRoiOverlay.setVisible(false);
} else {
imagingRoiOverlay.setPosition(imagingRoi.getLocation());
imagingRoiOverlay.setSize(imagingRoi.getSize());
imagingRoiOverlay.setVisible(true);
}
}
Rect imagingRoiOverlay;
Rectangle getImagingRoi(){
return (Rectangle) getGlobalVar("IMAGING_ROI");
}
//Callback to perform update - in event thread

View File

@@ -19,11 +19,6 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="79" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="ButtonNeutralizePosition" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="label7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="ButtonDefaultOptics10kV" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@@ -48,6 +43,14 @@
<Component id="label1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonRunSelected" alignment="0" max="32767" attributes="0"/>
<Component id="ButtonNeutralizePosition" linkSize="1" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="label7" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="68" max="32767" attributes="0"/>
</Group>
@@ -91,7 +94,9 @@
<Component id="label5" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="83" max="32767" attributes="0"/>
<EmptySpace pref="40" max="32767" attributes="0"/>
<Component id="buttonRunSelected" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -168,5 +173,13 @@
<Property name="text" type="java.lang.String" value="x,y = 0.0, tilt = 0.0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonRunSelected">
<Properties>
<Property name="text" type="java.lang.String" value="Run Selected"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRunSelectedActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -1,8 +1,12 @@
import ch.psi.pshell.core.CommandSource;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
/**
@@ -49,7 +53,7 @@ public class XPEEM_Settings extends Panel {
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -65,6 +69,7 @@ public class XPEEM_Settings extends Panel {
label5 = new java.awt.Label();
label6 = new java.awt.Label();
label7 = new java.awt.Label();
buttonRunSelected = new javax.swing.JButton();
ButtonDefaultXrays.setText("X-rays (Standard)");
ButtonDefaultXrays.addActionListener(new java.awt.event.ActionListener() {
@@ -109,6 +114,13 @@ public class XPEEM_Settings extends Panel {
label7.setText("x,y = 0.0, tilt = 0.0");
buttonRunSelected.setText("Run Selected");
buttonRunSelected.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRunSelectedActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -116,10 +128,6 @@ public class XPEEM_Settings extends Panel {
.addGroup(layout.createSequentialGroup()
.addGap(79, 79, 79)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(ButtonNeutralizePosition)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(ButtonDefaultOptics10kV)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -137,7 +145,13 @@ public class XPEEM_Settings extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(label1, 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.TRAILING, false)
.addComponent(buttonRunSelected, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ButtonNeutralizePosition, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(68, Short.MAX_VALUE))
);
@@ -173,7 +187,9 @@ public class XPEEM_Settings extends Panel {
.addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(83, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
.addComponent(buttonRunSelected)
.addGap(16, 16, 16))
);
label1.getAccessibleContext().setAccessibleName("ID2 only, lin. hor., G3, 800 eV, energy slit = 300,");
@@ -231,11 +247,45 @@ public class XPEEM_Settings extends Panel {
}
}//GEN-LAST:event_ButtonNeutralizePositionActionPerformed
private void buttonRunSelectedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunSelectedActionPerformed
try {
getContext().startExecution(CommandSource.plugin, null, null,null, false);
new Thread(()->{
try{
if (true){
this.eval("peem_optics_default_15kV()", true);
}
if (true){
this.eval("peem_optics_default_10kV()", true);
}
if (true){
this.eval("xrays_default()", true);
}
if (true){
this.eval("neutralize_position()", true);
}
} catch (Exception ex){
getLogger().log(Level.WARNING, null, ex);
} finally{
try {
getContext().endExecution();
} catch (Context.ContextStateException ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}
}).start();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonRunSelectedActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton ButtonDefaultOptics10kV;
private javax.swing.JButton ButtonDefaultOptics15kV;
private javax.swing.JButton ButtonDefaultXrays;
private javax.swing.JButton ButtonNeutralizePosition;
private javax.swing.JButton buttonRunSelected;
private java.awt.Label label1;
private java.awt.Label label2;
private java.awt.Label label3;