diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 47e2b3d17..f7e4afb43 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -210,7 +210,7 @@ std::string DataProcessor::CreateVirtualFile( int ny = generalData->nPixelsY; if (generalData->dynamicRange == 4) - ny = generalData->nPixelsY / 2; + ny /= 2; bool gotthard25um = ((generalData->detType == GOTTHARD || generalData->detType == GOTTHARD2) && (numModX * numModY) == 2); diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index 1c974063d..c6943886e 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -156,11 +156,7 @@ void Implementation::setDetectorType(const detectorType d) { } if (d == EIGER) { - // resets ROIs and sets size to 2 - std::vector rois(2); - std::vector multiRoi(1); - setPortROIs(rois); - setMultiROIMetadata(multiRoi); + ResetRois(); } SetLocalNetworkParameters(); @@ -409,6 +405,15 @@ std::vector Implementation::getPortROIs() const { return portRois; } +void Implementation::ResetRois() { + int numports = generalData->numUDPInterfaces; + std::vector rois(numports); + std::vector multiRoi(1); + setPortROIs(rois); + setMultiROIMetadata(multiRoi); +} + + void Implementation::setPortROIs(const std::vector &args) { int nx = static_cast(generalData->nPixelsX); int ny = static_cast(generalData->nPixelsY); @@ -432,8 +437,6 @@ void Implementation::setPortROIs(const std::vector &args) { for (size_t i = 0; i != dataProcessor.size(); ++i) { dataProcessor[i]->SetPortROI(portRois[i]); } - if (dataProcessor.size() > 0) - dataProcessor[0]->setMultiROIMetadata(multiRoiMetadata); for (size_t i = 0; i != dataStreamer.size(); ++i) { dataStreamer[i]->SetPortROI(portRois[i]); } @@ -1040,8 +1043,6 @@ int Implementation::getNumberofUDPInterfaces() const { // not Eiger void Implementation::setNumberofUDPInterfaces(const int n) { - LOG(logDEBUG) << "Setting Number of UDP Interfaces: " << n; - if (generalData->detType == EIGER) { throw RuntimeError("Cannot set number of UDP interfaces for Eiger"); } @@ -1060,11 +1061,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) { // fifo SetupFifoStructure(); - // roi cleared - complete detector and sets roi vector size - std::vector rois(n); - std::vector multiRoi(1); - setPortROIs(rois); - setMultiROIMetadata(multiRoi); + ResetRois(); // create threads for (int i = 0; i < generalData->numUDPInterfaces; ++i) { diff --git a/slsReceiverSoftware/src/Implementation.h b/slsReceiverSoftware/src/Implementation.h index e83539304..5764a8d09 100644 --- a/slsReceiverSoftware/src/Implementation.h +++ b/slsReceiverSoftware/src/Implementation.h @@ -284,6 +284,7 @@ class Implementation : private virtual slsDetectorDefs { void SetupFifoStructure(); const xy GetPortGeometry() const; + void ResetRois(); void ResetParametersforNewAcquisition(); void CreateUDPSockets(); void SetupWriter(); diff --git a/slsReceiverSoftware/src/MasterAttributes.cpp b/slsReceiverSoftware/src/MasterAttributes.cpp index 9eb2bd3a7..e6ecd12e4 100644 --- a/slsReceiverSoftware/src/MasterAttributes.cpp +++ b/slsReceiverSoftware/src/MasterAttributes.cpp @@ -154,6 +154,17 @@ void MasterAttributes::GetFinalBinaryAttributes( w->EndObject(); } +void MasterAttributes::GetBinaryRois( + rapidjson::PrettyWriter *w) { + w->Key("Receiver Rois"); + w->StartArray(); + for (const slsDetectorDefs::ROI &roi : rois) { + std::string roi_str = ToString(roi); + w->String(roi_str.c_str()); + } + w->EndArray(); +} + #ifdef HDF5C void MasterAttributes::WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group) { @@ -555,13 +566,7 @@ void MasterAttributes::WriteHDF5TransceiverSamples(H5::Group *group) { void MasterAttributes::GetJungfrauBinaryAttributes( rapidjson::PrettyWriter *w) { - w->Key("Receiver Rois"); - w->StartArray(); - for (const slsDetectorDefs::ROI &roi : rois) { - std::string roi_str = ToString(roi); - w->String(roi_str.c_str()); - } - w->EndArray(); + GetBinaryRois(w); w->Key("Exptime"); w->String(ToString(exptime).c_str()); w->Key("Period"); @@ -584,13 +589,7 @@ void MasterAttributes::WriteJungfrauHDF5Attributes(H5::Group *group) { void MasterAttributes::GetMoenchBinaryAttributes( rapidjson::PrettyWriter *w) { - w->Key("Receiver Rois"); - w->StartArray(); - for (const slsDetectorDefs::ROI &roi : rois) { - std::string roi_str = ToString(roi); - w->String(roi_str.c_str()); - } - w->EndArray(); + GetBinaryRois(w); w->Key("Exptime"); w->String(ToString(exptime).c_str()); w->Key("Period"); @@ -613,13 +612,7 @@ void MasterAttributes::WriteMoenchHDF5Attributes(H5::Group *group) { void MasterAttributes::GetEigerBinaryAttributes( rapidjson::PrettyWriter *w) { - w->Key("Receiver Rois"); - w->StartArray(); - for (const slsDetectorDefs::ROI &roi : rois) { - std::string roi_str = ToString(roi); - w->String(roi_str.c_str()); - } - w->EndArray(); + GetBinaryRois(w); w->Key("Dynamic Range"); w->Uint(dynamicRange); w->Key("Ten Giga"); @@ -660,13 +653,7 @@ void MasterAttributes::WriteEigerHDF5Attributes(H5::Group *group) { void MasterAttributes::GetMythen3BinaryAttributes( rapidjson::PrettyWriter *w) { - w->Key("Receiver Rois"); - w->StartArray(); - for (const slsDetectorDefs::ROI &roi : rois) { - std::string roi_str = ToString(roi); - w->String(roi_str.c_str()); - } - w->EndArray(); + GetBinaryRois(w); w->Key("Dynamic Range"); w->Uint(dynamicRange); w->Key("Ten Giga"); @@ -705,13 +692,7 @@ void MasterAttributes::WriteMythen3HDF5Attributes(H5::Group *group) { void MasterAttributes::GetGotthard2BinaryAttributes( rapidjson::PrettyWriter *w) { - w->Key("Receiver Rois"); - w->StartArray(); - for (const slsDetectorDefs::ROI &roi : rois) { - std::string roi_str = ToString(roi); - w->String(roi_str.c_str()); - } - w->EndArray(); + GetBinaryRois(w); w->Key("Exptime"); w->String(ToString(exptime).c_str()); w->Key("Period"); diff --git a/slsReceiverSoftware/src/MasterAttributes.h b/slsReceiverSoftware/src/MasterAttributes.h index 81442fad0..3d07b45a2 100644 --- a/slsReceiverSoftware/src/MasterAttributes.h +++ b/slsReceiverSoftware/src/MasterAttributes.h @@ -78,6 +78,8 @@ class MasterAttributes { rapidjson::PrettyWriter *w); void GetFinalBinaryAttributes( rapidjson::PrettyWriter *w); + void GetBinaryRois( + rapidjson::PrettyWriter *w); #ifdef HDF5C void WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group); void WriteFinalHDF5Attributes(H5::Group *group);