ImgData.h
Go to the documentation of this file.
1 /**
2 
3  Some implementation of data interfaces used by INode components from wire-cell-img.
4 
5  Note: this header should NOT typically be #include'ed in other Wire
6  Cell components which are not defined in wire-cell-img/src/. It's
7  exported as public to facilitiate writing unit tests.
8 
9 */
10 
11 #include "WireCellIface/IFrame.h"
12 #include "WireCellIface/IWire.h"
13 #include "WireCellIface/IChannel.h"
14 #include "WireCellIface/IStripe.h"
16 #include "WireCellIface/ISlice.h"
18 
19 namespace WireCell {
20  namespace Img {
21  namespace Data {
22 
23  class Slice : public ISlice {
26  int m_ident;
27  double m_start, m_span;
28  public:
29  Slice(const IFrame::pointer& frame, int ident, double start, double span)
30  : m_frame(frame), m_ident(ident), m_start(start), m_span(span) {}
31 
32  virtual ~Slice();
33 
34  IFrame::pointer frame() const {return m_frame;}
35 
36  int ident() const { return m_ident; }
37  double start() const { return m_start; }
38  double span() const { return m_span; }
39  map_t activity() const { return m_activity; }
40 
41  // These methods are not part of the ISlice interface and may be
42  // used prior to interment in the ISlice::pointer.
43 
44  void sum(const IChannel::pointer& ch, value_t val) { m_activity[ch] += val; }
45  };
46 
47  // simple collection
48  class SliceFrame : public ISliceFrame {
50  int m_ident;
51  double m_time;
52  public:
53  SliceFrame(const ISlice::vector& islices, int ident, double time)
54  : m_slices(islices), m_ident(ident), m_time(time) {}
55  virtual ~SliceFrame();
56 
57  int ident() const { return m_ident; }
58  double time() const { return m_time; }
59  ISlice::vector slices() const { return m_slices; }
60  };
61 
62 
63  class Stripe : public IStripe {
64  int m_ident;
66 
67  public:
68  Stripe(int ident) : m_ident(ident) {}
69  virtual ~Stripe();
70 
71  int ident() const { return m_ident; }
72  vector_t values() const { return m_values; }
73 
74  // these methods may be used prior to internment into IStripe::pointer
75 
77  m_values.push_back(make_pair(ich, value));
78  }
79 
80  };
81  class StripeSet : public IStripeSet {
82  int m_ident;
84 
85  public:
86 
87  StripeSet(int ident) : m_ident(ident) {}
88  virtual ~StripeSet();
89 
90  int ident() const { return m_ident; }
91  IStripe::vector stripes() const { return m_stripes; }
92 
93  // use before interning
94 
95  void push_back(const IStripe::pointer& s) { m_stripes.push_back(s); }
96  size_t size() const { return m_stripes.size(); }
97 
98  };
99 
100  }
101 
102  }
103 }
104 
std::shared_ptr< const IFrame > pointer
Definition: IData.h:19
vector_t values() const
the contiguous, ordered, per channel values.
Definition: ImgData.h:72
double start() const
Definition: ImgData.h:37
map_t activity() const
Definition: ImgData.h:39
Slice(const IFrame::pointer &frame, int ident, double start, double span)
Definition: ImgData.h:29
IStripe::vector m_stripes
Definition: ImgData.h:83
std::vector< pointer > vector
Definition: IData.h:21
void sum(const IChannel::pointer &ch, value_t val)
Definition: ImgData.h:44
int ident() const
Return some identifier number that is unique to this set.
Definition: ImgData.h:90
int ident() const
Definition: ImgData.h:36
std::unordered_map< IChannel::pointer, value_t > map_t
Definition: ISlice.h:33
float value_t
Definition: ISlice.h:29
std::vector< pair_t > vector_t
Definition: IStripe.h:36
double span() const
Definition: ImgData.h:38
int ident() const
An identifier for this stripe.
Definition: ImgData.h:71
void push_back(const IStripe::pointer &s)
Definition: ImgData.h:95
void append(IChannel::pointer ich, value_t value)
Definition: ImgData.h:76
IFrame::pointer m_frame
Definition: ImgData.h:24
int ident() const
Return some identifier number that is unique to this slice frame.
Definition: ImgData.h:57
Definition: Main.h:22
double time() const
A reference time.
Definition: ImgData.h:58
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
static QCString * s
Definition: config.cpp:1042
ISlice::vector slices() const
Return the slices.
Definition: ImgData.h:59
SliceFrame(const ISlice::vector &islices, int ident, double time)
Definition: ImgData.h:53
IFrame::pointer frame() const
Definition: ImgData.h:34
size_t size() const
Definition: ImgData.h:96
IStripe::vector stripes() const
Return the stripes in this set. There is no ordering requirement.
Definition: ImgData.h:91