riCOM_cpp
This repository contains the C++ implementation of the riCOM (Real Time Centre Of Mass) algorithm for 4D Scanning electron microscopy.
Enumerations | Functions
RICOM Namespace Reference

Enumerations

enum  modes { FILE , TCP }
 

Functions

void run_ricom (Ricom *r, RICOM::modes mode)
 
void run_connection_script (Ricom *r, MerlinSettings *merlin, const std::string &python_path)
 

Enumeration Type Documentation

◆ modes

Enumerator
FILE 
TCP 

Definition at line 142 of file Ricom.h.

143  {
144  FILE,
145  TCP
146  };
@ TCP
Definition: Ricom.h:145
@ FILE
Definition: Ricom.h:144

Function Documentation

◆ run_connection_script()

void RICOM::run_connection_script ( Ricom r,
MerlinSettings *  merlin,
const std::string &  python_path 
)

Definition at line 1096 of file Ricom.cpp.

1097 {
1098 
1099  int m_fr_total = ((ricom->nx + ricom->skip_row) * ricom->ny + ricom->skip_img) * ricom->rep;
1100 
1101  std::ofstream run_script("run_script.py");
1102  run_script << "from merlin_interface.merlin_interface import MerlinInterface" << std::endl;
1103  run_script << "m = MerlinInterface(tcp_ip = \"" << ricom->socket.ip << "\" , tcp_port=" << merlin->com_port << ")" << std::endl;
1104  run_script << "m.hvbias = " << merlin->hvbias << std::endl;
1105  run_script << "m.threshold0 = " << merlin->threshold0 << std::endl;
1106  run_script << "m.threshold1 = " << merlin->threshold1 << std::endl;
1107  run_script << "m.continuousrw = " << (int)merlin->continuousrw << std::endl;
1108  run_script << "m.counterdepth = " << ricom->camera.depth << std::endl;
1109  run_script << "m.acquisitiontime = " << merlin->dwell_time << std::endl;
1110  run_script << "m.acquisitionperiod = " << merlin->dwell_time << std::endl;
1111  run_script << "m.numframestoacquire = " << m_fr_total + 1 << std::endl; // Ich verstehe nicht warum, aber er werkt.
1112  run_script << "m.fileenable = " << (int)merlin->save << std::endl;
1113  run_script << "m.runheadless = " << (int)merlin->headless << std::endl;
1114  run_script << "m.fileformat = " << (int)merlin->raw * 2 << std::endl;
1115  run_script << "m.triggerstart = " << merlin->trigger << std::endl;
1116  run_script << "m.startacquisition()";
1117  run_script.close();
1118 
1119  std::string command = python_path + " run_script.py";
1120  int r = std::system(command.c_str());
1121  if (r != 0)
1122  {
1123  std::cout << "main::run_connection_script: Cannot execute python run_script. Shell exited with code " << r << std::endl;
1124  }
1125 }

◆ run_ricom()

void RICOM::run_ricom ( Ricom r,
RICOM::modes  mode 
)

Definition at line 1081 of file Ricom.cpp.

1082 {
1083  switch (r->camera.model)
1084  {
1085  case CAMERA::MERLIN:
1086  r->run_reconstruction<MerlinInterface>(mode);
1087  break;
1088  case CAMERA::TIMEPIX:
1089  r->run_reconstruction<TimepixInterface>(mode);
1090  break;
1091  default:
1092  break;
1093  }
1094 }
Camera_model model
Definition: Camera.h:43
void run_reconstruction(RICOM::modes mode)
Definition: Ricom.cpp:977
CAMERA::Camera_BASE camera
Definition: Ricom.h:218
@ TIMEPIX
Definition: Camera.h:30
@ MERLIN
Definition: Camera.h:29