Add internal common header to save all internal operation(Roi,Bin,Flip...)

parent 6bc8b4b5
......@@ -169,6 +169,12 @@ namespace lima {
void setEndCallback(TaskEventCallback *);
// --- internal common header
void resetInternalCommonHeader();
void addToInternalCommonHeader(const HeaderValue& value);
template<class T>
void addToInternalCommonHeader(const std::string &key,
const T&);
// --- statistic
void getWriteTimeStatistic(std::list<double>&, int stream_idx=0) const;
......@@ -325,6 +331,7 @@ namespace lima {
Stream **m_stream;
HeaderMap m_common_header;
HeaderMap m_internal_common_header;
FrameHeaderMap m_frame_headers;
FrameMap m_frame_datas;
......@@ -470,6 +477,19 @@ namespace lima {
os << "< (" << value.first << "," << value.second << ") >";
return os;
}
template<class T>
void CtSaving::addToInternalCommonHeader(const std::string &key,
const T& obj)
{
AutoMutex aLock(m_cond.mutex());
std::ostringstream str;
str << obj;
const std::string& value = str.str();
HeaderValue anEntry(key,value);
m_internal_common_header.insert(anEntry);
}
} // namespace lima
#endif // CTSAVING_H
......@@ -225,6 +225,9 @@ void CtControl::prepareAcq()
throw LIMA_CTL_EXC(Error,"Configuration not finished");
resetStatus(false);
//Clear common header
m_ct_saving->resetInternalCommonHeader();
DEB_TRACE() << "Apply hardware bin/roi";
m_ct_image->applyHard();
......
......@@ -22,6 +22,7 @@
#include "CtImage.h"
#include "CtAcquisition.h"
#include "CtSaving.h"
using namespace lima;
......@@ -881,6 +882,24 @@ void CtImage::applyHard()
}
m_hw->apply();
//Add operation into internal header
CtSaving* saving = m_ct.saving();
Bin bin;getBin(bin);
if(!bin.isOne())
saving->addToInternalCommonHeader("binning",bin);
Roi roi;getRoi(roi);
if(!roi.isEmpty())
saving->addToInternalCommonHeader("roi",roi);
Flip flip;getFlip(flip);
if(flip.x || flip.y)
saving->addToInternalCommonHeader("flip",flip);
RotationMode rMode;getRotation(rMode);
if(rMode != Rotation_0)
saving->addToInternalCommonHeader("rotation",rMode);
}
bool CtImage::applySoft(SoftOpInternalMgr *op)
......
......@@ -957,6 +957,8 @@ void CtSaving::removeAllFrameHeaders()
void CtSaving::_getCommonHeader(HeaderMap &header)
{
header.insert(m_internal_common_header.begin(),
m_internal_common_header.end());
header.insert(m_common_header.begin(),m_common_header.end());
}
void CtSaving::_takeHeader(FrameHeaderMap::iterator& headerIter,
......@@ -1005,6 +1007,18 @@ void CtSaving::setEndCallback(TaskEventCallback *aCbkPt)
m_end_cbk->ref();
}
void CtSaving::resetInternalCommonHeader()
{
AutoMutex aLock(m_cond.mutex());
m_internal_common_header.clear();
}
void CtSaving::addToInternalCommonHeader(const HeaderValue& value)
{
AutoMutex aLock(m_cond.mutex());
m_internal_common_header.insert(value);
}
bool CtSaving::_controlIsFault()
{
DEB_MEMBER_FUNCT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment