QXRD  0.11.16
Public Slots | Public Member Functions | Private Types | List of all members
QcepMaskData Class Reference

#include <qcepmaskdata.h>

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

Public Slots

bool maskValue (int x, int y) const
 
void setMaskValue (int x, int y, bool mval)
 
QcepMaskDataPtr copyMask (QcepObject *parent)
 
void setCircularMask ()
 
void showMaskAll ()
 
void hideMaskAll ()
 
void invertMask ()
 
void growMask ()
 
void shrinkMask ()
 
void andMask (QcepMaskDataPtr mask)
 
void orMask (QcepMaskDataPtr mask)
 
void xorMask (QcepMaskDataPtr mask)
 
void andNotMask (QcepMaskDataPtr mask)
 
void orNotMask (QcepMaskDataPtr mask)
 
void xorNotMask (QcepMaskDataPtr mask)
 
void maskCircle (double cx, double cy, double r, bool val)
 
int countMaskedPixels () const
 
int countUnmaskedPixels () const
 
int countOverflowPixels () const
 
QString summary ()
 
QImage thumbnailImage () const
 
QSize thumbnailImageSize () const
 
- Public Slots inherited from QcepImageDataBase
virtual QString description () const
 
void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
double hValue (int n) const
 
double vValue (int n) 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

 QcepMaskData (QcepSettingsSaverWPtr saver, int width, int height, int def, QcepObject *parent)
 
 ~QcepMaskData ()
 
void copyMaskTo (QcepMaskDataPtr dest)
 
short * mask ()
 
template<typename T >
void setMaskRange (QSharedPointer< QcepImageData< T > > image, T min, T max, bool inRange, bool setTo)
 
template<typename T >
void showMaskRange (QSharedPointer< QcepImageData< T > > image, T min, T max)
 
template<typename T >
void hideMaskRange (QSharedPointer< QcepImageData< T > > image, T min, T max)
 
- Public Member Functions inherited from QcepImageData< short >
 QcepImageData (QcepSettingsSaverWPtr saver, int width, int height, short def, QcepObject *parent)
 
virtual ~QcepImageData ()
 
bool readImage (QString filename)
 
void resize (int width, int height)
 
void clear ()
 
void fill (double val)
 
double getImageData (int x, int y) const
 
QVector< double > getImageData (int x0, int y0, int x1, int y1) const
 
void setImageData (int x, int y, double v)
 
virtual void saveData (QString &name, QString filter, Overwrite canOverwrite=NoOverwrite)
 
void saveTIFFData (QString name)
 
double minValue () const
 
double maxValue () const
 
QPointF percentileRange (double lowpct, double highpct)
 
double sumInRectangle (QRectF rect)
 
double averageInRectangle (QRectF rect)
 
double minInRectangle (QRectF rect)
 
double maxInRectangle (QRectF rect)
 
double sumInEllipse (QRectF rect)
 
double averageInEllipse (QRectF rect)
 
double minInEllipse (QRectF rect)
 
double maxInEllipse (QRectF rect)
 
double sumInPeak (QRectF rect)
 
void subtractDark (const QSharedPointer< QcepImageData< T2 > > dark)
 
void calculateRange ()
 
void calculateRangeInCircle ()
 
void dumpPixels (int x0, int y0, int x1, int y1)
 
short * data ()
 
short value (int x, int y) const
 
short value (double x, double y) const
 
void setValue (int x, int y, short val)
 
void addValue (int x, int y, short val)
 
void subtractValue (int x, int y, short val)
 
void multiplyValue (int x, int y, short val)
 
void divideValue (int x, int y, short val)
 
short defaultValue () const
 
void setDefaultValue (short def)
 
QString rawFileName ()
 
void copyImage (QSharedPointer< QcepImageData< T2 > > dest)
 
void copyFrom (const QSharedPointer< QcepImageData< T2 > > img)
 
void accumulateImage (QSharedPointer< QcepImageData< T2 > > image)
 
void add (QSharedPointer< QcepImageData< T2 > > image)
 
void subtract (QSharedPointer< QcepImageData< T2 > > image)
 
void multiply (QSharedPointer< QcepImageData< T2 > > image)
 
void divide (QSharedPointer< QcepImageData< T2 > > image)
 
void setMask (QcepMaskDataPtr mask, QcepMaskDataPtr overflow)
 
QcepMaskDataPtr mask () const
 
QcepMaskDataPtr overflow () const
 
double correlate (QSharedPointer< QcepImageData< short > > image, int dx, int dy, int mx, int my)
 
void shiftImage (QSharedPointer< QcepImageData< short > > image, double dx, double dy)
 
short findMin () const
 
short findMax () const
 
double findAverage () const
 
void correctBadBackgroundSubtraction (QcepDoubleImageDataPtr dark, int nImgExposures, int nDarkExposures)
 
- Public Member Functions inherited from QcepImageDataBase
 QcepImageDataBase (QcepSettingsSaverWPtr saver, int width, int height, int size, QcepObject *parent)
 
virtual ~QcepImageDataBase ()
 
QString get_DateString () const
 
void set_DateString (QString)
 
QString get_DataTypeName () const
 
void set_DataTypeName (QString)
 
void copyProperties (QcepImageDataBase *dest)
 
void copyPropertiesFrom (QSharedPointer< QcepImageDataBase > src)
 
void loadMetaData ()
 
void saveMetaData ()
 
void saveMetaData (QString name)
 
void saveTextData (QString name, QString sep, bool transp=false)
 
void setDefaultFileName (QString path)
 
virtual QString fileFormatFilterString ()
 
QString fileFormatTIFF ()
 
QString fileFormatTabDelimited ()
 
QString fileFormatTransposedTabDelimited ()
 
QString fileFormatCSV ()
 
QString fileFormatTransposedCSV ()
 
QMutex * mutex ()
 
- 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
 
- 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)
 

Private Types

enum  { ThumbnailWidth = 24, ThumbnailHeight = 24 }
 

Additional Inherited Members

- Public Types inherited from QcepImageDataBase
enum  {
  UndefinedData, Raw16Data, Raw32Data, DarkData,
  MaskData, SubtractedData, GainData, BadPixelsData
}
 
- Public Types inherited from QcepDataObject
enum  Overwrite { NoOverwrite, CanOverwrite }
 
- Signals inherited from QcepDataObject
void dataObjectChanged ()
 
- Static Public Member Functions inherited from QcepImageData< short >
static QSharedPointer< QcepImageData< short > > newImage (QcepSettingsSaverWPtr saver, QString name, int width, int height, QcepObject *parent)
 
static QScriptValue toScriptValue (QScriptEngine *engine, const QSharedPointer< QcepImageData< short > > &data)
 
static void fromScriptValue (const QScriptValue &obj, QSharedPointer< QcepImageData< short > > &data)
 
- Static Public Member Functions inherited from QcepImageDataBase
static double secondsSinceEpoch ()
 
- 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)
 
- Protected Member Functions inherited from QcepDataObject
void mkPath (QString filePath)
 
QString uniqueFileName (QString name)
 
- Protected Attributes inherited from QcepImageData< short >
QVector< short > m_Image
 
short m_MinValue
 
short m_MaxValue
 
short m_Default
 
QcepMaskDataPtr m_Mask
 
QcepMaskDataPtr m_Overflow
 
- Protected Attributes inherited from QcepImageDataBase
int m_ImageCounter
 
QcepSettingsSaverWPtr m_Saver
 
- Properties inherited from QcepImageDataBase
int width
 
int height
 
double hStart
 
double hStep
 
double vStart
 
double vStep
 
QString hLabel
 
QString hUnits
 
QString vLabel
 
QString vUnits
 
int dataType
 
QString dataTypeName
 
QString fileBase
 
QString title
 
int readoutMode
 
double exposureTime
 
int summedExposures
 
int imageSequenceNumber
 
int imageNumber
 
int phaseNumber
 
int nPhases
 
QDateTime dateTime
 
QString dateString
 
double timeStamp
 
int hBinning
 
int vBinning
 
double cameraGain
 
int triggered
 
QString userComment1
 
QString userComment2
 
QString userComment3
 
QString userComment4
 
QcepDoubleList normalization
 
QcepDoubleList extraInputs
 
bool used
 
- 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
 

Detailed Description

Definition at line 7 of file qcepmaskdata.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
ThumbnailWidth 
ThumbnailHeight 

Definition at line 57 of file qcepmaskdata.h.

Constructor & Destructor Documentation

QcepMaskData::QcepMaskData ( QcepSettingsSaverWPtr  saver,
int  width,
int  height,
int  def,
QcepObject parent 
)

Definition at line 4 of file qcepmaskdata.cpp.

5  : QcepImageData<short>(saver, width, height, def, parent)
6 {
7  set_Type("Mask Data");
8 }
QcepSettingsSaverWPtr saver()
QcepMaskData::~QcepMaskData ( )

Definition at line 10 of file qcepmaskdata.cpp.

11 {
12 }

Member Function Documentation

void QcepMaskData::andMask ( QcepMaskDataPtr  mask)
slot

Definition at line 143 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

144 {
145  int height = get_Height();
146  int width = get_Width();
147 
148  for (int j=0; j<height; j++) {
149  for (int i=0; i<width; i++) {
150  setMaskValue(i,j, maskValue(i,j) & mask->maskValue(i,j));
151  }
152  }
153 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

void QcepMaskData::andNotMask ( QcepMaskDataPtr  mask)
slot

Definition at line 179 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

180 {
181  int height = get_Height();
182  int width = get_Width();
183 
184  for (int j=0; j<height; j++) {
185  for (int i=0; i<width; i++) {
186  setMaskValue(i,j, maskValue(i,j) & !mask->maskValue(i,j));
187  }
188  }
189 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

QcepMaskDataPtr QcepMaskData::copyMask ( QcepObject parent)
slot

Definition at line 94 of file qcepmaskdata.cpp.

References QcepAllocator::AlwaysAllocate, copyMaskTo(), and QcepAllocator::newMask().

Referenced by growMask(), and shrinkMask().

95 {
96  QcepMaskDataPtr copy(QcepAllocator::newMask(QcepAllocator::AlwaysAllocate, get_Width(), get_Height(), 0, parent));
97 
98  copyMaskTo(copy);
99 
100  return copy;
101 }
void copyMaskTo(QcepMaskDataPtr dest)
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepMaskData::copyMaskTo ( QcepMaskDataPtr  dest)

Definition at line 19 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

Referenced by copyMask().

20 {
21  int height = get_Height();
22  int width = get_Width();
23 
24  for (int j=0; j<height; j++) {
25  for (int i=0; i<width; i++) {
26  dest -> setMaskValue(i,j, maskValue(i,j));
27  }
28  }
29 
30  dest -> set_Title(get_Title()+" copy");
31 //
32 // setMask(from -> m_Mask);
33 }
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

Here is the caller graph for this function:

int QcepMaskData::countMaskedPixels ( ) const
slot

Definition at line 248 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

249 {
250  int total = m_Image.count();
251  int totalSet = 0;
252 
253  for (int i=0; i<total; i++) {
254  if (m_Image[i] == 0) {
255  totalSet++;
256  }
257  }
258 
259  return totalSet;
260 }
QVector< short > m_Image
int QcepMaskData::countOverflowPixels ( ) const
slot

Definition at line 276 of file qcepmaskdata.cpp.

References countUnmaskedPixels().

277 {
278  return countUnmaskedPixels();
279 }
int countUnmaskedPixels() const

Here is the call graph for this function:

int QcepMaskData::countUnmaskedPixels ( ) const
slot

Definition at line 262 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

Referenced by countOverflowPixels().

263 {
264  int total = m_Image.count();
265  int totalSet = 0;
266 
267  for (int i=0; i<total; i++) {
268  if (m_Image[i] == 1) {
269  totalSet++;
270  }
271  }
272 
273  return totalSet;
274 }
QVector< short > m_Image

Here is the caller graph for this function:

void QcepMaskData::growMask ( )
slot

Definition at line 103 of file qcepmaskdata.cpp.

References copyMask(), QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

104 {
105  QcepMaskDataPtr copy(copyMask(this));
106 
107  int height = get_Height();
108  int width = get_Width();
109 
110  for (int j=0; j<height; j++) {
111  for (int i=0; i<width; i++) {
112  short res = maskValue(i,j);
113  for (int ii=-1; ii<2; ii++) {
114  for (int jj=-1; jj<2; jj++) {
115  res = qMin(res, (short) copy->maskValue(i+ii, j+jj));
116  }
117  }
118  setMaskValue(i,j, res);
119  }
120  }
121 }
void setMaskValue(int x, int y, bool mval)
QcepMaskDataPtr copyMask(QcepObject *parent)
bool maskValue(int x, int y) const
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QcepMaskData::hideMaskAll ( )
slot

Definition at line 74 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

75 {
76  m_Image.fill(0);
77 }
QVector< short > m_Image
template<typename T >
template void QcepMaskData::hideMaskRange< double > ( QSharedPointer< QcepImageData< T > >  image,
min,
max 
)

Definition at line 339 of file qcepmaskdata.cpp.

340 {
341  setMaskRange<T>(image, min, max, true, false);
342 }
void QcepMaskData::invertMask ( )
slot

Definition at line 84 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

85 {
86  int total = m_Image.count();
87 // bool *msk = m_Mask.data();
88 
89  for (int i=0; i<total; i++) {
90  m_Image[i] = !m_Image[i];
91  }
92 }
QVector< short > m_Image
short * QcepMaskData::mask ( )

Definition at line 14 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

15 {
16  return m_Image.data();
17 }
QVector< short > m_Image
void QcepMaskData::maskCircle ( double  cx,
double  cy,
double  r,
bool  val 
)
slot

Definition at line 215 of file qcepmaskdata.cpp.

References setMaskValue().

216 {
217  for (int j=0; j<=r; j++) {
218  double dy = (((double)j)/r);
219  if (fabs(dy)<1.0) {
220  double dx = sqrt(1-dy*dy);
221  int x0 = (int) (cx - dx*r);
222  int x1 = (int) (cx + dx*r);
223 
224  for (int i=x0; i<x1; i++) {
225  setMaskValue(i, (int)(cy+j), val);
226  setMaskValue(i, (int)(cy-j), val);
227  }
228  }
229  }
230 }
void setMaskValue(int x, int y, bool mval)

Here is the call graph for this function:

bool QcepMaskData::maskValue ( int  x,
int  y 
) const
slot

Definition at line 35 of file qcepmaskdata.cpp.

References QcepImageData< short >::defaultValue(), and QcepImageData< short >::m_Image.

Referenced by andMask(), andNotMask(), copyMaskTo(), growMask(), orMask(), orNotMask(), shrinkMask(), thumbnailImage(), xorMask(), and xorNotMask().

36 {
37  if (x >= 0 && x < get_Width() && y >= 0 && y < get_Height()) {
38  return m_Image.value((get_Height()-y-1)*get_Width()+x);
39  }
40 
41  return defaultValue();
42 }
short defaultValue() const
QVector< short > m_Image

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepMaskData::orMask ( QcepMaskDataPtr  mask)
slot

Definition at line 155 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

156 {
157  int height = get_Height();
158  int width = get_Width();
159 
160  for (int j=0; j<height; j++) {
161  for (int i=0; i<width; i++) {
162  setMaskValue(i,j, maskValue(i,j) | mask->maskValue(i,j));
163  }
164  }
165 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

void QcepMaskData::orNotMask ( QcepMaskDataPtr  mask)
slot

Definition at line 191 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

192 {
193  int height = get_Height();
194  int width = get_Width();
195 
196  for (int j=0; j<height; j++) {
197  for (int i=0; i<width; i++) {
198  setMaskValue(i,j, maskValue(i,j) | !mask->maskValue(i,j));
199  }
200  }
201 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

void QcepMaskData::setCircularMask ( )
slot

Definition at line 51 of file qcepmaskdata.cpp.

References setMaskValue().

52 {
53  double cx = get_Width()/2, cy = get_Height()/2;
54  for (int y=0; y<get_Height(); y++) {
55  double dy = (((double)y)-cy)/cy;
56  double dx = sqrt(1-dy*dy);
57  int x0 = (int) (cx-dx*cx);
58  int x1 = (int) (cx+dx*cx);
59 
60  for (int x=0; x<x0; x++) {
61  setMaskValue(x,y,0);
62  }
63 
64  for (int x=x0; x<x1; x++) {
65  setMaskValue(x,y,1);
66  }
67 
68  for (int x=x1; x<get_Width(); x++) {
69  setMaskValue(x,y,0);
70  }
71  }
72 }
void setMaskValue(int x, int y, bool mval)

Here is the call graph for this function:

template<typename T >
void QcepMaskData::setMaskRange ( QSharedPointer< QcepImageData< T > >  image,
min,
max,
bool  inRange,
bool  setTo 
)

Definition at line 322 of file qcepmaskdata.cpp.

References QcepImageData< short >::setValue(), and QcepImageData< short >::value().

323 {
324  int nRows = image -> get_Height();
325  int nCols = image -> get_Width();
326 
327  for (int y=0; y<nRows; y++) {
328  for (int x=0; x<nCols; x++) {
329  T v = image -> value(x,y);
330 
331  if (((v >= min) && (v < max)) == inRange) {
332  setValue(x,y,setTo);
333  }
334  }
335  }
336 }
short value(int x, int y) const
void setValue(int x, int y, short val)

Here is the call graph for this function:

void QcepMaskData::setMaskValue ( int  x,
int  y,
bool  mval 
)
slot

Definition at line 44 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

Referenced by andMask(), andNotMask(), copyMaskTo(), growMask(), maskCircle(), orMask(), orNotMask(), setCircularMask(), shrinkMask(), xorMask(), and xorNotMask().

45 {
46  if (x >= 0 && x < get_Width() && y >= 0 && y < get_Height()) {
47  m_Image[(get_Height()-y-1)*get_Width()+x] = mval;
48  }
49 }
QVector< short > m_Image

Here is the caller graph for this function:

void QcepMaskData::showMaskAll ( )
slot

Definition at line 79 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

80 {
81  m_Image.fill(1);
82 }
QVector< short > m_Image
template<typename T >
template void QcepMaskData::showMaskRange< double > ( QSharedPointer< QcepImageData< T > >  image,
min,
max 
)

Definition at line 345 of file qcepmaskdata.cpp.

346 {
347  setMaskRange<T>(image, min, max, true, true);
348 }
void QcepMaskData::shrinkMask ( )
slot

Definition at line 123 of file qcepmaskdata.cpp.

References copyMask(), QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

124 {
125  QcepMaskDataPtr copy(copyMask(this));
126 
127  int height = get_Height();
128  int width = get_Width();
129 
130  for (int j=0; j<height; j++) {
131  for (int i=0; i<width; i++) {
132  short res = maskValue(i,j);
133  for (int ii=-1; ii<2; ii++) {
134  for (int jj=-1; jj<2; jj++) {
135  res = qMax(res, (short) copy->maskValue(i+ii, j+jj));
136  }
137  }
138  setMaskValue(i,j, res);
139  }
140  }
141 }
void setMaskValue(int x, int y, bool mval)
QcepMaskDataPtr copyMask(QcepObject *parent)
bool maskValue(int x, int y) const
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

QString QcepMaskData::summary ( )
slot

Definition at line 232 of file qcepmaskdata.cpp.

References QcepImageData< short >::m_Image.

233 {
234  QString res;
235 
236  int total = m_Image.count();
237  int totalSet = 0;
238 
239  for (int i=0; i<total; i++) {
240  if (m_Image[i]) {
241  totalSet++;
242  }
243  }
244 
245  return tr("%1/%2 pixels set").arg(totalSet).arg(total);
246 }
QVector< short > m_Image
QImage QcepMaskData::thumbnailImage ( ) const
slot

Definition at line 281 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), ThumbnailHeight, ThumbnailWidth, and QcepImageDataBase::width.

282 {
283  int height = get_Height();
284  int width = get_Width();
285  int th_height = ThumbnailHeight;
286  int th_width = ThumbnailWidth;
287  double sc_height = height/th_height;
288  double sc_width = width/th_width;
289  int threshold = sc_height*sc_width;
290  double scale = qMin(sc_height, sc_width);
291  th_width = width/scale;
292  th_height = height/scale;
293 
294  QImage res(th_width, th_height, QImage::Format_RGB32);
295 
296  for (int j=0; j<th_height; j++) {
297  for (int i=0; i<th_width; i++) {
298  int tot=0;
299  for (int jsc = 0; jsc<sc_height; jsc++) {
300  for (int isc = 0; isc<sc_width; isc++) {
301  if (maskValue(i*scale+isc, j*scale+jsc)) {
302  tot++;
303  }
304  }
305  }
306 
307  int val = tot*255/(threshold+1);
308 
309  res.setPixel(i,th_height-j-1, qRgb(255-val,0,0));
310  }
311  }
312 
313  return res;
314 }
bool maskValue(int x, int y) const

Here is the call graph for this function:

QSize QcepMaskData::thumbnailImageSize ( ) const
slot

Definition at line 316 of file qcepmaskdata.cpp.

References ThumbnailHeight, and ThumbnailWidth.

void QcepMaskData::xorMask ( QcepMaskDataPtr  mask)
slot

Definition at line 167 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

168 {
169  int height = get_Height();
170  int width = get_Width();
171 
172  for (int j=0; j<height; j++) {
173  for (int i=0; i<width; i++) {
174  setMaskValue(i,j, maskValue(i,j) ^ mask->maskValue(i,j));
175  }
176  }
177 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:

void QcepMaskData::xorNotMask ( QcepMaskDataPtr  mask)
slot

Definition at line 203 of file qcepmaskdata.cpp.

References QcepImageDataBase::height, maskValue(), setMaskValue(), and QcepImageDataBase::width.

204 {
205  int height = get_Height();
206  int width = get_Width();
207 
208  for (int j=0; j<height; j++) {
209  for (int i=0; i<width; i++) {
210  setMaskValue(i,j, maskValue(i,j) ^ !mask->maskValue(i,j));
211  }
212  }
213 }
short * mask()
void setMaskValue(int x, int y, bool mval)
bool maskValue(int x, int y) const

Here is the call graph for this function:


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