Startup
This commit is contained in:
66
script/test/SaveCamera.py
Normal file
66
script/test/SaveCamera.py
Normal file
@@ -0,0 +1,66 @@
|
||||
import ch.psi.pshell.imaging.ImageBuffer as ImageBuffer
|
||||
import java.math.BigInteger as BigInteger
|
||||
import org.python.core.PyLong as PyLong
|
||||
import json
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
camera_name = "SLG-LCAM-C041"
|
||||
else:
|
||||
camera_name =args[0]
|
||||
|
||||
|
||||
set_exec_pars(name="snapshot")
|
||||
path = "/image"
|
||||
snapshotFile = None
|
||||
|
||||
|
||||
|
||||
|
||||
#cam_server.start(camera_name + "_sp", camera_name + "_sp1")
|
||||
cam_server.start(camera_name + "_sp1", True)
|
||||
cam_server.waitNext(10000)
|
||||
|
||||
stream_value = cam_server.stream.take()
|
||||
|
||||
save_dataset(path, cam_server.data.matrix)
|
||||
for id in stream_value.identifiers:
|
||||
val = stream_value.getValue(id)
|
||||
if id == "image":
|
||||
pass
|
||||
elif id == "processing_parameters":
|
||||
val = json.loads(val)
|
||||
for key in val.keys():
|
||||
set_attribute(path, key, "" if val[key] is None else val[key] )
|
||||
elif isinstance(val, PyArray):
|
||||
save_dataset("/"+id, val)
|
||||
elif isinstance(val, PyLong):
|
||||
save_dataset("/"+id, int(val))
|
||||
else:
|
||||
print id, val
|
||||
set_attribute(path, id, val)
|
||||
|
||||
|
||||
|
||||
#writeFrameMetadata(path, id);
|
||||
|
||||
set_exec_pars(open = False)
|
||||
#Enforce the same timestamp to data & image files.
|
||||
snapshot_file = get_exec_pars().path+ ".png";
|
||||
|
||||
|
||||
#ImageBuffer.saveImage(cam_server.output, snapshot_file, "png");
|
||||
|
||||
"""
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("Camera: ").append(cameraName).append(" (").
|
||||
append((server != null) ? "server" : "direct").append(")").append("\n");
|
||||
message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n");
|
||||
message.append("Filter: ").append(String.valueOf(valueFilter.getLabel().getText())).append("\n");
|
||||
message.append("Data file: ").append(getContext().getExecutionPars().getPath()).append("\n");
|
||||
message.append("Comment: ").append(textComment.getText()).append("\n");
|
||||
if ((fitOv != null) && (fitOv.length > 5)) {
|
||||
Overlays.Text text = (Overlays.Text) fitOv[5];
|
||||
message.append(text.getText()).append("\n");
|
||||
}
|
||||
elog((String) comboLogbook.getSelectedItem(), "ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
|
||||
"""
|
||||
Reference in New Issue
Block a user