QXRD  0.11.16
Public Slots | Public Member Functions | Static Public Member Functions | Properties | Private Attributes | List of all members
QcepIntegratedData Class Reference

#include <qcepintegrateddata.h>

Inheritance diagram for QcepIntegratedData:
Inheritance graph
[legend]
Collaboration diagram for QcepIntegratedData:
Collaboration graph
[legend]

Public Slots

virtual QString description () const
 
double x (int i) const
 
double y (int i) const
 
void resize (int n)
 
int size () const
 
- Public Slots inherited from QcepDataObject
virtual QString description () const
 
QString metaTypeName (int id) const
 
QString pathName () const
 
QcepDataGroupPtr rootItem ()
 
virtual QcepDataGroupPtr parentItem () const
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime()) const
 
virtual void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 QcepIntegratedData (QcepSettingsSaverWPtr saver, QString name, QcepDoubleImageDataPtr data, int maxSize, QcepObject *parent)
 
 ~QcepIntegratedData ()
 
void append (double x, double y)
 
void setValue (int n, double x, double y)
 
void selfNormalize (double minx, double maxx)
 
void set_Center (double cx, double cy)
 
void set_Image (QcepDoubleImageDataPtr image)
 
QcepDoubleImageDataPtr get_Image () const
 
QString get_XUnitsLabel () const
 
void set_XUnitsLabel (QString units)
 
int get_Oversample () const
 
void set_Oversample (int ovs)
 
const double * x () const
 
const double * y () const
 
double cx () const
 
double cy () const
 
- Public Member Functions inherited from QcepDataObject
 QcepDataObject (QcepSettingsSaverWPtr saver, QString name, int byteSize, QcepObject *parent)
 
virtual ~QcepDataObject ()
 
QcepSettingsSaverWPtr saver ()
 
virtual int childCount () const
 
virtual QcepDataObjectPtr item (int n)
 
virtual QcepDataObjectPtr item (QString nm)
 
virtual void setParentItem (QcepDataGroupWPtr parent)
 
virtual int indexInParent () const
 
virtual int rowCount () const
 
virtual int columnCount () const
 
virtual QVariant columnData (int col) const
 
virtual QString fileFormatFilterString ()
 
virtual void saveData (QString &name, QString filter, Overwrite canOverwrite=NoOverwrite)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 
QString get_Name () const
 
void set_Name (QString name)
 

Static Public Member Functions

static QcepIntegratedDataPtr newIntegratedData (QcepSettingsSaverWPtr saver, QString name, int sz, QcepObject *parent)
 
static QScriptValue toIntegratedDataScriptValue (QScriptEngine *engine, const QcepIntegratedDataPtr &data)
 
static void fromIntegratedDataScriptValue (const QScriptValue &obj, QcepIntegratedDataPtr &data)
 
- Static Public Member Functions inherited from QcepDataObject
static QcepDataObjectPtr newDataObject (QcepSettingsSaverWPtr saver, QString name, QcepObject *parent)
 
static QScriptValue toScriptValue (QScriptEngine *engine, const QcepDataObjectPtr &data)
 
static void fromScriptValue (const QScriptValue &obj, QcepDataObjectPtr &data)
 
static int allocatedObjects ()
 
static int deletedObjects ()
 
- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Properties

QString title
 
- Properties inherited from QcepDataObject
QString type
 
quint64 byteSize
 
QString creator
 
QString version
 
QString qtVersion
 
QString description
 
QString fileName
 
int objectSaved
 
- Properties inherited from QcepObject
QString name
 

Private Attributes

QcepDoubleImageDataPtr m_Image
 
int m_MaxSize
 
int m_Size
 
const int m_AllocStep
 
QVector< double > m_X
 
QVector< double > m_Y
 
double m_cx
 
double m_cy
 
QString m_XUnitsLabel
 
int m_Oversample
 

Additional Inherited Members

- Public Types inherited from QcepDataObject
enum  Overwrite { NoOverwrite, CanOverwrite }
 
- Signals inherited from QcepDataObject
void dataObjectChanged ()
 
- Protected Member Functions inherited from QcepDataObject
void mkPath (QString filePath)
 
QString uniqueFileName (QString name)
 

Detailed Description

Definition at line 10 of file qcepintegrateddata.h.

Constructor & Destructor Documentation

QcepIntegratedData::QcepIntegratedData ( QcepSettingsSaverWPtr  saver,
QString  name,
QcepDoubleImageDataPtr  data,
int  maxSize,
QcepObject parent 
)
explicit

Definition at line 6 of file qcepintegrateddata.cpp.

References QcepAllocator::allocate(), and m_MaxSize.

Referenced by newIntegratedData().

8  :
9  QcepDataObject(saver, name, 2*maxSize*sizeof(double), parent),
10  m_Title(saver, this, "title", "", "Integrated Data Title"),
11  m_Image(image),
12  m_MaxSize(maxSize),
13  m_Size(0),
14  m_AllocStep(1024),
15  m_X(maxSize),
16  m_Y(maxSize),
17  m_cx(0),
18  m_cy(0),
19  m_XUnitsLabel("TTH"),
20  m_Oversample(1)
21 {
22  set_Type("Integrated Data");
23 
24  QcepAllocator::allocate(sizeof(double), 2, m_MaxSize);
25 }
QcepDoubleImageDataPtr m_Image
QcepDataObject(QcepSettingsSaverWPtr saver, QString name, int byteSize, QcepObject *parent)
QVector< double > m_X
QVector< double > m_Y
static void allocate(int sz, int width, int height)
QString name
Definition: qcepobject.h:49
QcepSettingsSaverWPtr saver()

Here is the call graph for this function:

Here is the caller graph for this function:

QcepIntegratedData::~QcepIntegratedData ( )

Definition at line 27 of file qcepintegrateddata.cpp.

References QcepAllocator::deallocate(), and m_MaxSize.

28 {
29  QcepAllocator::deallocate(sizeof(double), 2, m_MaxSize);
30 }
static void deallocate(int sz, int width, int height)

Here is the call graph for this function:

Member Function Documentation

void QcepIntegratedData::append ( double  x,
double  y 
)

Definition at line 103 of file qcepintegrateddata.cpp.

References m_X, m_Y, resize(), size(), x(), and y().

104 {
105  resize(size()+1);
106 
107  m_X[size()-1] = x;
108  m_Y[size()-1] = y;
109 }
const double * y() const
QVector< double > m_X
const double * x() const
QVector< double > m_Y

Here is the call graph for this function:

double QcepIntegratedData::cx ( ) const

Definition at line 93 of file qcepintegrateddata.cpp.

References m_cx.

Referenced by set_Center().

94 {
95  return m_cx;
96 }

Here is the caller graph for this function:

double QcepIntegratedData::cy ( ) const

Definition at line 98 of file qcepintegrateddata.cpp.

References m_cy.

Referenced by set_Center().

99 {
100  return m_cy;
101 }

Here is the caller graph for this function:

QString QcepIntegratedData::description ( ) const
virtualslot

Definition at line 32 of file qcepintegrateddata.cpp.

References m_Size.

33 {
34  return tr("%1 Rows").arg(m_Size);
35 }
void QcepIntegratedData::fromIntegratedDataScriptValue ( const QScriptValue &  obj,
QcepIntegratedDataPtr data 
)
static

Definition at line 182 of file qcepintegrateddata.cpp.

183 {
184  QObject *qobj = obj.toQObject();
185 
186  if (qobj) {
187  QcepIntegratedData *qdobj = qobject_cast<QcepIntegratedData*>(qobj);
188 
189  if (qdobj) {
190  QcepDataObjectPtr p = qdobj->sharedFromThis();
191 
192  if (p) {
193  QcepIntegratedDataPtr cs = qSharedPointerDynamicCast<QcepIntegratedData>(p);
194 
195  if (cs) {
196  data = cs;
197  }
198  }
199  }
200  }
201 }
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr
QSharedPointer< QcepDataObject > QcepDataObjectPtr
QcepDoubleImageDataPtr QcepIntegratedData::get_Image ( ) const

Definition at line 152 of file qcepintegrateddata.cpp.

References m_Image.

153 {
154  return m_Image;
155 }
QcepDoubleImageDataPtr m_Image
int QcepIntegratedData::get_Oversample ( ) const

Definition at line 167 of file qcepintegrateddata.cpp.

References m_Oversample.

168 {
169  return m_Oversample;
170 }
QString QcepIntegratedData::get_XUnitsLabel ( ) const

Definition at line 157 of file qcepintegrateddata.cpp.

References m_XUnitsLabel.

158 {
159  return m_XUnitsLabel;
160 }
QcepIntegratedDataPtr QcepIntegratedData::newIntegratedData ( QcepSettingsSaverWPtr  saver,
QString  name,
int  sz,
QcepObject parent 
)
static

Definition at line 37 of file qcepintegrateddata.cpp.

References QcepIntegratedData().

Referenced by QcepDataGroup::newIntegratedData(), and QcepDatasetModel::newIntegratedData().

39 {
41 
42  return res;
43 }
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr
QcepIntegratedData(QcepSettingsSaverWPtr saver, QString name, QcepDoubleImageDataPtr data, int maxSize, QcepObject *parent)
QString name
Definition: qcepobject.h:49
QcepSettingsSaverWPtr saver()
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepIntegratedData::resize ( int  n)
slot

Definition at line 45 of file qcepintegrateddata.cpp.

References QcepAllocator::allocate(), m_AllocStep, m_MaxSize, m_Size, m_X, and m_Y.

Referenced by append().

46 {
47  if (n >= m_MaxSize) {
48  int newSize = (n/m_AllocStep+1)*m_AllocStep;
49  m_X.resize(newSize);
50  m_Y.resize(newSize);
51 
52  QcepAllocator::allocate(sizeof(double), 2, newSize-m_MaxSize);
53 
54  set_ByteSize(2*newSize*sizeof(double));
55 
56  m_MaxSize = newSize;
57  }
58 
59  m_Size = n;
60 }
QVector< double > m_X
QVector< double > m_Y
static void allocate(int sz, int width, int height)

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepIntegratedData::selfNormalize ( double  minx,
double  maxx 
)

Definition at line 117 of file qcepintegrateddata.cpp.

References m_Size, m_X, m_Y, x(), and y().

118 {
119  double sumn = 0, sumv = 0;
120 
121  for (int i=0; i<m_Size; i++) {
122  double x = m_X.value(i);
123  double y = m_Y.value(i);
124 
125  if (x == x && y == y) {
126  if (x >= minx && x <= maxx) {
127  sumn += 1;
128  sumv += y;
129  }
130  }
131  }
132 
133  if (sumn >= 5) {
134  double norm = sumn/sumv;
135 
136  for (int i=0; i<m_Size; i++) {
137  double x = m_X.value(i);
138  double y = m_Y.value(i);
139 
140  if (x == x && y == y) {
141  m_Y[i] = y*norm;
142  }
143  }
144  }
145 }
const double * y() const
QVector< double > m_X
const double * x() const
QVector< double > m_Y

Here is the call graph for this function:

void QcepIntegratedData::set_Center ( double  cx,
double  cy 
)

Definition at line 87 of file qcepintegrateddata.cpp.

References cx(), cy(), m_cx, and m_cy.

88 {
89  m_cx = cx;
90  m_cy = cy;
91 }

Here is the call graph for this function:

void QcepIntegratedData::set_Image ( QcepDoubleImageDataPtr  image)

Definition at line 147 of file qcepintegrateddata.cpp.

References m_Image.

148 {
149  m_Image = image;
150 }
QcepDoubleImageDataPtr m_Image
void QcepIntegratedData::set_Oversample ( int  ovs)

Definition at line 172 of file qcepintegrateddata.cpp.

References m_Oversample.

173 {
174  m_Oversample = ovs;
175 }
void QcepIntegratedData::set_XUnitsLabel ( QString  units)

Definition at line 162 of file qcepintegrateddata.cpp.

References m_XUnitsLabel.

163 {
164  m_XUnitsLabel = units;
165 }
void QcepIntegratedData::setValue ( int  n,
double  x,
double  y 
)

Definition at line 111 of file qcepintegrateddata.cpp.

References m_X, and m_Y.

112 {
113  m_X.replace(n, x);
114  m_Y.replace(n, y);
115 }
const double * y() const
QVector< double > m_X
const double * x() const
QVector< double > m_Y
int QcepIntegratedData::size ( ) const
slot

Definition at line 62 of file qcepintegrateddata.cpp.

References m_Size.

Referenced by append().

63 {
64  return m_Size;
65 }

Here is the caller graph for this function:

QScriptValue QcepIntegratedData::toIntegratedDataScriptValue ( QScriptEngine *  engine,
const QcepIntegratedDataPtr data 
)
static

Definition at line 177 of file qcepintegrateddata.cpp.

178 {
179  return engine->newQObject(data.data());
180 }
double QcepIntegratedData::x ( int  i) const
slot

Definition at line 77 of file qcepintegrateddata.cpp.

References m_X.

78 {
79  return m_X.value(i);
80 }
QVector< double > m_X
const double * QcepIntegratedData::x ( ) const

Definition at line 67 of file qcepintegrateddata.cpp.

References m_X.

Referenced by append(), and selfNormalize().

68 {
69  return m_X.data();
70 }
QVector< double > m_X

Here is the caller graph for this function:

double QcepIntegratedData::y ( int  i) const
slot

Definition at line 82 of file qcepintegrateddata.cpp.

References m_Y.

83 {
84  return m_Y.value(i);
85 }
QVector< double > m_Y
const double * QcepIntegratedData::y ( ) const

Definition at line 72 of file qcepintegrateddata.cpp.

References m_Y.

Referenced by append(), and selfNormalize().

73 {
74  return m_Y.data();
75 }
QVector< double > m_Y

Here is the caller graph for this function:

Member Data Documentation

const int QcepIntegratedData::m_AllocStep
private

Definition at line 64 of file qcepintegrateddata.h.

Referenced by resize().

double QcepIntegratedData::m_cx
private

Definition at line 67 of file qcepintegrateddata.h.

Referenced by cx(), and set_Center().

double QcepIntegratedData::m_cy
private

Definition at line 67 of file qcepintegrateddata.h.

Referenced by cy(), and set_Center().

QcepDoubleImageDataPtr QcepIntegratedData::m_Image
private

Definition at line 61 of file qcepintegrateddata.h.

Referenced by get_Image(), and set_Image().

int QcepIntegratedData::m_MaxSize
private

Definition at line 62 of file qcepintegrateddata.h.

Referenced by QcepIntegratedData(), resize(), and ~QcepIntegratedData().

int QcepIntegratedData::m_Oversample
private

Definition at line 69 of file qcepintegrateddata.h.

Referenced by get_Oversample(), and set_Oversample().

int QcepIntegratedData::m_Size
private

Definition at line 63 of file qcepintegrateddata.h.

Referenced by description(), resize(), selfNormalize(), and size().

QVector<double> QcepIntegratedData::m_X
private

Definition at line 66 of file qcepintegrateddata.h.

Referenced by append(), resize(), selfNormalize(), setValue(), and x().

QString QcepIntegratedData::m_XUnitsLabel
private

Definition at line 68 of file qcepintegrateddata.h.

Referenced by get_XUnitsLabel(), and set_XUnitsLabel().

QVector<double> QcepIntegratedData::m_Y
private

Definition at line 66 of file qcepintegrateddata.h.

Referenced by append(), resize(), selfNormalize(), setValue(), and y().

Property Documentation

QString QcepIntegratedData::title
readwrite

Definition at line 57 of file qcepintegrateddata.h.


The documentation for this class was generated from the following files: