summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Frust <tobiasfrust@gmail.com>2016-10-12 14:53:28 +0200
committerTobias Frust <tobiasfrust@gmail.com>2016-10-12 14:53:28 +0200
commitcdab7a0b05f655a2f98f00f3fb8928e54b8c28d2 (patch)
tree7fc93e5f5c3729d0fa013946fe60fa881a53579c
parent338d0312690142de704fdcc82a8539c635ff6720 (diff)
downloadods-cdab7a0b05f655a2f98f00f3fb8928e54b8c28d2.tar.gz
ods-cdab7a0b05f655a2f98f00f3fb8928e54b8c28d2.tar.bz2
ods-cdab7a0b05f655a2f98f00f3fb8928e54b8c28d2.tar.xz
ods-cdab7a0b05f655a2f98f00f3fb8928e54b8c28d2.zip
added configuration options
-rw-r--r--src/DetectorModule/DetectorModule.cpp11
-rw-r--r--src/DetectorModule/DetectorModule.h1
2 files changed, 7 insertions, 5 deletions
diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp
index 798c529..8193a03 100644
--- a/src/DetectorModule/DetectorModule.cpp
+++ b/src/DetectorModule/DetectorModule.cpp
@@ -38,7 +38,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address,
throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!");
}
- sendBuffer_.resize(16010);
+ sendBuffer_.resize(numberOfProjectionsPerPacket_*numberOfDetectorsPerModule_+sizeof(std::size_t)+sizeof(unsigned short));
//read the input data from the file corresponding to the detectorModuleID
readInput();
@@ -49,8 +49,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address,
auto DetectorModule::send() -> void{
BOOST_LOG_TRIVIAL(debug) << "Detectormodule " << detectorID_ << " :sending udp packet with index " << index_ << ".";
- int numberOfProjectionsPerPacket = 500;
- int numberOfParts = numberOfProjections_/numberOfProjectionsPerPacket;
+ int numberOfParts = numberOfProjections_/numberOfProjectionsPerPacket_;
// sendBuffer_[0] = (sizeof(std::size_t)) & 0xff;
// sendBuffer_[1] = (sizeof(std::size_t) >> 8) & 0xff;
// sendBuffer_[2] = (sizeof(std::size_t) >> 16) & 0xff;
@@ -60,7 +59,7 @@ auto DetectorModule::send() -> void{
// sendBuffer_[6] = (sizeof(std::size_t) >> 48) & 0xff;
// sendBuffer_[7] = (sizeof(std::size_t) >> 56) & 0xff;
unsigned int bufferSizeIndex = index_ % 1000;
- unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjectionsPerPacket;
+ unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjectionsPerPacket_;
*reinterpret_cast<int*>(sendBuffer_.data()) = index_;
*reinterpret_cast<unsigned short*>(sendBuffer_.data()+sizeof(std::size_t)) = partID_;
std::copy(((char*)buffer_.data())+sinoSize*(bufferSizeIndex*numberOfParts+partID_)*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex*numberOfParts+partID_))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)+sizeof(unsigned short));
@@ -108,7 +107,9 @@ auto DetectorModule::readConfig(const std::string& configFile) -> bool {
&& configReader.lookupValue("numberOfPlanes", numberOfPlanes_)
&& configReader.lookupValue("samplingRate", samplingRate)
&& configReader.lookupValue("scanRate", scanRate)
- && configReader.lookupValue("numberOfDataFrames", numberOfFrames_)) {
+ && configReader.lookupValue("numberOfDataFrames", numberOfFrames_)
+ && configReader.lookupValue("numberOfProjectionsPerPacket", numberOfProjectionsPerPacket_)
+ && configReader.lookupValue("numberOfDetectorsPerModule", numberOfProjectionsPerPacket_)) {
numberOfProjections_ = samplingRate * 1000000 / scanRate;
return EXIT_SUCCESS;
}
diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h
index a2d2fe9..3ca5f23 100644
--- a/src/DetectorModule/DetectorModule.h
+++ b/src/DetectorModule/DetectorModule.h
@@ -38,6 +38,7 @@ private:
int numberOfPlanes_;
int numberOfProjections_;
int numberOfDetectorsPerModule_;
+ int numberOfProjectionsPerPacket_;
unsigned int numberOfFrames_;
std::string path_, fileName_, fileEnding_;