Startup
This commit is contained in:
@@ -18,12 +18,14 @@ public class Camtool extends ArraySource {
|
||||
final boolean latch;
|
||||
|
||||
final public ChannelInteger channelRun;
|
||||
final public ChannelInteger channelLatch;
|
||||
final public ChannelInteger channelLatch;
|
||||
final public ChannelDouble channelTimestamp;
|
||||
final public ChannelDoubleArray origin;
|
||||
final public ChannelDouble posX, posY;
|
||||
final public ChannelDoubleArray profileX, profileY;
|
||||
final public ChannelIntegerArray shape;
|
||||
final public ChannelInteger roiEnabled;
|
||||
final public ChannelIntegerArray roiShape;
|
||||
final public ChannelInteger bgEnable, bgCapture, bgCaptureRemain;
|
||||
final public ChannelDouble calOffX, calOffY, calScaleX, calScaleY;
|
||||
final public CamToolPosX posMeanX;
|
||||
@@ -32,11 +34,12 @@ public class Camtool extends ArraySource {
|
||||
final public CamToolVarY posVarY;
|
||||
|
||||
public Camtool(String name, String prefix) {
|
||||
this(name, prefix, false, true);
|
||||
this(name, prefix, false);
|
||||
}
|
||||
|
||||
public Camtool(String name, String prefix, boolean latch, boolean roi) {
|
||||
super(name, prefix + (latch ? ":latch" : ":pipeline") + (roi ? ".roi.output" : ".image"));
|
||||
public Camtool(String name, String prefix, boolean latch) {
|
||||
//super(name, prefix + (latch ? ":latch" : ":pipeline") + (roi ? ".roi.output" : ".image"));
|
||||
super(name, prefix + (latch ? ":latch" : ":pipeline") + ".roi.output");
|
||||
this.prefix = prefix + ":";
|
||||
this.latch = latch;
|
||||
dataPrefix = this.prefix + (latch ? "latch" : "pipeline") + ".";
|
||||
@@ -51,8 +54,12 @@ public class Camtool extends ArraySource {
|
||||
posY = new ChannelDouble(name + " com y", dataPrefix + "y_stats.com_egu");
|
||||
profileX = new ChannelDoubleArray(name + " profile x", dataPrefix + "profile.x");
|
||||
profileY = new ChannelDoubleArray(name + " profile y", dataPrefix + "profile.y");
|
||||
shape = new ChannelIntegerArray(name + " shape", dataPrefix + (roi ? "roi.output.shape" : "image.shape"));
|
||||
origin = new ChannelDoubleArray(name + " origin X", roi ? (dataPrefix + "roi.origin_out") : (prefix + "origin"));
|
||||
//shape = new ChannelIntegerArray(name + " shape", dataPrefix + (roi ? "roi.output.shape" : "image.shape"));
|
||||
shape = new ChannelIntegerArray(name + " shape", dataPrefix + ("image.shape"));
|
||||
roiShape = new ChannelIntegerArray(name + " roi shape", dataPrefix + "roi.roi");
|
||||
roiEnabled = new ChannelInteger(name + " roi enabled", dataPrefix + "roi.enabled");
|
||||
//origin = new ChannelDoubleArray(name + " origin X", roi ? (dataPrefix + "roi.origin_out") : (prefix + "origin"));
|
||||
origin = new ChannelDoubleArray(name + " origin X", dataPrefix + "roi.origin_out");
|
||||
bgEnable = new ChannelInteger(name + " bg enable", this.prefix + "pipeline.bg.enabled");
|
||||
bgCapture = new ChannelInteger(name + " bg capture", this.prefix + "pipeline.bg.capture");
|
||||
bgCaptureRemain = new ChannelInteger(name + " bg capture remain", this.prefix + "pipeline.bg.capture_remain");
|
||||
@@ -92,11 +99,12 @@ public class Camtool extends ArraySource {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doInitialize() throws IOException, InterruptedException {
|
||||
try {
|
||||
safeInitialize(channelRun, 3000);
|
||||
channelRun.initialize();
|
||||
channelLatch.initialize();
|
||||
if (latch) {
|
||||
start();
|
||||
@@ -108,6 +116,8 @@ public class Camtool extends ArraySource {
|
||||
profileX.initialize();
|
||||
profileY.initialize();
|
||||
shape.initialize();
|
||||
roiShape.initialize();
|
||||
roiEnabled.initialize();
|
||||
origin.initialize();
|
||||
bgEnable.initialize();
|
||||
bgCapture.initialize();
|
||||
@@ -120,13 +130,23 @@ public class Camtool extends ArraySource {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
int[] s = shape.read();
|
||||
getConfig().imageHeight = s[0];
|
||||
getConfig().imageWidth = s[1];
|
||||
|
||||
if (roiEnabled.read()>0){
|
||||
int[] s = roiShape.read();
|
||||
//for (int x : s) System.out.println(x);
|
||||
getConfig().imageHeight = s[3];
|
||||
getConfig().imageWidth = s[2];
|
||||
} else {
|
||||
int[] s = shape.read();
|
||||
//for (int x : s){ System.out.println(x);}
|
||||
getConfig().imageHeight = s[0];
|
||||
getConfig().imageWidth = s[1];
|
||||
}
|
||||
|
||||
getConfig().save();
|
||||
getDevice().setSize(s[0] * s[1]);
|
||||
super.doInitialize();
|
||||
getDevice().setSize(getConfig().imageHeight * getConfig().imageWidth);
|
||||
super.doInitialize();
|
||||
//System.out.println(((int[])(getDevice().read())).length);
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user