This commit is contained in:
@@ -186,7 +186,9 @@ public class ScreenPanel2 extends Panel {
|
||||
Arrays.fill(gX2, Double.NaN);
|
||||
try {
|
||||
double x = getServerDoubleArray("gr_x_axis", cache)[0];
|
||||
System.arraycopy(x_fit_gauss_function, 0, gX2, (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageX(x) : x), x_fit_gauss_function.length);
|
||||
gr_size_x = x_fit_gauss_function.length;
|
||||
gr_pos_x = (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageX(x) : x);
|
||||
System.arraycopy(x_fit_gauss_function, 0, gX2, gr_pos_x , gr_size_x);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
x_fit_gauss_function = gX2;
|
||||
@@ -194,7 +196,9 @@ public class ScreenPanel2 extends Panel {
|
||||
Arrays.fill(gY2, Double.NaN);
|
||||
try {
|
||||
double y = getServerDoubleArray("gr_y_axis", cache)[0];
|
||||
System.arraycopy(y_fit_gauss_function, 0, gY2, (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageY(y) : y), y_fit_gauss_function.length);
|
||||
gr_size_y = y_fit_gauss_function.length;
|
||||
gr_pos_y = (int) ((renderer.getCalibration() != null) ? renderer.getCalibration().convertToImageY(y) : y);
|
||||
System.arraycopy(y_fit_gauss_function, 0, gY2, gr_pos_y, y_fit_gauss_function.length);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
y_fit_gauss_function = gY2;
|
||||
@@ -225,6 +229,10 @@ public class ScreenPanel2 extends Panel {
|
||||
public double[] x_fit_gauss_function;
|
||||
public double[] y_profile;
|
||||
public double[] y_fit_gauss_function;
|
||||
public int gr_size_x;
|
||||
public int gr_pos_x;
|
||||
public int gr_size_y;
|
||||
public int gr_pos_y;
|
||||
public PointDouble[] sliceCenters;
|
||||
public StreamValue cache;
|
||||
}
|
||||
@@ -1229,58 +1237,73 @@ public class ScreenPanel2 extends Panel {
|
||||
sliceCenters = id.sliceCenters;
|
||||
|
||||
profileSize /= 4;
|
||||
if (pX != null) {
|
||||
int[] x = Arr.indexesInt(pX.length);
|
||||
int[] y = new int[pX.length];
|
||||
int[] p = new int[pX.length];
|
||||
if (pX != null) {
|
||||
int[] xp = Arr.indexesInt(pX.length);
|
||||
int[] xg = xp;
|
||||
int[] yp = new int[pX.length];
|
||||
int[] yg = new int[pX.length];
|
||||
|
||||
List<Double> l = Arrays.asList((Double[]) Convert.toWrapperArray(pX));
|
||||
Double min = Collections.min(l);
|
||||
Double max = Collections.max(l);
|
||||
double minPlot = min;
|
||||
double rangePlot = max - min;
|
||||
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
double minProfile = Collections.min(l);
|
||||
double maxProfile = Collections.max(l);
|
||||
double rangeProfile = maxProfile - minProfile;
|
||||
double minGauss = minProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
//If not good region, range of profile and fit are similar so save this calcultion
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
l = Arrays.asList( (Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gX, id.gr_pos_x, id.gr_pos_x + id.gr_size_x)));
|
||||
minGauss = Collections.min(l);
|
||||
rangeGauss = Collections.max(l) - minGauss;
|
||||
}
|
||||
|
||||
for (int i = 0; i < xp.length; i++) {
|
||||
if (gX != null) {
|
||||
y[i] = (int) (height - 1 - (((gX[i] - minPlot) / rangePlot) * profileSize));
|
||||
yg[i] = (int) (height - 1 - (((gX[i] - minGauss) / rangeGauss) * profileSize));
|
||||
}
|
||||
p[i] = (int) (height - 1 - (((pX[i] - minPlot) / rangePlot) * profileSize));
|
||||
yp[i] = (int) (height - 1 - (((pX[i] - minProfile) / rangeProfile) * profileSize));
|
||||
}
|
||||
|
||||
if (goodRegion) {
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
y[i] = (Double.isNaN(gX[i])) ? 100000 : y[i];
|
||||
}
|
||||
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
xg = Arrays.copyOfRange(xg, id.gr_pos_x, id.gr_pos_x + id.gr_size_x);
|
||||
yg = Arrays.copyOfRange(yg, id.gr_pos_x, id.gr_pos_x + id.gr_size_x);
|
||||
}
|
||||
|
||||
vgaussian = new Overlays.Polyline(penFit, x, y);
|
||||
vprofile = new Overlays.Polyline(renderer.getPenProfile(), x, p);
|
||||
|
||||
vgaussian = new Overlays.Polyline(penFit, xg, yg);
|
||||
vprofile = new Overlays.Polyline(renderer.getPenProfile(), xp, yp);
|
||||
}
|
||||
|
||||
if (pY != null) {
|
||||
int[] y = Arr.indexesInt(pY.length);
|
||||
int[] x = new int[pY.length];
|
||||
int[] p = new int[pY.length];
|
||||
int[] xp = new int[pY.length];
|
||||
int[] xg = new int[pY.length];
|
||||
int[] yp = Arr.indexesInt(pY.length);
|
||||
int[] yg = yp;
|
||||
|
||||
List<Double> l = Arrays.asList((Double[]) Convert.toWrapperArray(pY));
|
||||
Double min = Collections.min(l);
|
||||
Double max = Collections.max(l);
|
||||
double minPlot = min;
|
||||
double rangePlot = max - min;
|
||||
double minProfile = Collections.min(l);
|
||||
double maxProfile = Collections.max(l);
|
||||
double rangeProfile = maxProfile - minProfile;
|
||||
double minGauss = minProfile;
|
||||
double rangeGauss = rangeProfile;
|
||||
//If not good region, range of profile and fit are similar so save this calcultion
|
||||
if (goodRegion && id.gr_size_y>0){
|
||||
l = Arrays.asList( (Double[]) Convert.toWrapperArray(Arrays.copyOfRange(gY, id.gr_pos_y, id.gr_pos_y + id.gr_size_y)));
|
||||
minGauss = Collections.min(l);
|
||||
rangeGauss = Collections.max(l) - minGauss;
|
||||
}
|
||||
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
for (int i = 0; i < xp.length; i++) {
|
||||
if (gY != null) {
|
||||
x[i] = (int) (((gY[i] - minPlot) / rangePlot) * profileSize);
|
||||
xg[i] = (int) (((gY[i] - minGauss) / rangeGauss) * profileSize);
|
||||
}
|
||||
p[i] = (int) (((pY[i] - minPlot) / rangePlot) * profileSize);
|
||||
xp[i] = (int) (((pY[i] - minProfile) / rangeProfile) * profileSize);
|
||||
}
|
||||
|
||||
if (goodRegion) {
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
x[i] = (Double.isNaN(gY[i])) ? -1 : x[i];
|
||||
}
|
||||
if (goodRegion && id.gr_size_x>0){
|
||||
xg = Arrays.copyOfRange(xg, id.gr_pos_y, id.gr_pos_y + id.gr_size_y);
|
||||
yg = Arrays.copyOfRange(yg, id.gr_pos_y, id.gr_pos_y + id.gr_size_y);
|
||||
}
|
||||
hgaussian = new Overlays.Polyline(penFit, x, y);
|
||||
hprofile = new Overlays.Polyline(renderer.getPenProfile(), p, y);
|
||||
hgaussian = new Overlays.Polyline(penFit, xg, yg);
|
||||
hprofile = new Overlays.Polyline(renderer.getPenProfile(), xp, yp);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
@@ -2120,6 +2143,16 @@ public class ScreenPanel2 extends Panel {
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Stream", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"PID", value.getPulseId()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"PID", ex.getMessage()});
|
||||
}
|
||||
try {
|
||||
dataTableModel.addRow(new Object[]{"Timestamp", value.getTimestamp()});
|
||||
} catch (Exception ex) {
|
||||
dataTableModel.addRow(new Object[]{"Timestamp", ex.getMessage()});
|
||||
}
|
||||
Collections.sort(ids);
|
||||
for (String id : ids) {
|
||||
dataTableModel.addRow(new Object[]{id, ""});
|
||||
@@ -2127,7 +2160,7 @@ public class ScreenPanel2 extends Panel {
|
||||
}
|
||||
Frame frame = getCurrentFrame();
|
||||
if ((frame != null) && (frame.cache!=null)){
|
||||
for (int i = 2; i < dataTableModel.getRowCount(); i++) {
|
||||
for (int i = 4; i < dataTableModel.getRowCount(); i++) {
|
||||
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
|
||||
//Object obj = server.getValue(id);
|
||||
Object obj = frame.cache.getValue(id);
|
||||
@@ -3071,7 +3104,8 @@ public class ScreenPanel2 extends Panel {
|
||||
ColormapSource source = (ColormapSource) camera;
|
||||
Color colorReticule = new Color(16, 16, 16);
|
||||
Color colorMarker = new Color(128, 128, 128);
|
||||
source.getConfig().colormap = (Colormap) comboColormap.getSelectedItem();
|
||||
Colormap colormap = (Colormap) comboColormap.getSelectedItem();
|
||||
source.getConfig().colormap = (colormap==null) ? Colormap.Flame: colormap;
|
||||
switch (source.getConfig().colormap) {
|
||||
case Grayscale:
|
||||
case Inverted:
|
||||
|
||||
Reference in New Issue
Block a user