REvert to original

This commit is contained in:
2018-05-16 17:21:24 +02:00
parent cfec9a73a7
commit e5fde50a8d

View File

@@ -42,8 +42,6 @@ import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.RendererListener;
import ch.psi.pshell.imaging.RendererMode;
import ch.psi.pshell.imaging.Source;
import ch.psi.pshell.imaging.SourceBase;
import ch.psi.pshell.imaging.Utils;
import ch.psi.pshell.scripting.InterpreterResult;
import ch.psi.pshell.scripting.ScriptManager;
import ch.psi.pshell.swing.DeviceValueChart;
@@ -146,7 +144,6 @@ public class ScreenPanel2 extends Panel {
String camServerUrl;
String instanceName;
Overlay titleOv = null;
int integration = 0;
String pipelineSuffix = "_sp";
@@ -183,7 +180,7 @@ public class ScreenPanel2 extends Panel {
x_center_of_mass = getServerDouble("x_center_of_mass", cache);
y_center_of_mass = getServerDouble("y_center_of_mass", cache);
x_rms = getServerDouble("x_rms", cache);
y_rms = getServerDouble("y_rms", cache);
y_rms = getServerDouble("y_rms", cache);
if (goodRegion) {
double[] gX2 = new double[x_profile.length];
Arrays.fill(gX2, Double.NaN);
@@ -235,7 +232,7 @@ public class ScreenPanel2 extends Panel {
public int gr_size_x;
public int gr_pos_x;
public int gr_size_y;
public int gr_pos_y;
public int gr_pos_y;
public PointDouble[] sliceCenters;
public StreamValue cache;
}
@@ -315,18 +312,7 @@ public class ScreenPanel2 extends Panel {
if (App.hasArgument("suffix")) {
pipelineSuffix = App.getArgumentValue("suffix");
}
if (App.hasArgument("integration")) {
try {
integration = Integer.valueOf(App.getArgumentValue("integration"));
if (integration !=0){
buttonFit.setSelected(false);
buttonProfile.setSelected(false);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
renderer.setProfileNormalized(true);
renderer.setShowProfileLimits(false);
@@ -672,7 +658,7 @@ public class ScreenPanel2 extends Panel {
try {
fo = getFitOverlays(data);
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(ex);
}
}
synchronized (lockOverlays) {
@@ -845,11 +831,7 @@ public class ScreenPanel2 extends Panel {
}
updateButtons();
camera.getConfig().save();
if (Math.abs(integration)>1) {
renderer.setDevice(new ImageIntegrator(integration));
} else {
renderer.setDevice(camera);
}
renderer.setDevice(camera);
renderer.setAutoScroll(true);
renderer.setMarker(marker);
imageSize = null;
@@ -970,58 +952,6 @@ public class ScreenPanel2 extends Panel {
}
}
}
class ImageIntegrator extends ColormapSource {
ImageIntegrator(int num) {
super("Image Averager", camera.getConfig());
boolean continuous = (num<0);
final int numImages = Math.abs(num);
camera.addListener(new ImageListener() {
final ArrayList<Data> buffer = new ArrayList();
Data integration = null;
@Override
public void onImage(Object o, BufferedImage bi, Data data) {
if (continuous){
buffer.add(data);
if (buffer.size()>=numImages){
for (Data d: buffer){
process(d);
}
}
} else {
buffer.add(null); //Just to count
process(data);
}
if (buffer.size()>=numImages){
if (continuous){
buffer.remove(0);
} else {
buffer.clear();
}
if (integration!=null){
//integration.div(numImages);
ImageIntegrator.this.pushData(integration);
}
integration = null;
}
}
void process(Data data){
if (integration == null){
integration = new Data(data);
} else {
integration.sum(data);
}
}
@Override
public void onError(Object origin, Exception ex) {
}
});
}
}
volatile Dimension imageSize;
@@ -1307,7 +1237,7 @@ public class ScreenPanel2 extends Panel {
sliceCenters = id.sliceCenters;
profileSize /= 4;
if (pX != null) {
if (pX != null) {
int[] xp = Arr.indexesInt(pX.length);
int[] xg = xp;
int[] yp = new int[pX.length];
@@ -1376,7 +1306,7 @@ public class ScreenPanel2 extends Panel {
hprofile = new Overlays.Polyline(renderer.getPenProfile(), xp, yp);
}
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(ex.getMessage());
return null;
}
} else {
@@ -2217,7 +2147,12 @@ public class ScreenPanel2 extends Panel {
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, ""});
@@ -2225,7 +2160,7 @@ public class ScreenPanel2 extends Panel {
}
Frame frame = getCurrentFrame();
if ((frame != null) && (frame.cache!=null)){
for (int i = 3; 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);
@@ -3169,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: