Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima-camera-slsdetector
Commits
83021557
Commit
83021557
authored
Apr 25, 2021
by
Alejandro Homs Puron
Browse files
Move frame packet assembly to Reconstruction
parent
1f168a62
Changes
11
Hide whitespace changes
Inline
Side-by-side
include/SlsDetectorCamera.h
View file @
83021557
...
...
@@ -26,6 +26,7 @@
#include
"SlsDetectorArgs.h"
#include
"SlsDetectorReceiver.h"
#include
"SlsDetectorCPUAffinity.h"
#include
"SlsDetectorModel.h"
#include
"sls/Detector.h"
...
...
@@ -222,6 +223,7 @@ private:
friend
class
Model
;
friend
class
Receiver
;
friend
class
GlobalCPUAffinityMgr
;
friend
class
Reconstruction
;
friend
class
Eiger
;
...
...
@@ -247,7 +249,8 @@ private:
void
createReceivers
();
DetFrameImagePackets
readRecvPackets
();
void
assemblePackets
(
DetFrameImagePackets
&&
det_packets
);
void
publishFrame
(
FrameType
frame
);
void
assemblePackets
(
DetFrameImagePackets
&&
det_frame_packets
);
bool
checkLostPackets
();
FrameType
getLastReceivedFrame
();
...
...
include/SlsDetectorEiger.h
View file @
83021557
...
...
@@ -514,10 +514,12 @@ class Eiger : public Model
DEB_CLASS_NAMESPC
(
DebModCamera
,
"Eiger::ModelReconstruction"
,
"SlsDetector"
);
public:
ModelReconstruction
(
Eiger
*
eiger
)
:
m_eiger
(
eiger
)
ModelReconstruction
(
Eiger
*
eiger
)
:
SlsDetector
::
Reconstruction
(
eiger
->
getCamera
()),
m_eiger
(
eiger
)
{
setActive
(
true
);
}
virtual
Data
process
(
Data
&
data
);
virtual
Data
process
Model
(
Data
&
data
);
private:
friend
class
Eiger
;
...
...
include/SlsDetectorJungfrau.h
View file @
83021557
...
...
@@ -509,10 +509,12 @@ class Jungfrau : public Model
DEB_CLASS_NAMESPC
(
DebModCamera
,
"Jungfrau::ModelReconstruction"
,
"SlsDetector"
);
public:
ModelReconstruction
(
Jungfrau
*
jungfrau
)
:
m_jungfrau
(
jungfrau
)
ModelReconstruction
(
Jungfrau
*
jungfrau
)
:
SlsDetector
::
Reconstruction
(
jungfrau
->
getCamera
()),
m_jungfrau
(
jungfrau
)
{}
virtual
Data
process
(
Data
&
data
);
virtual
Data
process
Model
(
Data
&
data
);
private:
friend
class
Jungfrau
;
...
...
include/SlsDetectorReceiver.h
View file @
83021557
...
...
@@ -24,7 +24,8 @@
#define __SLS_DETECTOR_RECEIVER_H
#include
"SlsDetectorFrameMap.h"
#include
"SlsDetectorModel.h"
#include
"SlsDetectorCPUAffinity.h"
#include
"SlsDetectorArgs.h"
#include
"sls/sls_detector_defs.h"
...
...
include/SlsDetectorReconstruction.h
View file @
83021557
...
...
@@ -26,6 +26,8 @@
#include
"lima/Debug.h"
#include
"lima/Exceptions.h"
#include
"SlsDetectorReceiver.h"
namespace
lima
{
...
...
@@ -58,16 +60,28 @@ public:
Reconstruction
*
m_r
;
};
Reconstruction
();
Reconstruction
(
Camera
*
cam
);
virtual
~
Reconstruction
();
void
setActive
(
bool
active
);
void
getActive
(
bool
&
active
);
virtual
void
prepare
();
void
addFramePackets
(
DetFrameImagePackets
&&
det_frame_packets
);
virtual
Data
process
(
Data
&
data
);
virtual
Data
processModel
(
Data
&
data
)
=
0
;
virtual
void
cleanUp
();
private:
friend
class
CtrlObjProxy
;
Camera
*
m_cam
;
CtrlObjProxy
*
m_proxy
;
bool
m_active
;
Mutex
m_mutex
;
FramePacketMap
m_frame_packet_map
;
};
}
// namespace SlsDetector
...
...
sip/SlsDetectorReconstruction.sip
View file @
83021557
...
...
@@ -41,11 +41,14 @@ public:
virtual void reconstructionChange(LinkTask *task) = 0;
};
Reconstruction();
Reconstruction(
SlsDetector::Camera *cam
);
virtual ~Reconstruction();
void setActive(bool active);
void getActive(bool& active /Out/);
virtual Data process(Data& data);
virtual Data processModel(Data& data) = 0;
};
...
...
src/SlsDetectorCamera.cpp
View file @
83021557
...
...
@@ -876,6 +876,7 @@ void Camera::prepareAcq()
m_model
->
prepareAcq
();
m_global_cpu_affinity_mgr
.
prepareAcq
();
m_model
->
getReconstruction
()
->
prepare
();
resetFramesCaught
();
EXC_CHECK
(
m_det
->
setFileWrite
(
0
));
...
...
@@ -901,6 +902,9 @@ void Camera::stopAcq()
{
DEB_MEMBER_FUNCT
();
Reconstruction
*
r
=
m_model
?
m_model
->
getReconstruction
()
:
NULL
;
if
(
r
)
r
->
cleanUp
();
m_global_cpu_affinity_mgr
.
stopAcq
();
AutoMutex
l
=
lock
();
...
...
@@ -984,6 +988,14 @@ DetFrameImagePackets Camera::readRecvPackets()
return
det_frame_packets
;
}
void
Camera
::
publishFrame
(
FrameType
frame
)
{
DEB_MEMBER_FUNCT
();
FrameMap
::
Item
*
mi
=
m_frame_map
.
getItem
(
0
);
Model
::
FinishInfo
finfo
=
mi
->
frameFinished
(
frame
,
true
,
true
);
m_model
->
processFinishInfo
(
finfo
);
}
void
Camera
::
assemblePackets
(
DetFrameImagePackets
&&
det_frame_packets
)
{
DEB_MEMBER_FUNCT
();
...
...
@@ -1003,10 +1015,6 @@ void Camera::assemblePackets(DetFrameImagePackets&& det_frame_packets)
if
(
!
ok
)
m_recv_list
[
i
]
->
fillBadFrame
(
bptr
);
}
FrameMap
::
Item
*
mi
=
m_frame_map
.
getItem
(
0
);
Model
::
FinishInfo
finfo
=
mi
->
frameFinished
(
frame
,
true
,
true
);
m_model
->
processFinishInfo
(
finfo
);
}
bool
Camera
::
checkLostPackets
()
...
...
src/SlsDetectorEiger.cpp
View file @
83021557
...
...
@@ -166,7 +166,7 @@ void Eiger::InterModGapCorr::correctFrame(FrameType /*frame*/, void *ptr)
}
}
Data
Eiger
::
ModelReconstruction
::
process
(
Data
&
data
)
Data
Eiger
::
ModelReconstruction
::
process
Model
(
Data
&
data
)
{
DEB_MEMBER_FUNCT
();
...
...
src/SlsDetectorJungfrau.cpp
View file @
83021557
...
...
@@ -616,7 +616,7 @@ void Jungfrau::AveImgProc::readAveMap(Data& ave_map, FrameType& nb_frames,
* Jungfrau::ModelReconstruction class
*/
Data
Jungfrau
::
ModelReconstruction
::
process
(
Data
&
data
)
Data
Jungfrau
::
ModelReconstruction
::
process
Model
(
Data
&
data
)
{
DEB_MEMBER_FUNCT
();
DEB_PARAM
()
<<
DEB_VAR4
(
m_jungfrau
,
data
.
frameNumber
,
...
...
src/SlsDetectorModel.cpp
View file @
83021557
...
...
@@ -119,7 +119,9 @@ void Model::getAcqFrameDim(FrameDim& frame_dim, bool raw)
void
Model
::
processPackets
()
{
DEB_MEMBER_FUNCT
();
DetFrameImagePackets
packets
=
m_cam
->
readRecvPackets
();
m_cam
->
assemblePackets
(
std
::
move
(
packets
));
FrameType
frame
=
packets
.
first
;
getReconstruction
()
->
addFramePackets
(
std
::
move
(
packets
));
m_cam
->
publishFrame
(
frame
);
}
void
Model
::
processFinishInfo
(
const
FinishInfo
&
finfo
)
...
...
src/SlsDetectorReconstruction.cpp
View file @
83021557
...
...
@@ -25,6 +25,8 @@ using namespace lima;
using
namespace
lima
::
SlsDetector
;
using
namespace
std
;
#include
"SlsDetectorCamera.h"
/*******************************************************************
* \brief ReconstructionCtrlObj constructor
*******************************************************************/
...
...
@@ -51,13 +53,13 @@ Reconstruction::CtrlObjProxy::~CtrlObjProxy()
LinkTask
*
Reconstruction
::
CtrlObjProxy
::
getReconstructionTask
()
{
DEB_MEMBER_FUNCT
();
LinkTask
*
task
=
(
m_r
&&
m_r
->
m_active
)
?
m_r
:
NULL
;
LinkTask
*
task
=
m_r
?
m_r
:
NULL
;
DEB_RETURN
()
<<
DEB_VAR1
(
task
);
return
task
;
}
Reconstruction
::
Reconstruction
()
:
m_proxy
(
NULL
),
m_active
(
false
)
Reconstruction
::
Reconstruction
(
Camera
*
cam
)
:
m_cam
(
cam
),
m_proxy
(
NULL
),
m_active
(
false
)
{
DEB_CONSTRUCTOR
();
}
...
...
@@ -73,11 +75,9 @@ void Reconstruction::setActive(bool active)
{
DEB_MEMBER_FUNCT
();
DEB_PARAM
()
<<
DEB_VAR2
(
active
,
m_active
);
if
(
active
==
m_active
)
return
;
m_active
=
active
;
if
(
m_proxy
)
m_proxy
->
reconstructionChange
(
m_active
?
this
:
NULL
);
m_proxy
->
reconstructionChange
(
this
);
}
void
Reconstruction
::
getActive
(
bool
&
active
)
...
...
@@ -86,3 +86,45 @@ void Reconstruction::getActive(bool& active)
active
=
m_active
;
DEB_RETURN
()
<<
DEB_VAR1
(
active
);
}
void
Reconstruction
::
prepare
()
{
DEB_MEMBER_FUNCT
();
AutoMutex
l
(
m_mutex
);
m_frame_packet_map
.
clear
();
}
void
Reconstruction
::
cleanUp
()
{
DEB_MEMBER_FUNCT
();
AutoMutex
l
(
m_mutex
);
m_frame_packet_map
.
clear
();
}
void
Reconstruction
::
addFramePackets
(
DetFrameImagePackets
&&
det_frame_packets
)
{
DEB_MEMBER_FUNCT
();
AutoMutex
l
(
m_mutex
);
m_frame_packet_map
.
emplace
(
std
::
move
(
det_frame_packets
));
}
Data
Reconstruction
::
process
(
Data
&
data
)
{
DEB_MEMBER_FUNCT
();
FrameType
frame
=
data
.
frameNumber
;
AutoMutex
l
(
m_mutex
);
FramePacketMap
::
iterator
it
=
m_frame_packet_map
.
find
(
frame
);
if
(
it
==
m_frame_packet_map
.
end
())
return
data
;
DetFrameImagePackets
det_frame_packets
=
std
::
move
(
*
it
);
m_frame_packet_map
.
erase
(
it
);
l
.
unlock
();
m_cam
->
assemblePackets
(
std
::
move
(
det_frame_packets
));
return
m_active
?
processModel
(
data
)
:
data
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment