This commit is contained in:
voulot_d
2017-06-02 17:03:41 +02:00
parent c6a20f54f2
commit 0720a1e5f2
7 changed files with 62 additions and 23 deletions

View File

@@ -129,6 +129,10 @@ public class ScreenPanel extends Panel {
yMean = getCamtoolDouble("y_fit_mean");
xSigma = getCamtoolDouble("x_fit_standard_deviation");
ySigma = getCamtoolDouble("y_fit_standard_deviation");
xCom = getCamtoolDouble("x_center_of_mass");
yCom = getCamtoolDouble("y_center_of_mass");
xRms = getCamtoolDouble("x_rms");
yRms = getCamtoolDouble("y_rms");
x_profile = getCamtoolDoubleArray("x_profile");
x_fit_gauss_function = getCamtoolDoubleArray("x_fit_gauss_function");
y_profile = getCamtoolDoubleArray("y_profile");
@@ -138,8 +142,12 @@ public class ScreenPanel extends Panel {
Data data;
Double xMean;
Double yMean;
Double xCom;
Double xRms;
Double xSigma;
Double ySigma;
Double yCom;
Double yRms;
double[] x_profile;
double[] x_fit_gauss_function;
double[] y_profile;
@@ -928,8 +936,8 @@ public class ScreenPanel extends Panel {
Overlays.Polyline vgaussian = null;
Overlays.Polyline hprofile = null;
Overlays.Polyline vprofile = null;
Double xMean = null, xSigma = null, xNorm = null;
Double yMean = null, ySigma = null, yNorm = null;
Double xMean = null, xSigma = null, xNorm = null, xCom = null, xRms = null;
Double yMean = null, ySigma = null, yNorm = null, yCom = null, yRms = null;
double[] pX = null, pY = null, gX = null, gY = null;
int height = data.getHeight();
int width = data.getWidth();
@@ -950,6 +958,10 @@ public class ScreenPanel extends Panel {
gX = f.x_fit_gauss_function;
pY = f.y_profile;
gY = f.y_fit_gauss_function;
xCom = f.xCom;
xRms = f.xRms;
yCom = f.yCom;
yRms = f.yRms;
}
}
}
@@ -958,6 +970,10 @@ public class ScreenPanel extends Panel {
yMean = getCamtoolDouble("y_fit_mean");
xSigma = getCamtoolDouble("x_fit_standard_deviation");
ySigma = getCamtoolDouble("y_fit_standard_deviation");
xCom = getCamtoolDouble("x_center_of_mass");
yCom = getCamtoolDouble("y_center_of_mass");
xRms = getCamtoolDouble("x_rms");
yRms = getCamtoolDouble("y_rms");
pX = getCamtoolDoubleArray("x_profile");
gX = getCamtoolDoubleArray("x_fit_gauss_function");
pY = getCamtoolDoubleArray("y_profile");
@@ -1104,15 +1120,15 @@ public class ScreenPanel extends Panel {
}
Overlays.Crosshairs cross = null;
Overlays.Text text = null;
Overlays.Text textFit = null;
if ((xMean != null) && (yMean != null)) {
text = new Overlays.Text(penFit,
textFit = new Overlays.Text(penFit,
String.format("x: m=%1.3f \u03C3=%1.3f\ny: m=%1.3f \u03C3=%1.3f",
xMean, xSigma,
yMean, ySigma),
new Font(Font.MONOSPACED, 0, 14), new Point(20, 20));
text.setFixed(true);
text.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
textFit.setFixed(true);
textFit.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
Point center = new Point(xMean.intValue(), yMean.intValue());
if (renderer.getCalibration() != null) {
@@ -1122,7 +1138,24 @@ public class ScreenPanel extends Panel {
}
cross = new Overlays.Crosshairs(penCross, center, new Dimension(Math.abs(2 * xSigma.intValue()), 2 * Math.abs(ySigma.intValue())));
}
return new Overlay[]{hprofile, vprofile, hgaussian, vgaussian, cross, text};
if ((xCom != null) && (yCom != null)) {
textFit = new Overlays.Text(penFit,
String.format("x: m=%1.3f \u03C3=%1.3f\ny: m=%1.3f \u03C3=%1.3f",
xMean, xSigma,
yMean, ySigma),
new Font(Font.MONOSPACED, 0, 14), new Point(20, 20));
textFit.setFixed(true);
textFit.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_LEFT);
Point center = new Point(xMean.intValue(), yMean.intValue());
if (renderer.getCalibration() != null) {
center = renderer.getCalibration().convertToImagePosition(new PointDouble(xMean, yMean));
xSigma /= renderer.getCalibration().getScaleX();
ySigma /= renderer.getCalibration().getScaleY();
}
cross = new Overlays.Crosshairs(penCross, center, new Dimension(Math.abs(2 * xSigma.intValue()), 2 * Math.abs(ySigma.intValue())));
}
return new Overlay[]{hprofile, vprofile, hgaussian, vgaussian, cross, textFit};
}
return null;
}