mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
Rx roi (#428)
* roi structure expanded to have ymin and ymax * compile with 'detector roi' * wip * wip, rx_roi, rx_clearroi * wip rxroi * rxroi wip * wip rxroi * merge fix * wip * rx_roi works, impl wip, test * tests in, impl left * wip, rxroi impl * wip, rxroi impl * wip * setrx_Roi works, getrx_roi, wip * rx_roi impl done * wip, rxroi * wip, getrx_roi rxr ports * fix ports * wip * wip * fix positions on server side * wip * numports wip * wip * jungfrau top inner interface row increment * x, y detpos, wip * removed eiger row indices flipping in gui (bottom flipping maintained) * wip * wip, jungfrau numinterfaces2 * jungfrau virtual works * eiger, jungfrau, g2 virtual server works * eiger positions fix, wip * binaries in * minor printout * binaries in * merge fix * merge fix * removing getposition * setrxroi wip * set upto port * get messed, wip * roi multi to module works, wip * wip * roi dont return -1 * added rxroi metadata in master file * added rxroifromshm, not yet in detector * rx roi in gui with box, also for gap pixels (gappixels for jungfrau mess) * fix for segfault in gui with detaching roi box in gui * wip * m3 gui: slave timing modes should be discarded when squashing * fixed m3 virtual data, and fixed counters in gui asthetics * m3 roi works * wip, g2 * wip * handling g225um boards, and showing roi for gainplot as well * udpate python functions * fix for 1d and a2d roi written * fixed actual roi written to file * no virtual hdf5 when handling rx roi * test * minor * binarie in
This commit is contained in:
@ -55,7 +55,8 @@ int64_t ClientInterface::getReceiverVersion() { return APIRECEIVER; }
|
||||
|
||||
/***callback functions***/
|
||||
void ClientInterface::registerCallBackStartAcquisition(
|
||||
int (*func)(const std::string &, const std::string &, uint64_t, size_t, void *),
|
||||
int (*func)(const std::string &, const std::string &, uint64_t, size_t,
|
||||
void *),
|
||||
void *arg) {
|
||||
startAcquisitionCallBack = func;
|
||||
pStartAcquisition = arg;
|
||||
@ -122,7 +123,7 @@ int ClientInterface::functionTable(){
|
||||
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
|
||||
flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version;
|
||||
flist[F_SETUP_RECEIVER] = &ClientInterface::setup_receiver;
|
||||
flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi;
|
||||
flist[F_RECEIVER_SET_DETECTOR_ROI] = &ClientInterface::set_detector_roi;
|
||||
flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames;
|
||||
flist[F_SET_RECEIVER_NUM_TRIGGERS] = &ClientInterface::set_num_triggers;
|
||||
flist[F_SET_RECEIVER_NUM_BURSTS] = &ClientInterface::set_num_bursts;
|
||||
@ -217,6 +218,9 @@ int ClientInterface::functionTable(){
|
||||
flist[F_RECEIVER_SET_DATASTREAM] = &ClientInterface::set_detector_datastream;
|
||||
flist[F_GET_RECEIVER_ARPING] = &ClientInterface::get_arping;
|
||||
flist[F_SET_RECEIVER_ARPING] = &ClientInterface::set_arping;
|
||||
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
||||
flist[F_RECEIVER_SET_RECEIVER_ROI] = &ClientInterface::set_receiver_roi;
|
||||
flist[F_RECEIVER_SET_RECEIVER_ROI_METADATA] = &ClientInterface::set_receiver_roi_metadata;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@ -247,7 +251,7 @@ int ClientInterface::decodeFunction(Interface &socket) {
|
||||
void ClientInterface::functionNotImplemented() {
|
||||
std::ostringstream os;
|
||||
os << "Function: " << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
<< ", is is not implemented for this detector";
|
||||
<< " is not implemented for this detector";
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
||||
@ -455,7 +459,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
}
|
||||
if (detType == GOTTHARD) {
|
||||
try {
|
||||
impl()->setROI(arg.roi);
|
||||
impl()->setDetectorROI(arg.roi);
|
||||
} catch (const RuntimeError &e) {
|
||||
throw RuntimeError("Could not set ROI");
|
||||
}
|
||||
@ -497,8 +501,11 @@ void ClientInterface::setDetectorType(detectorType arg) {
|
||||
detType = GENERIC;
|
||||
receiver = sls::make_unique<Implementation>(arg);
|
||||
detType = arg;
|
||||
} catch (...) {
|
||||
throw RuntimeError("Could not set detector type");
|
||||
} catch (std::exception &e) {
|
||||
std::ostringstream os;
|
||||
os << "Could not set detector type in the receiver. ";
|
||||
os << e.what();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
||||
// callbacks after (in setdetectortype, the object is reinitialized)
|
||||
@ -518,16 +525,16 @@ void ClientInterface::setDetectorType(detectorType arg) {
|
||||
impl()->setThreadIds(parentThreadId, tcpThreadId);
|
||||
}
|
||||
|
||||
int ClientInterface::set_roi(Interface &socket) {
|
||||
int ClientInterface::set_detector_roi(Interface &socket) {
|
||||
auto arg = socket.Receive<ROI>();
|
||||
LOG(logDEBUG1) << "Set ROI: [" << arg.xmin << ", " << arg.xmax << "]";
|
||||
LOG(logDEBUG1) << "Set Detector ROI: " << sls::ToString(arg);
|
||||
|
||||
if (detType != GOTTHARD)
|
||||
functionNotImplemented();
|
||||
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setROI(arg);
|
||||
impl()->setDetectorROI(arg);
|
||||
} catch (const RuntimeError &e) {
|
||||
throw RuntimeError("Could not set ROI");
|
||||
}
|
||||
@ -1736,3 +1743,37 @@ int ClientInterface::set_arping(Interface &socket) {
|
||||
impl()->setArping(value, udpips);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::get_receiver_roi(Interface &socket) {
|
||||
auto retval = impl()->getReceiverROI();
|
||||
LOG(logDEBUG1) << "Receiver roi retval:" << sls::ToString(retval);
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_receiver_roi(Interface &socket) {
|
||||
auto arg = socket.Receive<ROI>();
|
||||
if (detType == CHIPTESTBOARD || detType == MOENCH)
|
||||
functionNotImplemented();
|
||||
LOG(logDEBUG1) << "Set Receiver ROI: " << sls::ToString(arg);
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setReceiverROI(arg);
|
||||
} catch (const RuntimeError &e) {
|
||||
throw RuntimeError("Could not set ReceiverROI");
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
||||
auto arg = socket.Receive<ROI>();
|
||||
if (detType == CHIPTESTBOARD || detType == MOENCH)
|
||||
functionNotImplemented();
|
||||
LOG(logDEBUG1) << "Set Receiver ROI Metadata: " << sls::ToString(arg);
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setReceiverROIMetadata(arg);
|
||||
} catch (const RuntimeError &e) {
|
||||
throw RuntimeError("Could not set ReceiverROI metadata");
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
Reference in New Issue
Block a user