ROI centering and ROI measurements

This commit is contained in:
gac-x11ma
2023-01-26 15:14:49 +01:00
parent c3cadf6ec7
commit e8d2641c57
6 changed files with 77 additions and 52 deletions

View File

@@ -1,4 +1,4 @@
#Mon Aug 08 11:50:49 CEST 2022
#Thu Jan 26 14:35:03 CET 2023
imageSourcesFile={config}/imaging.properties
autoSaveScanData=true
simulation=false
@@ -53,4 +53,5 @@ versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x11ma.git
dataProvider=txt
dataScanLazyTableCreation=false
saveCommandStatistics=false

View File

@@ -1,4 +1,4 @@
#Thu Dec 22 16:41:53 CET 2022
#Thu Jan 26 14:35:28 CET 2023
HARMONIC_ID_1=1
RSYNC_USER=
CFF=2.25

View File

@@ -1,4 +1,4 @@
#Thu Dec 22 10:11:40 CET 2022
#Fri Dec 23 22:39:00 CET 2022
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
@@ -6,7 +6,7 @@ scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=50.0
colormapMax=20.0
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
@@ -19,7 +19,7 @@ spatialCalUnits=null
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
colormapAutomatic=false
roiY=0
roiX=0
transpose=false

View File

@@ -322,54 +322,61 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerAverage" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRuns" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExposition" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
<Component id="jLabel15" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerRangeObj" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepObj" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" linkSize="6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" linkSize="6" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerRangeStig" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepStig" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonStartAutoFocus" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerAverage" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRuns" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExposition" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" linkSize="6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
<Component id="jLabel15" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerRangeObj" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepObj" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" linkSize="6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" linkSize="6" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerRangeStig" linkSize="7" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepStig" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStartAutoFocus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@@ -96,6 +96,9 @@ public class Imaging extends Panel {
ov.setMovable(true);
renderer.addOverlay(ov);
}
if (checkMeasurements.isSelected()){
checkMeasurementsActionPerformed(null);
}
} finally {
updateButtons();
}
@@ -663,7 +666,16 @@ public class Imaging extends Panel {
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()));
int x=0;
int y=0;
int width = Integer.valueOf(spinnerSize.getValue().toString());
int height = Integer.valueOf(spinnerSize.getValue().toString());
try{
x = Math.max((renderer.getImage().getWidth() - width) / 2, 0);
y = Math.max((renderer.getImage().getHeight() - height) / 2, 0);
} catch(Exception ex){
}
Rectangle roi = new Rectangle(x,y, width, height);
setRoi(roi);
} catch (Exception ex) {
showException(ex);

View File

@@ -578,6 +578,11 @@ class MeasurementsFilter(Filter):
for measurement in self.measurements:
val = get_measurement(ip,measurement)
msg = msg + "%s = %1.4f\n" % (measurement,val)
if IMAGING_ROI is not None:
s=ip.crop([Roi(IMAGING_ROI)])[0]
for measurement in self.measurements:
val = get_measurement(s,measurement)
msg = msg + "ROI %s = %1.4f\n" % (measurement,val)
self.overlay.update(msg)
except:
self.overlay.update(str(sys.exc_info()[1]))
@@ -600,7 +605,7 @@ class MeasurementsFilter(Filter):
filter_measurements = None
def start_measurements(measurements=["StdDev"], source = None, renderer=None):
def start_measurements(measurements=["StdDev", "Mean"], source = None, renderer=None):
global filter_measurements
if source is None:
source = image