RegCVNImageUtils.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file RegCVNImageUtils.h
3 /// \brief Utilities for producing images for the RegCVN
4 /// \author Leigh Whitehead - leigh.howard.whitehead@cern.ch
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef RegCVN_IMAGE_UTILS_H
8 #define RegCVN_IMAGE_UTILS_H
9 
10 #include <vector>
11 
12 #include "CVN/func/RegPixelMap.h"
13 
14 namespace cvn
15 {
16 
17  /// Useful typedefs
18  typedef std::vector<std::vector<float> > ViewVectorF;
19  typedef std::vector<ViewVectorF> ImageVectorF;
20 
21  /// Class containing some utility functions for all things RegCVN
23  {
24  public:
26  RegCVNImageUtils(unsigned int nPlanes, unsigned int nCells, unsigned int nViews);
28 
29 
30  /// Function to set any views that need reversing
31  void SetViewReversal(bool reverseX, bool reverseY);
32  void SetViewReversal(std::vector<bool> reverseViews);
33 
34  /// Set the input pixel map size
35  void SetPixelMapSize(unsigned int nPlanes, unsigned int nCells);
36 
37  /// Set compress pixels
38  void SetCompressPixels(bool compressPixels);
39 
40 
41  // Scale Charges
42  float ConvertToScaledCharge(float charge);
43 
44  /// Convert a pixel map into an image vector (float version)
45  void ConvertPixelMapToImageVectorF(const RegPixelMap &pm, ImageVectorF &imageVec);
46 
47  /// Float version of conversion for convenience of TF interface
48  void ConvertChargeVectorsToImageVectorF(std::vector<float> &v0pe, std::vector<float> &v1pe,
49  ImageVectorF &imageVec);
50 
51 
52  private:
53 
54  /// Base function for conversion of the Pixel Map to our required output format
55  void ConvertChargeVectorsToViewVectors(std::vector<float> &v0pe, std::vector<float> &v1pe,
56  ViewVectorF& view0, ViewVectorF& view1);
57 
58  /// Make the image vector from the view vectors
59  ImageVectorF BuildImageVectorF(ViewVectorF v0, ViewVectorF v1);
60 
61 
62  /// Funtion to actually reverse the view
63  void ReverseView(std::vector<float> &peVec);
64 
65  /// Number of views of each event
66  unsigned int fNViews;
67 
68  /// Input pixel map sizes
69  unsigned int fPixelMapPlanes;
70  unsigned int fPixelMapCells;
71 
72  /// Compress pixels ?
74 
75  /// Vector of bools to decide if any views need to be reversed
76  std::vector<bool> fViewReverse;
77 
78  };
79 
80 }
81 
82 #endif // RegCVN_IMAGE_UTILS_H
float ConvertToScaledCharge(float charge)
std::vector< ViewVectorF > ImageVectorF
void ConvertPixelMapToImageVectorF(const RegPixelMap &pm, ImageVectorF &imageVec)
Convert a pixel map into an image vector (float version)
std::vector< std::vector< float > > ViewVectorF
Useful typedefs.
ImageVectorF BuildImageVectorF(ViewVectorF v0, ViewVectorF v1)
Make the image vector from the view vectors.
unsigned int fPixelMapPlanes
Input pixel map sizes.
Class containing some utility functions for all things RegCVN.
Defines an enumeration for prong classification.
std::vector< bool > fViewReverse
Vector of bools to decide if any views need to be reversed.
bool fCompressPixels
Compress pixels ?
void ConvertChargeVectorsToViewVectors(std::vector< float > &v0pe, std::vector< float > &v1pe, ViewVectorF &view0, ViewVectorF &view1)
Base function for conversion of the Pixel Map to our required output format.
void SetCompressPixels(bool compressPixels)
Set compress pixels.
RegPixelMap, basic input to CVN neural net.
Definition: RegPixelMap.h:22
void ConvertChargeVectorsToImageVectorF(std::vector< float > &v0pe, std::vector< float > &v1pe, ImageVectorF &imageVec)
Float version of conversion for convenience of TF interface.
unsigned int fNViews
Number of views of each event.
void SetViewReversal(bool reverseX, bool reverseY)
Function to set any views that need reversing.
void SetPixelMapSize(unsigned int nPlanes, unsigned int nCells)
Set the input pixel map size.
RegPixelMap for Regression modified from Dominick&#39;s PixelMap.
unsigned int fPixelMapCells
void ReverseView(std::vector< float > &peVec)
Funtion to actually reverse the view.