mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-25 02:51:08 +02:00
rois shoudl work. left to implement tests for individual rois, create multiple datasets (1 for each roi) in the virutal data file. currently virutal dataset with roi is not implemented and a warning is given instead. wonder why since the inviduviaual roi files are clipped
This commit is contained in:
@ -722,13 +722,19 @@ std::string Caller::rx_zmqip(int action) {
|
||||
|
||||
std::string Caller::rx_roi(int action) {
|
||||
std::ostringstream os;
|
||||
std::string helpMessage = std::string("[xmin] [xmax] [ymin] [ymax]\n\tRegion of interest in receiver.\n\t")
|
||||
+ "For a list of rois, use '[' and ']; ' to distinguish between "
|
||||
"rois and use comma inside the square brackets.\n\t If one fails to use space after semicolon, please use quotes"
|
||||
+ "For example: [0,100,0,100]; [200,300,0,100] will set two "
|
||||
"rois.or '[0,100,0,100];[200,300,0,100]' when the vector is a single string\n\t"
|
||||
+ "Only allowed at multi module level and without gap "
|
||||
"pixels.\n";
|
||||
std::string helpMessage =
|
||||
std::string("[xmin] [xmax] [ymin] [ymax]\n\tRegion of interest in "
|
||||
"receiver.\n\t") +
|
||||
"For a list of rois, use '[' and ']; ' to distinguish between "
|
||||
"rois and use comma inside the square brackets.\n\t If one fails to "
|
||||
"use space after semicolon, please use quotes" +
|
||||
"For example: [0,100,0,100]; [200,300,0,100] will set two "
|
||||
"rois.or '[0,100,0,100];[200,300,0,100]' when the vector is a single "
|
||||
"string\n\n\t" +
|
||||
"Only allowed to set at multi module level and without gap "
|
||||
"ixels.\n\n\t" +
|
||||
"One can get rx_roi also at port level, by specifying the module id "
|
||||
"and it will return the roi for each port.\n";
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << helpMessage;
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -736,7 +742,8 @@ std::string Caller::rx_roi(int action) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute receiver ROI at module level");
|
||||
auto t = det->getRxROI(det_id);
|
||||
os << ToString(t) << '\n';
|
||||
} else {
|
||||
auto t = det->getRxROI();
|
||||
os << ToString(t) << '\n';
|
||||
|
@ -1766,6 +1766,7 @@ defs::xy DetectorImpl::getPortGeometry() const {
|
||||
case MOENCH:
|
||||
portGeometry.y = modules[0]->getNumberofUDPInterfacesFromShm();
|
||||
break;
|
||||
case GOTTHARD2: // 2nd port if used is for veto, not data
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1525,22 +1525,22 @@ std::array<defs::ROI, 2> Module::getRxROI() const {
|
||||
return sendToReceiver<std::array<slsDetectorDefs::ROI, 2>>(F_RECEIVER_GET_RECEIVER_ROI);
|
||||
}
|
||||
|
||||
void Module::setRxROI(std::array<defs::ROI, 2> portRois) {
|
||||
/*LOG(logDEBUG) << "Sending to receiver " << moduleIndex << " [rx roi: " << ToString(portRois)
|
||||
<< ']';
|
||||
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||
receiver.Send(F_RECEIVER_SET_RECEIVER_ROI);
|
||||
receiver.setFnum(F_RECEIVER_SET_RECEIVER_ROI);
|
||||
receiver.Send(portRois);
|
||||
if (receiver.Receive<int>() == FAIL) {
|
||||
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + receiver.readErrorMessage());
|
||||
}*/
|
||||
void Module::setRxROI(const std::array<defs::ROI, 2> &portRois) {
|
||||
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI, portRois, nullptr);
|
||||
}
|
||||
|
||||
void Module::setRxROIMetadata(const std::vector<slsDetectorDefs::ROI> &arg) {
|
||||
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI_METADATA, arg, nullptr);
|
||||
void Module::setRxROIMetadata(const std::vector<slsDetectorDefs::ROI> &args) {
|
||||
LOG(logDEBUG) << "Sending to receiver " << moduleIndex
|
||||
<< " [roi metadata: " << ToString(args) << ']';
|
||||
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||
receiver.Send(F_RECEIVER_SET_RECEIVER_ROI_METADATA);
|
||||
receiver.setFnum(F_RECEIVER_SET_RECEIVER_ROI_METADATA);
|
||||
receiver.Send(static_cast<int>(args.size()));
|
||||
receiver.Send(args);
|
||||
if (receiver.Receive<int>() == FAIL) {
|
||||
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + receiver.readErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// File
|
||||
|
@ -302,7 +302,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
bool getRxArping() const;
|
||||
void setRxArping(bool enable);
|
||||
std::array<defs::ROI, 2> getRxROI() const;
|
||||
void setRxROI(const std::array<slsDetectorDefs::ROI, 2> portRois);
|
||||
void setRxROI(const std::array<slsDetectorDefs::ROI, 2> &portRois);
|
||||
void setRxROIMetadata(const std::vector<slsDetectorDefs::ROI> &args);
|
||||
|
||||
/**************************************************
|
||||
|
Reference in New Issue
Block a user