mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
adding rx_roi also in the zmq header for external guis to put the "yellow box".. sending full roi instead of -1, and sending for each zmq port. "(multiple yellow boxes)".
This commit is contained in:
parent
e757e25fa1
commit
d65825e9ef
@ -56,6 +56,8 @@ void DataStreamer::SetAdditionalJsonHeader(
|
|||||||
isAdditionalJsonUpdated = true;
|
isAdditionalJsonUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataStreamer::SetReceiverROI(ROI roi) { receiverRoi = roi; }
|
||||||
|
|
||||||
void DataStreamer::ResetParametersforNewAcquisition(const std::string &fname) {
|
void DataStreamer::ResetParametersforNewAcquisition(const std::string &fname) {
|
||||||
StopRunning();
|
StopRunning();
|
||||||
startedFlag = false;
|
startedFlag = false;
|
||||||
@ -249,6 +251,7 @@ int DataStreamer::SendDataHeader(sls_detector_header header, uint32_t size,
|
|||||||
isAdditionalJsonUpdated = false;
|
isAdditionalJsonUpdated = false;
|
||||||
}
|
}
|
||||||
zHeader.addJsonHeader = localAdditionalJsonHeader;
|
zHeader.addJsonHeader = localAdditionalJsonHeader;
|
||||||
|
zHeader.rx_roi = receiverRoi.getIntArray();
|
||||||
|
|
||||||
return zmqSocket->SendHeader(index, zHeader);
|
return zmqSocket->SendHeader(index, zHeader);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetNumberofTotalFrames(uint64_t value);
|
void SetNumberofTotalFrames(uint64_t value);
|
||||||
void
|
void
|
||||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||||
|
void SetReceiverROI(ROI roi);
|
||||||
|
|
||||||
void ResetParametersforNewAcquisition(const std::string &fname);
|
void ResetParametersforNewAcquisition(const std::string &fname);
|
||||||
/**
|
/**
|
||||||
@ -92,6 +93,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
uint64_t fileIndex{0};
|
uint64_t fileIndex{0};
|
||||||
bool flipRows{false};
|
bool flipRows{false};
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
ROI receiverRoi{};
|
||||||
|
|
||||||
/** Used by streamer thread to update local copy (reduce number of locks
|
/** Used by streamer thread to update local copy (reduce number of locks
|
||||||
* during streaming) */
|
* during streaming) */
|
||||||
|
@ -216,6 +216,8 @@ void Implementation::SetupDataStreamer(int i) {
|
|||||||
dataStreamer[i]->SetNumberofPorts(numPorts);
|
dataStreamer[i]->SetNumberofPorts(numPorts);
|
||||||
dataStreamer[i]->SetQuadEnable(quadEnable);
|
dataStreamer[i]->SetQuadEnable(quadEnable);
|
||||||
dataStreamer[i]->SetNumberofTotalFrames(numberOfTotalFrames);
|
dataStreamer[i]->SetNumberofTotalFrames(numberOfTotalFrames);
|
||||||
|
dataStreamer[i]->SetReceiverROI(
|
||||||
|
portRois[i].completeRoi() ? GetMaxROIPerPort() : portRois[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::xy Implementation::getDetectorSize() const {
|
slsDetectorDefs::xy Implementation::getDetectorSize() const {
|
||||||
@ -231,6 +233,11 @@ const slsDetectorDefs::xy Implementation::GetPortGeometry() const {
|
|||||||
return portGeometry;
|
return portGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const slsDetectorDefs::ROI Implementation::GetMaxROIPerPort() const {
|
||||||
|
return slsDetectorDefs::ROI{0, (int)generalData->nPixelsX - 1, 0,
|
||||||
|
(int)generalData->nPixelsY - 1};
|
||||||
|
}
|
||||||
|
|
||||||
void Implementation::setDetectorSize(const slsDetectorDefs::xy size) {
|
void Implementation::setDetectorSize(const slsDetectorDefs::xy size) {
|
||||||
xy portGeometry = GetPortGeometry();
|
xy portGeometry = GetPortGeometry();
|
||||||
|
|
||||||
@ -458,6 +465,10 @@ void Implementation::setReceiverROI(const slsDetectorDefs::ROI arg) {
|
|||||||
listener[i]->SetNoRoi(portRois[i].noRoi());
|
listener[i]->SetNoRoi(portRois[i].noRoi());
|
||||||
for (size_t i = 0; i != dataProcessor.size(); ++i)
|
for (size_t i = 0; i != dataProcessor.size(); ++i)
|
||||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||||
|
for (size_t i = 0; i != dataStreamer.size(); ++i) {
|
||||||
|
dataStreamer[i]->SetReceiverROI(
|
||||||
|
portRois[i].completeRoi() ? GetMaxROIPerPort() : portRois[i]);
|
||||||
|
}
|
||||||
LOG(logINFO) << "receiver roi: " << ToString(receiverRoi);
|
LOG(logINFO) << "receiver roi: " << ToString(receiverRoi);
|
||||||
if (generalData->numUDPInterfaces == 2 &&
|
if (generalData->numUDPInterfaces == 2 &&
|
||||||
generalData->detType != slsDetectorDefs::GOTTHARD2) {
|
generalData->detType != slsDetectorDefs::GOTTHARD2) {
|
||||||
|
@ -282,6 +282,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
void SetupFifoStructure();
|
void SetupFifoStructure();
|
||||||
|
|
||||||
const xy GetPortGeometry() const;
|
const xy GetPortGeometry() const;
|
||||||
|
const ROI GetMaxROIPerPort() const;
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void CreateUDPSockets();
|
void CreateUDPSockets();
|
||||||
void SetupWriter();
|
void SetupWriter();
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "sls/sls_detector_exceptions.h"
|
#include "sls/sls_detector_exceptions.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
// Selective suppression of warning in gcc,
|
// Selective suppression of warning in gcc,
|
||||||
@ -83,6 +84,8 @@ struct zmqHeader {
|
|||||||
bool completeImage{false};
|
bool completeImage{false};
|
||||||
/** additional json header */
|
/** additional json header */
|
||||||
std::map<std::string, std::string> addJsonHeader;
|
std::map<std::string, std::string> addJsonHeader;
|
||||||
|
/** (xmin, xmax, ymin, ymax) roi only in files written */
|
||||||
|
std::array<int,4> rx_roi{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ZmqSocket {
|
class ZmqSocket {
|
||||||
|
@ -254,6 +254,8 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
|
|||||||
}
|
}
|
||||||
oss << " } ";
|
oss << " } ";
|
||||||
}
|
}
|
||||||
|
oss << ", \"rx_roi\":[" << header.rx_roi[0] << ", " << header.rx_roi[1]
|
||||||
|
<< ", " << header.rx_roi[2] << ", " << header.rx_roi[3] << "]";
|
||||||
oss << "}\n";
|
oss << "}\n";
|
||||||
std::string message = oss.str();
|
std::string message = oss.str();
|
||||||
int length = message.length();
|
int length = message.length();
|
||||||
@ -375,6 +377,11 @@ int ZmqSocket::ParseHeader(const int index, int length, char *buff,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Value &a = document["rx_roi"].GetArray();
|
||||||
|
for (SizeType i = 0; i != a.Size(); ++i) {
|
||||||
|
zHeader.rx_roi[i] = a[i].GetInt();
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user