QXRD  0.11.16
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | Private Attributes | List of all members
QxrdDataProcessorBase Class Referenceabstract

#include <qxrddataprocessorbase.h>

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

Public Types

enum  { NoOverwrite, CanOverwrite }
 
enum  { ZingerNoMask = -2, ZingerDataMask = -1, ZingerTopStack = -1 }
 

Public Slots

void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void shutdown ()
 
void showMaskRange ()
 
void hideMaskRange ()
 
void showMaskRange (double min, double max)
 
void hideMaskRange (double min, double max)
 
void showMaskAll ()
 
void hideMaskAll ()
 
void invertMask ()
 
void growMask ()
 
void shrinkMask ()
 
void maskCircle (QRectF pt)
 
void maskPolygon (QVector< QPointF > poly)
 
void measurePolygon (QVector< QPointF > poly)
 
virtual void slicePolygon (QVector< QPointF > poly)=0
 
void printMeasuredPolygon (QVector< QPointF > poly)
 
void summarizeMeasuredPolygon (QVector< QPointF > poly)
 
virtual void integrateSaveAndDisplay ()=0
 
QString pwd () const
 
QStringList ls () const
 
QStringList ls (QString pattern) const
 
void loadData (QString name)
 
void saveData (QString name, int canOverwrite=NoOverwrite)
 
void saveData (QcepDataObjectPtr object, QString name, int canOverwrite=NoOverwrite)
 
void loadDark (QString name)
 
void saveDark (QString name, int canOverwrite=NoOverwrite)
 
void loadMask (QString name)
 
void saveMask (QString name, int canOverwrite=NoOverwrite)
 
void loadBadPixels (QString name)
 
void saveBadPixels (QString name, int canOverwrite=NoOverwrite)
 
void loadGainMap (QString name)
 
void saveGainMap (QString name, int canOverwrite=NoOverwrite)
 
void saveCachedGeometry (QString name)
 
void saveCachedIntensity (QString name)
 
void clearDark ()
 
void clearMask ()
 
void clearBadPixels ()
 
void clearGainMap ()
 
void subtractDark ()
 
void unsubtractDark ()
 
void multiplyData (double scalar)
 
void offsetData (double offset)
 
int maskStackSize ()
 
int maskStackPosition (int pos)
 
void newMaskStack ()
 
void pushMaskStack (QcepMaskDataPtr mask=QcepMaskDataPtr())
 
void popMaskStack (int amount=1)
 
void clearMaskStack ()
 
void clearMaskStackTop ()
 
void rollMaskStack (int amount)
 
void exchangeMaskStack (int pos)
 
void andMaskStack (int pos)
 
void orMaskStack (int pos)
 
void xorMaskStack (int pos)
 
void andNotMaskStack (int pos)
 
void orNotMaskStack (int pos)
 
void xorNotMaskStack (int pos)
 
void invertMaskStack (int pos)
 
void growMaskStack (int pos)
 
void shrinkMaskStack (int pos)
 
void hideMaskAllStack (int pos)
 
void showMaskAllStack (int pos)
 
void hideMaskRangeStack (int pos)
 
void showMaskRangeStack (int pos)
 
void findZingers ()
 
void newImage (int ncols, int nrows)
 
void exponentialTail (double cx, double cy, double width, int oversample)
 
void reciprocalTail (double cx, double cy, double strength, int oversample)
 
void powderRing (double cx, double cy, double radius, double width, double strength, int oversample)
 
void ellipse (double cx, double cy, double a, double e, double ang, double width, double strength, int oversample)
 
void updateEstimatedProcessingTime ()
 
void fileWriteTest (int dim, QString path)
 
int status (double delay)
 
void calculateROI ()
 
void calculateHistogram ()
 
void displayIntegratedData (QcepIntegratedDataPtr d)
 
void writeOutputScan (QcepIntegratedDataPtr d)
 
void newOutputScan (QString title)
 
void appendToOutputScan (double x, double y)
 
void plotOutputScan ()
 
void saveOutputScan (QString fileName)
 
QStringList integrateRectangle (int x0, int y0, int x1, int y1)
 
QString existingOutputDirectory (QString dir, QString subdir) const
 
QString filePathInExperimentDirectory (QString name) const
 
QString filePathInDataDirectory (QString name) const
 
QString filePathInDarkOutputDirectory (QString name) const
 
QString filePathInRawOutputDirectory (QString name) const
 
QString filePathInSubtractedOutputDirectory (QString name) const
 
QString filePathInIntegratedOutputDirectory (QString name) const
 
QString experimentDirectory () const
 
QString dataDirectory () const
 
QString darkOutputDirectory () const
 
QString rawOutputDirectory () const
 
QString subtractedOutputDirectory () const
 
QString integratedOutputDirectory () const
 
QcepDoubleImageDataPtr data () const
 
QcepDoubleImageDataPtr darkImage () const
 
QcepDoubleImageDataPtr gainMap () const
 
QcepDoubleImageDataPtr badPixels () const
 
QcepDoubleImageDataPtr liveData () const
 
QcepMaskDataPtr mask () const
 
QcepMaskDataPtr overflow () const
 
void newData (QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
 
- 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)
 

Signals

void newIntegrationAvailable (QcepIntegratedDataPtr data)
 

Public Member Functions

 QxrdDataProcessorBase (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QxrdAcquisitionWPtr acq, QxrdFileSaverWPtr filesaver)
 
virtual ~QxrdDataProcessorBase ()
 
void loadDefaultImages ()
 
QcepDoubleImageDataPtr takeNextFreeImage (int width, int height)
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
void setAcquisition (QxrdAcquisitionWPtr acq)
 
void setWindow (QxrdWindowWPtr win)
 
void createMaskIfNeeded ()
 
QxrdMaskStackPtr maskStack ()
 
QxrdExperimentPtr experiment () const
 
QxrdCenterFinderPtr centerFinder () const
 
QxrdIntegratorPtr integrator () const
 
QxrdPolarTransformPtr polarTransform () const
 
QxrdPolarNormalizationPtr polarNormalization () const
 
QxrdGenerateTestImageWPtr generateTestImage () const
 
QxrdDistortionCorrectionPtr distortionCorrection () const
 
void newMask ()
 
void updateEstimatedTime (QcepDoubleProperty *prop, int msec)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
QString get_Name () const
 
void set_Name (QString name)
 

Public Attributes

enum QxrdDataProcessorBase:: { ... }  ZingerConstants
 

Protected Member Functions

void saveNamedImageData (QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void saveNamedImageData (QString name, QcepInt16ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void saveNamedImageData (QString name, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void saveNamedRawImageData (QString name, QcepInt16ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void saveNamedRawImageData (QString name, QcepInt32ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void saveNamedMaskData (QString name, QcepMaskDataPtr mask, int canOverwrite=NoOverwrite)
 
void saveNamedImageDataAsText (QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
 
void writeOutputScan (QVector< double > x, QVector< double > y)
 
QcepDoubleImageDataPtr processAcquiredInt16Image (QcepDoubleImageDataPtr processed, QcepInt16ImageDataPtr image, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow)
 
QcepDoubleImageDataPtr processAcquiredInt32Image (QcepDoubleImageDataPtr processed, QcepInt32ImageDataPtr image, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow)
 
QcepDoubleImageDataPtr processAcquiredDoubleImage (QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow)
 
QcepDoubleImageDataPtr processAcquiredDoubleImage (QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v)
 
QcepDoubleImageDataPtr processAcquiredImage (QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr dimg, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v=QcepDoubleList())
 
void newDarkImage (QcepInt16ImageDataPtr image)
 
void newDarkImage (QcepInt32ImageDataPtr image)
 
double estimatedProcessingTime (double estSerTime, double estParallelTime)
 
void newDarkImage (QcepDoubleImageDataPtr image)
 
void newBadPixelsImage (QcepDoubleImageDataPtr image)
 
void newGainMapImage (QcepDoubleImageDataPtr image)
 
int newMaskWidth () const
 
int newMaskHeight () const
 
int incrementAcquiredCount ()
 
int decrementAcquiredCount ()
 
int getAcquiredCount ()
 
void subtractDarkImage (QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark)
 
void unsubtractDarkImage (QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark)
 
void correctBadPixels (QcepDoubleImageDataPtr image)
 
void correctImageGains (QcepDoubleImageDataPtr image)
 
void performImageCorrections (QcepDoubleImageDataPtr image)
 

Protected Attributes

QxrdExperimentWPtr m_Experiment
 
QcepSettingsSaverWPtr m_Saver
 
QxrdWindowWPtr m_Window
 
QxrdFileSaverWPtr m_FileSaver
 
QxrdAcquisitionWPtr m_Acquisition
 
QWaitCondition m_ProcessWaiting
 
QcepInt16ImageQueue m_AcquiredInt16Images
 
QcepInt32ImageQueue m_AcquiredInt32Images
 
QcepDoubleImageDataPtr m_Data
 
QcepDoubleImageDataPtr m_DarkFrame
 
QcepDoubleImageDataPtr m_BadPixels
 
QcepDoubleImageDataPtr m_GainMap
 
QcepDoubleImageDataPtr m_LiveData
 
QcepMaskDataPtr m_Overflow
 
QxrdMaskStack m_Masks
 
QAtomicInt m_AcquiredCount
 
QxrdCenterFinderPtr m_CenterFinder
 
QxrdIntegratorPtr m_Integrator
 
QxrdPolarTransformPtr m_PolarTransform
 
QxrdPolarNormalizationPtr m_PolarNormalization
 
QxrdGenerateTestImagePtr m_GenerateTestImage
 
QcepIntegratedDataPtr m_OutputScan
 
QxrdDistortionCorrectionPtr m_DistortionCorrection
 

Properties

QString fileName
 
QString dataPath
 
QString darkImagePath
 
QString badPixelsPath
 
QString gainMapPath
 
QString maskPath
 
QString scriptPath
 
bool performDarkSubtraction
 
bool saveRawImages
 
bool saveDarkImages
 
bool performBadPixels
 
bool performGainCorrection
 
bool saveSubtracted
 
bool saveAsText
 
QString saveAsTextSeparator
 
int saveAsTextPerLine
 
bool saveOverflowFiles
 
bool performIntegration
 
bool displayIntegratedData
 
bool saveIntegratedData
 
QString saveIntegratedPath
 
bool saveDarkInSubdirectory
 
QString saveDarkSubdirectory
 
bool saveRawInSubdirectory
 
QString saveRawSubdirectory
 
bool saveSubtractedInSubdirectory
 
QString saveSubtractedSubdirectory
 
bool saveIntegratedInSeparateFiles
 
bool saveIntegratedInSubdirectory
 
QString saveIntegratedSubdirectory
 
bool accumulateIntegrated2D
 
QString accumulateIntegratedName
 
QString accumulateIntegratedDirectory
 
QString accumulateIntegratedFileName
 
QString accumulateIntegratedFormat
 
double performDarkSubtractionTime
 
double performBadPixelsTime
 
double performGainCorrectionTime
 
double saveSubtractedTime
 
double saveAsTextTime
 
double performIntegrationTime
 
double displayIntegratedDataTime
 
double saveIntegratedDataTime
 
double estimatedProcessingTime
 
double averagingRatio
 
double maskMinimumValue
 
double maskMaximumValue
 
double maskCircleRadius
 
bool maskSetPixels
 
double average
 
double averageDark
 
double averageRaw
 
int correctionQueueLength
 
int integrationQueueLength
 
int saverQueueLength
 
int zingerAlgorithm
 
int zingerMask
 
int zingerDestination
 
int zingerSize1
 
int zingerSize2
 
double zingerThreshold
 
- Properties inherited from QcepObject
QString name
 

Private Attributes

QMutex m_Mutex
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Detailed Description

Definition at line 37 of file qxrddataprocessorbase.h.

Member Enumeration Documentation

anonymous enum
Enumerator
NoOverwrite 
CanOverwrite 

Definition at line 242 of file qxrddataprocessorbase.h.

anonymous enum
Enumerator
ZingerNoMask 
ZingerDataMask 
ZingerTopStack 

Definition at line 377 of file qxrddataprocessorbase.h.

Constructor & Destructor Documentation

QxrdDataProcessorBase::QxrdDataProcessorBase ( QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  doc,
QxrdAcquisitionWPtr  acq,
QxrdFileSaverWPtr  filesaver 
)

Definition at line 26 of file qxrddataprocessorbase.cpp.

References DEBUG_APP, DEBUG_CONSTRUCTORS, m_CenterFinder, m_DistortionCorrection, m_Experiment, m_GenerateTestImage, m_Integrator, m_PolarNormalization, m_PolarTransform, printMessage(), and qcepDebug().

30  :
31 
32  QcepObject("processor", NULL),
33 // m_OutputDirectory(saver, this,"outputDirectory", ""),
34  m_FileName(QcepSettingsSaverPtr(), this, "fileName","", "Current File Name"),
35  m_DataPath(saver, this,"dataPath", "", "Data Path"),
36  m_DarkImagePath(saver, this, "darkImagePath", "", "Dark Images Path"),
37  m_BadPixelsPath(saver, this, "badPixelsPath", "", "Bad Pixels Path"),
38  m_GainMapPath(saver, this, "gainMapPath", "", "Gain Map Path"),
39  m_MaskPath(saver, this, "maskPath", "", "Mask Path"),
40  m_ScriptPath(saver, this, "scriptPath", "", "Script Path"),
41  m_PerformDarkSubtraction(saver, this, "performDarkSubtraction", true, "Perform Dark Subtraction?"),
42  m_SaveRawImages(saver, this, "saveRawImages", true, "Save Raw Images?"),
43  m_SaveDarkImages(saver, this, "saveDarkImages", true, "Save Dark Images?"),
44  m_PerformBadPixels(saver, this, "performBadPixels", true, "Perform Bad Pixel Correction?"),
45  m_PerformGainCorrection(saver, this, "performGainCorrection", true, "Perform Gain Correction?"),
46  m_SaveSubtracted(saver, this, "saveSubtracted", true, "Save Dark Subtracted Data?"),
47  m_SaveAsText(saver, this, "saveAsText", false, "Save as Text Files (warning - Large and Slow!)"),
48  m_SaveAsTextSeparator(saver, this, "saveAsTextSeparator", " ", "Separator for Images Saved as Text"),
49  m_SaveAsTextPerLine(saver, this,"saveAsTextPerLine",16, "Pixels per line in Images Saved as Text"),
50  m_SaveOverflowFiles(saver, this,"saveOverflowFiles",0, "Save Overflow Pixel Files?"),
51  m_PerformIntegration(saver, this, "performIntegration", true, "Perform Circular Integration?"),
52  m_DisplayIntegratedData(saver, this, "displayIntegratedData", true, "Display Integrated Data?"),
53  m_SaveIntegratedData(saver, this, "saveIntegratedData", true, "Save Integrated Data?"),
54  m_SaveIntegratedPath(saver, this, "saveIntegratedPath", "", "Integrated Data Path"),
55  m_SaveDarkInSubdirectory(saver, this,"saveDarkInSubdirectory",0, "Save Dark In Subdirectory?"),
56  m_SaveDarkSubdirectory(saver, this,"saveDarkSubdirectory","", "Dark Subdirectory"),
57  m_SaveRawInSubdirectory(saver, this,"saveRawInSubdirectory",0, "Save Raw in Subdirectory?"),
58  m_SaveRawSubdirectory(saver, this,"saveRawSubdirectory","", "Raw Subdirectory"),
59  m_SaveSubtractedInSubdirectory(saver, this,"saveSubtractedInSubdirectory",0, "Save Subtracted in Subdirectory?"),
60  m_SaveSubtractedSubdirectory(saver, this,"saveSubtractedSubdirectory","", "Subtracted Subdirectory"),
61  m_SaveIntegratedInSeparateFiles(saver, this,"saveIntegratedInSeparateFiles",0, "Save Integrated in Separate Files?"),
62  m_SaveIntegratedInSubdirectory(saver, this,"saveIntegratedInSubdirectory",0, "Save Integrated in Subdirectory?"),
63  m_SaveIntegratedSubdirectory(saver, this,"saveIntegratedSubdirectory","", "Integrated Subdirectory"),
64  m_AccumulateIntegrated2D(saver, this, "accumulateIntegrated2D", 0, "Accumulate integrated data in 2-d dataset"),
65  m_AccumulateIntegratedName(saver, this, "accumulateIntegratedName", "/accumulated/2d-data", "Dataset to accumulate to"),
66  m_AccumulateIntegratedDirectory(saver, this, "accumulateIntegratedDirectory", "", "Accumulator save directory"),
67  m_AccumulateIntegratedFileName(saver, this, "accumulateIntegratedFileName", "", "Accumulator save file"),
68  m_AccumulateIntegratedFormat(saver, this, "accumulateIntegratedFormat", "", "Accumulator save format"),
69  m_PerformDarkSubtractionTime(saver, this, "performDarkSubtractionTime", 0.01, "Avg Time to Perform Dark Subtraction (in sec)"),
70  m_PerformBadPixelsTime(saver, this, "performBadPixelsTime", 0.01, "Avg Time to Perform Bad Pixel Correction (in sec)"),
71  m_PerformGainCorrectionTime(saver, this, "performGainCorrectionTime", 0.01, "Avg Time to Perform Gain Correction (in sec)"),
72  m_SaveSubtractedTime(saver, this, "saveSubtractedTime", 0.1, "Avg Time to Save Subtracted Data (in sec)"),
73  m_SaveAsTextTime(saver, this, "saveAsTextTime", 0.1, "Avg Time to Save Images as Text (in sec)"),
74  m_PerformIntegrationTime(saver, this, "performIntegrationTime", 0.05, "Avg Time to Perform Integration (in sec/core)"),
75  m_DisplayIntegratedDataTime(saver, this, "displayIntegratedDataTime", 0.2, "Avg Time to Display Integrated Data (in sec)"),
76  m_SaveIntegratedDataTime(saver, this, "saveIntegratedDataTime", 0.01, "Avg Time to Save Integrated Data (in sec)"),
77  m_EstimatedProcessingTime(saver, this, "estimatedProcessingTime", 0.1, "Overall Estimated Processing Time (in sec/image)"),
78  m_AveragingRatio(saver, this, "averagingRatio", 0.1, "Averaging Ratio for Estimated Timing"),
79  m_MaskMinimumValue(saver, this, "maskMinimumValue", 0, "Mask Minimum Value"),
80  m_MaskMaximumValue(saver, this, "maskMaximumValue", 20000, "Mask Maximum Value"),
81  m_MaskCircleRadius(saver, this, "maskCircleRadius", 10, "Mask Circle Radius"),
82  m_MaskSetPixels(saver, this, "maskSetPixels", true, "Mask Set Pixels"),
83 // m_CompressImages(saver, this, "compressImages", false, "Compress Images"),
84  m_Average(QcepSettingsSaverPtr(), this,"average",0.0, "Average Value of Acquired Image (per exposure)"),
85  m_AverageDark(QcepSettingsSaverPtr(), this,"averageDark",0.0, "Average Value of Dark Image"),
86  m_AverageRaw(QcepSettingsSaverPtr(), this,"averageRaw",0.0, "Average Value of Raw Image"),
87  m_CorrectionQueueLength(QcepSettingsSaverPtr(), this, "correctionQueueLength", 0, "Image correction backlog"),
88  m_IntegrationQueueLength(QcepSettingsSaverPtr(), this, "integrationQueueLength", 0, "Image integration backlog"),
89  m_SaverQueueLength(QcepSettingsSaverPtr(), this, "saverQueueLength", 0, "Data saving backlog"),
90  m_ZingerAlgorithm(saver, this, "zingerAlgorithm", 0, "Zinger Detection Algorithm"),
91  m_ZingerMask(saver, this, "zingerMask", 0, "Zinger Mask Source"),
92  m_ZingerDestination(saver, this, "zingerDestination", -1, "Zinger Destination"),
93  m_ZingerSize1(saver, this, "zingerSize1", 1, "Inner Zinger Search Box Size"),
94  m_ZingerSize2(saver, this, "zingerSize2", 5, "Outer Zinger Search Box Size"),
95  m_ZingerThreshold(saver, this, "zingerThreshold", 2.5, "Zinger Detection Threshold"),
96  m_Mutex(QMutex::Recursive),
97  m_Experiment(doc),
98  m_Saver(saver),
99  m_Window(),
100  m_FileSaver(filesaver),
101  m_Acquisition(acq),
102  m_AcquiredInt16Images("acquiredInt16Images"),
103  m_AcquiredInt32Images("acquiredInt32Images"),
105  m_DarkFrame(NULL),
106  m_BadPixels(NULL),
107  m_GainMap(NULL),
108  // m_Mask(allocator -> newMask()),
109  m_AcquiredCount(0),
110  m_CenterFinder(NULL),
111  m_Integrator(NULL),
112  m_PolarTransform(NULL),
113  m_PolarNormalization(NULL),
114  m_GenerateTestImage(NULL)
115 {
116 // m_SaverQueueLength.setDebug(1);
117 // m_IntegrationQueueLength.setDebug(1);
118 // m_CorrectionQueueLength.setDebug(1);
119 
121  printf("QxrdDataProcessorBase::QxrdDataProcessorBase(%p)\n", this);
122  }
123 
124  if (qcepDebug(DEBUG_APP)) {
125  printMessage("QxrdDataProcessorBase::QxrdDataProcessorBase");
126  }
127 
132 
133 // m_Integrator->initialize(m_Integrator);
134 
136 
138 
139 }
QSharedPointer< QxrdCenterFinder > QxrdCenterFinderPtr
QcepDoubleImageDataPtr m_BadPixels
QcepInt32ImageQueue m_AcquiredInt32Images
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepDoubleImageDataPtr m_GainMap
QxrdPolarNormalizationPtr m_PolarNormalization
QxrdCenterFinderPtr m_CenterFinder
QxrdAcquisitionWPtr m_Acquisition
QcepInt16ImageQueue m_AcquiredInt16Images
QxrdGenerateTestImagePtr m_GenerateTestImage
QcepDoubleImageDataPtr m_DarkFrame
static QcepDoubleImageDataPtr newDoubleImage(AllocationStrategy strat, int width, int height, QcepObject *parent)
QSharedPointer< QxrdPolarTransform > QxrdPolarTransformPtr
QSharedPointer< QxrdGenerateTestImage > QxrdGenerateTestImagePtr
QSharedPointer< QxrdPolarNormalization > QxrdPolarNormalizationPtr
QxrdExperimentWPtr m_Experiment
QcepDoubleImageDataPtr m_Data
QSharedPointer< QxrdIntegrator > QxrdIntegratorPtr
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
QcepObject(QString name, QcepObject *parent)
Definition: qcepobject.cpp:16
QxrdIntegratorPtr m_Integrator
QxrdPolarTransformPtr m_PolarTransform
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QxrdDistortionCorrectionPtr m_DistortionCorrection
QxrdFileSaverWPtr m_FileSaver
QcepSettingsSaverWPtr m_Saver
QSharedPointer< QxrdDistortionCorrection > QxrdDistortionCorrectionPtr

Here is the call graph for this function:

QxrdDataProcessorBase::~QxrdDataProcessorBase ( )
virtual

Definition at line 141 of file qxrddataprocessorbase.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

142 {
143 #ifndef QT_NO_DEBUG
144  printf("Deleting processor\n");
145 #endif
146 
148  printf("QxrdDataProcessorBase::~QxrdDataProcessorBase(%p)\n", this);
149  }
150 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdDataProcessorBase::andMaskStack ( int  pos)
slot

Definition at line 922 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, maskStackPosition(), and newMask().

923 {
924  int p0 = maskStackPosition(0);
925  int p1 = maskStackPosition(pos);
926 
927  if ((p0 >= 0) && (p1 >= 0)) {
928  QcepMaskDataPtr pm = m_Masks[p1];
929 
930  m_Masks[p0] -> andMask(pm);
931 
932  m_Masks.changed();
933 
934  newMask();
935  }
936 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::andNotMaskStack ( int  pos)
slot

Definition at line 970 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, maskStackPosition(), and newMask().

971 {
972  int p0 = maskStackPosition(0);
973  int p1 = maskStackPosition(pos);
974 
975  if ((p0 >= 0) && (p1 >= 0)) {
976  QcepMaskDataPtr pm = m_Masks[p1];
977 
978  m_Masks[p0] -> andNotMask(pm);
979 
980  m_Masks.changed();
981 
982  newMask();
983  }
984 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::appendToOutputScan ( double  x,
double  y 
)
slot

Definition at line 2228 of file qxrddataprocessorbase.cpp.

References m_OutputScan.

2229 {
2230  if (m_OutputScan) {
2231  m_OutputScan->append(x,y);
2232  }
2233 }
QcepIntegratedDataPtr m_OutputScan
QcepDoubleImageDataPtr QxrdDataProcessorBase::badPixels ( ) const
slot

Definition at line 1841 of file qxrddataprocessorbase.cpp.

References m_BadPixels.

1842 {
1843  return m_BadPixels;
1844 }
QcepDoubleImageDataPtr m_BadPixels
void QxrdDataProcessorBase::calculateHistogram ( )
slot

Definition at line 2178 of file qxrddataprocessorbase.cpp.

References data(), m_Data, mask(), and printMessage().

Referenced by QxrdWindow::initialize(), and QxrdDataProcessorThreaded::onCorrectedImageAvailable().

2179 {
2180  QTime tic;
2181  tic.start();
2182 
2183  if (m_Data && mask()) {
2184  double *res = new double[65536];
2185  long npixels = m_Data -> get_Height() * m_Data -> get_Width();
2186  double *data = m_Data -> data();
2187  short *maskp = mask() -> data();
2188 
2189  double minVal = *data;
2190  double maxVal = minVal;
2191 
2192  for (long i=0; i<npixels; i++) {
2193  double v = data[i];
2194  if (v < minVal) minVal = v;
2195  if (v > maxVal) maxVal = v;
2196  }
2197 
2198  for (int i=0; i<65536; i++) {
2199  res[i] = 0;
2200  }
2201 
2202  for (long i=0; i<npixels; i++) {
2203  double v = data[i];
2204  short bin = maskp[i];
2205  res[bin] += v;
2206  }
2207 
2208  int dt = tic.restart();
2209 
2210  printMessage(tr("Histogram calculated in %1 msec").arg(dt));
2211 
2212  delete [] res;
2213  }
2214 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr data() const
QcepDoubleImageDataPtr m_Data
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::calculateROI ( )
slot

Definition at line 2148 of file qxrddataprocessorbase.cpp.

References data(), m_Data, mask(), and printMessage().

Referenced by QxrdWindow::initialize(), and QxrdDataProcessorThreaded::onCorrectedImageAvailable().

2149 {
2150  QTime tic;
2151  tic.start();
2152 
2153  if (m_Data && mask()) {
2154  double *res = new double[65536];
2155  long npixels = (m_Data -> get_Height()) * (m_Data -> get_Width());
2156  double *data = m_Data -> data();
2157  short *maskp = mask() -> data();
2158 
2159  for (int i=0; i<65536; i++) {
2160  res[i] = 0;
2161  }
2162 
2163  for (long i=0; i<npixels; i++) {
2164  double v = data[i];
2165  short bin = maskp[i];
2166  bin &= 255;
2167  res[bin] += v;
2168  }
2169 
2170  int dt = tic.restart();
2171 
2172  printMessage(tr("ROI calculated in %1 msec").arg(dt));
2173 
2174  delete [] res;
2175  }
2176 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr data() const
QcepDoubleImageDataPtr m_Data
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdCenterFinderPtr QxrdDataProcessorBase::centerFinder ( ) const

Definition at line 1918 of file qxrddataprocessorbase.cpp.

References m_CenterFinder, and printMessage().

Referenced by QxrdDataProcessorThreaded::fitPeakNear(), QxrdDataProcessorThreaded::integrateData(), and QxrdDataProcessorThreaded::onCorrectedImageAvailable().

1919 {
1920  if (m_CenterFinder == NULL) {
1921  printMessage("Problem QxrdDataProcessorBase::centerFinder == NULL");
1922  }
1923 
1924  return m_CenterFinder;
1925 }
QxrdCenterFinderPtr m_CenterFinder
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::clearBadPixels ( )
slot

Definition at line 1234 of file qxrddataprocessorbase.cpp.

References newBadPixelsImage().

1235 {
1237 
1238  set_BadPixelsPath("");
1239 }
void newBadPixelsImage(QcepDoubleImageDataPtr image)
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::clearDark ( )
slot

Definition at line 1227 of file qxrddataprocessorbase.cpp.

References newDarkImage().

1228 {
1230 
1231  set_DarkImagePath("");
1232 }
void newDarkImage(QcepInt16ImageDataPtr image)
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::clearGainMap ( )
slot

Definition at line 1241 of file qxrddataprocessorbase.cpp.

References newGainMapImage().

1242 {
1244 
1245  set_GainMapPath("");
1246 }
void newGainMapImage(QcepDoubleImageDataPtr image)
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::clearMask ( )
slot

Definition at line 1157 of file qxrddataprocessorbase.cpp.

References clearMaskStack().

1158 {
1159  clearMaskStack();
1160 
1161  set_MaskPath("");
1162 }

Here is the call graph for this function:

void QxrdDataProcessorBase::clearMaskStack ( )
slot

Definition at line 865 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, and newMask().

Referenced by clearMask().

866 {
867  m_Masks.clear();
868 
869  m_Masks.changed();
870 
871  newMask();
872 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::clearMaskStackTop ( )
slot

Definition at line 874 of file qxrddataprocessorbase.cpp.

References popMaskStack().

875 {
876  popMaskStack();
877 }
void popMaskStack(int amount=1)

Here is the call graph for this function:

void QxrdDataProcessorBase::correctBadPixels ( QcepDoubleImageDataPtr  image)
protected

Definition at line 1554 of file qxrddataprocessorbase.cpp.

Referenced by processAcquiredImage().

1555 {
1556 }

Here is the caller graph for this function:

void QxrdDataProcessorBase::correctImageGains ( QcepDoubleImageDataPtr  image)
protected

Definition at line 1558 of file qxrddataprocessorbase.cpp.

References gainMap().

Referenced by processAcquiredImage().

1559 {
1560  if (image) {
1561  QcepDoubleImageDataPtr gains = gainMap();
1562 
1563  if (gains) {
1564  image -> multiply(gains);
1565  }
1566  }
1567 }
QcepDoubleImageDataPtr gainMap() const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::createMaskIfNeeded ( )

Definition at line 1860 of file qxrddataprocessorbase.cpp.

References m_Masks, and newMaskStack().

Referenced by growMask(), hideMaskAll(), hideMaskRange(), maskCircle(), maskPolygon(), showMaskAll(), showMaskRange(), and shrinkMask().

1861 {
1862  if (m_Masks.isEmpty()) {
1863  newMaskStack();
1864  }
1865 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::criticalMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 235 of file qxrddataprocessorbase.cpp.

References m_Experiment.

236 {
238 
239  if (exp) {
240  exp->criticalMessage(msg, ts);
241  }
242 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QcepDoubleImageDataPtr QxrdDataProcessorBase::darkImage ( ) const
slot
QString QxrdDataProcessorBase::darkOutputDirectory ( ) const
slot

Definition at line 295 of file qxrddataprocessorbase.cpp.

References dataDirectory(), and existingOutputDirectory().

Referenced by filePathInDarkOutputDirectory().

296 {
297  if (get_SaveDarkInSubdirectory()) {
298  return existingOutputDirectory(dataDirectory(), get_SaveDarkSubdirectory());
299  } else {
300  return dataDirectory();
301  }
302 }
QString existingOutputDirectory(QString dir, QString subdir) const

Here is the call graph for this function:

Here is the caller graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::data ( ) const
slot
QString QxrdDataProcessorBase::dataDirectory ( ) const
slot

Definition at line 279 of file qxrddataprocessorbase.cpp.

References m_Experiment.

Referenced by darkOutputDirectory(), filePathInDataDirectory(), QxrdDataProcessorThreaded::fixupBadBackgroundSubtraction(), integratedOutputDirectory(), ls(), pwd(), rawOutputDirectory(), and subtractedOutputDirectory().

280 {
282 
283  if (exp) {
284  return QDir(exp->get_ExperimentDirectory()).filePath(exp->get_DataDirectory());
285  } else {
286  return QString();
287  }
288 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

int QxrdDataProcessorBase::decrementAcquiredCount ( )
protected

Definition at line 1877 of file qxrddataprocessorbase.cpp.

References m_AcquiredCount, and m_ProcessWaiting.

1878 {
1879  int res = m_AcquiredCount.fetchAndAddOrdered(-1) - 1;
1880 
1881  if (res == 0) {
1882  m_ProcessWaiting.wakeAll();
1883  }
1884 
1885  return res;
1886 }
void QxrdDataProcessorBase::displayIntegratedData ( QcepIntegratedDataPtr  d)
slot

Definition at line 2112 of file qxrddataprocessorbase.cpp.

References newIntegrationAvailable().

2113 {
2114  if (this->get_DisplayIntegratedData()) {
2116  }
2117 }
void newIntegrationAvailable(QcepIntegratedDataPtr data)
QcepDoubleImageDataPtr data() const
QxrdDistortionCorrectionPtr QxrdDataProcessorBase::distortionCorrection ( ) const

Definition at line 1954 of file qxrddataprocessorbase.cpp.

References m_DistortionCorrection, and printMessage().

1955 {
1956  if (m_DistortionCorrection == NULL) {
1957  printMessage("Problem QxrdDataProcessorBase::distortion == NULL");
1958  }
1959 
1960  return m_DistortionCorrection;
1961 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QxrdDistortionCorrectionPtr m_DistortionCorrection

Here is the call graph for this function:

void QxrdDataProcessorBase::ellipse ( double  cx,
double  cy,
double  a,
double  e,
double  ang,
double  width,
double  strength,
int  oversample 
)
slot

Definition at line 2058 of file qxrddataprocessorbase.cpp.

References m_Data, and newData().

2059 {
2060  int nr = m_Data -> get_Height();
2061  int nc = m_Data -> get_Width();
2062 
2063  for (int y=0; y<nr; y++) {
2064  for (int x=0; x<nc; x++) {
2065  double sum = 0;
2066 
2067  for (int iy = 0; iy < oversample; iy++) {
2068  double yy = (double) y + ((double) iy)/((double) oversample) - cy;
2069  double yy2 = yy*yy;
2070  for (int ix = 0; ix < oversample; ix++) {
2071  double xx = (double) x + ((double) ix)/((double) oversample) - cx;
2072  double xx2 = xx*xx;
2073  double r = sqrt(yy2 + xx2);
2074  double th = atan2(yy,xx);
2075  double elr = a*(1-e*e)/(1 - e*cos(th - ang));
2076  double ndr = (elr - r)/width;
2077 
2078  if (fabs(ndr) < 6) {
2079  double val = strength*exp(-2*ndr*ndr)/width*sqrt(2.0/M_PI);
2080  sum += val;
2081  }
2082  }
2083  }
2084 
2085  m_Data -> setValue(x, y, m_Data -> value(x,y) + sum/(oversample*oversample));
2086  }
2087  }
2088 
2090 }
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

double QxrdDataProcessorBase::estimatedProcessingTime ( double  estSerTime,
double  estParallelTime 
)
protected

Definition at line 1618 of file qxrddataprocessorbase.cpp.

1619 {
1620  return estSerialTime + estParallelTime;
1621 }
void QxrdDataProcessorBase::exchangeMaskStack ( int  pos)
slot

Definition at line 906 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, maskStackPosition(), and newMask().

907 {
908  int p0 = maskStackPosition(0);
909  int p1 = maskStackPosition(pos);
910 
911  if ((p0 >= 0) && (p1 >= 0) && (p0 != p1)) {
912  QcepMaskDataPtr pm=m_Masks[p0];
913  m_Masks[p0] = m_Masks[p1];
914  m_Masks[p1] = pm;
915 
916  m_Masks.changed();
917 
918  newMask();
919  }
920 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

QString QxrdDataProcessorBase::existingOutputDirectory ( QString  dir,
QString  subdir 
) const
slot

Definition at line 253 of file qxrddataprocessorbase.cpp.

Referenced by darkOutputDirectory(), integratedOutputDirectory(), rawOutputDirectory(), and subtractedOutputDirectory().

254 {
255  return QDir(dir).filePath(subdir);
256 }

Here is the caller graph for this function:

QxrdExperimentPtr QxrdDataProcessorBase::experiment ( ) const

Definition at line 1909 of file qxrddataprocessorbase.cpp.

References m_Experiment, and printMessage().

1910 {
1911  if (m_Experiment == NULL) {
1912  printMessage("Problem: QxrdDataProcessorBase::experiment == NULL");
1913  }
1914 
1915  return m_Experiment;
1916 }
QxrdExperimentWPtr m_Experiment
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

QString QxrdDataProcessorBase::experimentDirectory ( ) const
slot

Definition at line 263 of file qxrddataprocessorbase.cpp.

References m_Experiment.

Referenced by filePathInExperimentDirectory().

264 {
266 
267  if (exp) {
268  return exp->get_ExperimentDirectory();
269  } else {
270  return QString();
271  }
272 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

void QxrdDataProcessorBase::exponentialTail ( double  cx,
double  cy,
double  width,
int  oversample 
)
slot

Definition at line 1971 of file qxrddataprocessorbase.cpp.

References m_Data, and newData().

1972 {
1973  int nr = m_Data -> get_Height();
1974  int nc = m_Data -> get_Width();
1975 
1976  for (int y=0; y<nr; y++) {
1977  for (int x=0; x<nc; x++) {
1978  double sum = 0;
1979 
1980  for (int iy = 0; iy < oversample; iy++) {
1981  double yy = (double) y + ((double) iy)/((double) oversample) - cy;
1982  double yy2 = yy*yy;
1983  for (int ix = 0; ix < oversample; ix++) {
1984  double xx = (double) x + ((double) ix)/((double) oversample) - cx;
1985  double xx2 = xx*xx;
1986  double r = sqrt(yy2 + xx2);
1987  sum += exp(-r/width);
1988  }
1989  }
1990 
1991  m_Data -> setValue(x, y, m_Data -> value(x,y) + sum/(oversample*oversample));
1992  }
1993  }
1994 
1996 }
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

QString QxrdDataProcessorBase::filePathInDarkOutputDirectory ( QString  name) const
slot

Definition at line 290 of file qxrddataprocessorbase.cpp.

References darkOutputDirectory().

291 {
292  return QDir(darkOutputDirectory()).filePath(name);
293 }
QString name
Definition: qcepobject.h:49
QString darkOutputDirectory() const

Here is the call graph for this function:

QString QxrdDataProcessorBase::filePathInDataDirectory ( QString  name) const
slot
QString QxrdDataProcessorBase::filePathInExperimentDirectory ( QString  name) const
slot

Definition at line 258 of file qxrddataprocessorbase.cpp.

References experimentDirectory().

259 {
260  return QDir(experimentDirectory()).filePath(name);
261 }
QString experimentDirectory() const
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

QString QxrdDataProcessorBase::filePathInIntegratedOutputDirectory ( QString  name) const
slot

Definition at line 332 of file qxrddataprocessorbase.cpp.

References integratedOutputDirectory().

333 {
334  return QDir(integratedOutputDirectory()).filePath(name);
335 }
QString name
Definition: qcepobject.h:49
QString integratedOutputDirectory() const

Here is the call graph for this function:

QString QxrdDataProcessorBase::filePathInRawOutputDirectory ( QString  name) const
slot

Definition at line 304 of file qxrddataprocessorbase.cpp.

References rawOutputDirectory().

305 {
306  return QDir(rawOutputDirectory()).filePath(name);
307 }
QString rawOutputDirectory() const
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

QString QxrdDataProcessorBase::filePathInSubtractedOutputDirectory ( QString  name) const
slot

Definition at line 318 of file qxrddataprocessorbase.cpp.

References subtractedOutputDirectory().

319 {
320  return QDir(subtractedOutputDirectory()).filePath(name);
321 }
QString subtractedOutputDirectory() const
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

void QxrdDataProcessorBase::fileWriteTest ( int  dim,
QString  path 
)
slot

Definition at line 2119 of file qxrddataprocessorbase.cpp.

References fileName, and printMessage().

2120 {
2121  long sz = dim*dim;
2122  quint32 *buff = new quint32[sz];
2123 
2124  QTime tic;
2125  tic.start();
2126  int totalt = 0;
2127 
2128  for (int i=0; i<10; i++) {
2129  QString fileName = path+tr("%1.junk").arg(i,5,10,QChar('0'));
2130 
2131  FILE *f = fopen(qPrintable(fileName), "w");
2132 
2133  if (f) {
2134  fwrite(buff, sz, sizeof(quint32), f);
2135  fclose(f);
2136 
2137  int dt = tic.restart();
2138  totalt += dt;
2139  printMessage(tr("file %1 written in %2 msec").arg(fileName).arg(dt));
2140  }
2141  }
2142 
2143  printMessage(tr("average write speed %1 MB/sec")
2144  .arg(((double) sz)*40.0*1000.0/(1e6*((double) totalt))));
2145  delete [] buff;
2146 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

void QxrdDataProcessorBase::findZingers ( )
slot

Definition at line 2339 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Data, m_Masks, mask(), maskStack(), QcepAllocator::newMask(), newMask(), pushMaskStack(), QcepAllocator::WaitTillAvailable, ZingerDataMask, and ZingerNoMask.

2340 {
2342  QxrdMaskStackPtr masks = maskStack();
2343 
2344  if (get_ZingerMask() == ZingerNoMask) {
2345  mask = QcepMaskDataPtr();
2346  } else if (get_ZingerMask() == ZingerDataMask && m_Data) {
2347  mask = m_Data->mask();
2348  } else if (masks) {
2349  mask = masks->value(get_ZingerMask());
2350  }
2351 
2352  int wid = m_Data->get_Width();
2353  int ht = m_Data->get_Height();
2354  int sz1 = get_ZingerSize1();
2355  int sz2 = get_ZingerSize2();
2356  double thr = get_ZingerThreshold();
2357 
2358  QcepMaskDataPtr dest
2360 
2361  for (int y=0; y<ht; y++) {
2362  for (int x=0; x<wid; x++) {
2363  if (mask==NULL || mask->value(x,y)) {
2364  double sum = 0, n = 0;
2365  double val = 0;
2366 
2367  for (int dy=-sz2; dy<=sz2; dy++) {
2368  for (int dx=-sz2; dx<=sz2; dx++) {
2369  if (mask==NULL || mask->value(x+dx, y+dy)) {
2370  if (dx == 0 && dy == 0) {
2371  val = m_Data->value(x+dx, y+dy);
2372  } else {
2373  sum += m_Data->value(x+dx, y+dy);
2374  n += 1;
2375  }
2376  }
2377  }
2378  }
2379 
2380  if (n > 0 && fabs(val-sum/n) >= thr) {
2381  dest->setValue(x,y,0);
2382  }
2383  }
2384  }
2385  }
2386 
2387  if (sz1 > 0) {
2388  for (int i=0; i<sz1; i++) {
2389  dest->growMask();
2390  }
2391  }
2392 
2393  if (mask) {
2394  for (int y=0; y<ht; y++) {
2395  for (int x=0; x<wid; x++) {
2396  if (mask->value(x,y) == 0) {
2397  dest->setValue(x,y,0);
2398  }
2399  }
2400  }
2401  }
2402 
2403  pushMaskStack(dest);
2404  m_Masks.changed();
2405  newMask();
2406 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr m_Data
void pushMaskStack(QcepMaskDataPtr mask=QcepMaskDataPtr())
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::gainMap ( ) const
slot

Definition at line 1836 of file qxrddataprocessorbase.cpp.

References m_GainMap.

Referenced by correctImageGains().

1837 {
1838  return m_GainMap;
1839 }
QcepDoubleImageDataPtr m_GainMap

Here is the caller graph for this function:

QxrdGenerateTestImageWPtr QxrdDataProcessorBase::generateTestImage ( ) const

Definition at line 2216 of file qxrddataprocessorbase.cpp.

References m_GenerateTestImage.

2217 {
2218  return m_GenerateTestImage;
2219 }
QxrdGenerateTestImagePtr m_GenerateTestImage
int QxrdDataProcessorBase::getAcquiredCount ( )
protected

Definition at line 1888 of file qxrddataprocessorbase.cpp.

References m_AcquiredCount.

Referenced by processAcquiredImage(), processAcquiredInt16Image(), processAcquiredInt32Image(), and status().

1889 {
1890  return m_AcquiredCount.fetchAndAddOrdered(0);
1891 }

Here is the caller graph for this function:

void QxrdDataProcessorBase::growMask ( )
slot

Definition at line 1693 of file qxrddataprocessorbase.cpp.

References createMaskIfNeeded(), mask(), and newMask().

Referenced by growMaskStack().

1694 {
1696 
1697  if (mask()) {
1698  mask() -> growMask();
1699 
1700  newMask();
1701  }
1702 }
QcepMaskDataPtr mask() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::growMaskStack ( int  pos)
slot

Definition at line 1031 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), growMask(), m_Masks, maskStackPosition(), and newMask().

1032 {
1033  int p = maskStackPosition(pos);
1034 
1035  if (p >= 0) {
1036  m_Masks[p] -> growMask();
1037 
1038  m_Masks.changed();
1039 
1040  newMask();
1041  }
1042 }

Here is the call graph for this function:

void QxrdDataProcessorBase::hideMaskAll ( )
slot

Definition at line 1642 of file qxrddataprocessorbase.cpp.

References createMaskIfNeeded(), mask(), and newMask().

Referenced by hideMaskAllStack(), and QxrdWindow::initialize().

1643 {
1645 
1646  if (mask()) {
1647  mask() -> hideMaskAll();
1648 
1649  newMask();
1650  }
1651 }
QcepMaskDataPtr mask() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::hideMaskAllStack ( int  pos)
slot

Definition at line 1057 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), hideMaskAll(), m_Masks, maskStackPosition(), and newMask().

1058 {
1059  int p = maskStackPosition(pos);
1060 
1061  if (p >= 0) {
1062  m_Masks[p] -> hideMaskAll();
1063 
1064  m_Masks.changed();
1065 
1066  newMask();
1067  }
1068 }

Here is the call graph for this function:

void QxrdDataProcessorBase::hideMaskRange ( )
slot

Definition at line 1664 of file qxrddataprocessorbase.cpp.

Referenced by hideMaskRange(), hideMaskRangeStack(), and QxrdWindow::initialize().

1665 {
1666  double min = get_MaskMinimumValue();
1667  double max = get_MaskMaximumValue();
1668 
1669  hideMaskRange(min, max);
1670 }

Here is the caller graph for this function:

void QxrdDataProcessorBase::hideMaskRange ( double  min,
double  max 
)
slot

Definition at line 1672 of file qxrddataprocessorbase.cpp.

References createMaskIfNeeded(), hideMaskRange(), m_Data, mask(), and newMask().

1673 {
1675 
1676 
1677  if (m_Data && mask()) {
1678  mask() -> hideMaskRange(QSharedPointer< QcepImageData<double> >(m_Data), min, max);
1679 
1680  newMask();
1681  }
1682 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr m_Data

Here is the call graph for this function:

void QxrdDataProcessorBase::hideMaskRangeStack ( int  pos)
slot

Definition at line 1083 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), hideMaskRange(), m_Data, m_Masks, maskStackPosition(), and newMask().

1084 {
1085  int p = maskStackPosition(pos);
1086 
1087  double min = get_MaskMinimumValue();
1088  double max = get_MaskMaximumValue();
1089 
1090  if (m_Data && p >= 0) {
1091  m_Masks[p] -> hideMaskRange(QSharedPointer< QcepImageData<double> >(m_Data), min, max);
1092 
1093  m_Masks.changed();
1094 
1095  newMask();
1096  }
1097 }
QcepDoubleImageDataPtr m_Data

Here is the call graph for this function:

int QxrdDataProcessorBase::incrementAcquiredCount ( )
protected

Definition at line 1872 of file qxrddataprocessorbase.cpp.

References m_AcquiredCount.

1873 {
1874  return m_AcquiredCount.fetchAndAddOrdered(+1) + 1;
1875 }
QString QxrdDataProcessorBase::integratedOutputDirectory ( ) const
slot

Definition at line 337 of file qxrddataprocessorbase.cpp.

References dataDirectory(), and existingOutputDirectory().

Referenced by filePathInIntegratedOutputDirectory(), and writeOutputScan().

338 {
339  if (get_SaveIntegratedInSubdirectory()) {
340  return existingOutputDirectory(dataDirectory(), get_SaveIntegratedSubdirectory());
341  } else {
342  return dataDirectory();
343  }
344 }
QString existingOutputDirectory(QString dir, QString subdir) const

Here is the call graph for this function:

Here is the caller graph for this function:

QStringList QxrdDataProcessorBase::integrateRectangle ( int  x0,
int  y0,
int  x1,
int  y1 
)
slot

Definition at line 2249 of file qxrddataprocessorbase.cpp.

References m_Data, mask(), and printMessage().

2250 {
2251  double sum = 0;
2252  double npx = 0;
2253 
2255  QcepMaskDataPtr msk = mask();
2256  QStringList res;
2257 
2258  if (dat) {
2259  if (msk) {
2260  for (int y=y0; y<y1; y++) {
2261  for (int x=x0; x<x1; x++) {
2262  if (msk->value(x,y)) {
2263  sum += dat->value(x,y);
2264  npx += 1;
2265  }
2266  }
2267  }
2268  } else {
2269  for (int y=y0; y<y1; y++) {
2270  for (int x=x0; x<x1; x++) {
2271  sum += dat->value(x,y);
2272  npx += 1;
2273  }
2274  }
2275  }
2276 
2277  printMessage(tr("integrateRectange(\"%1\",%2,%3,%4,%5)=[%6,%7]=%8")
2278  .arg(dat->get_FileName())
2279  .arg(x0).arg(y0).arg(x1).arg(y1).arg(sum).arg(npx).arg(sum/npx));
2280 
2281  if (npx > 0) {
2282  res << tr("%1").arg(sum/npx);
2283  } else {
2284  res << "0";
2285  }
2286 
2287  res << tr("%1").arg(sum);
2288  res << tr("%1").arg(npx);
2289  res << dat->get_FileName();
2290  }
2291 
2292  return res;
2293 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr m_Data
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

virtual void QxrdDataProcessorBase::integrateSaveAndDisplay ( )
pure virtualslot
QxrdIntegratorPtr QxrdDataProcessorBase::integrator ( ) const

Definition at line 1927 of file qxrddataprocessorbase.cpp.

References m_Integrator, and printMessage().

1928 {
1929  if (m_Integrator == NULL) {
1930  printMessage("Problem QxrdDataProcessorBase::integrator == NULL");
1931  }
1932 
1933  return m_Integrator;
1934 }
QxrdIntegratorPtr m_Integrator
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

void QxrdDataProcessorBase::invertMask ( )
slot

Definition at line 1684 of file qxrddataprocessorbase.cpp.

References mask(), and newMask().

Referenced by QxrdWindow::initialize(), and invertMaskStack().

1685 {
1686  if (mask()) {
1687  mask() -> invertMask();
1688 
1689  newMask();
1690  }
1691 }
QcepMaskDataPtr mask() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::invertMaskStack ( int  pos)
slot

Definition at line 1018 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), invertMask(), m_Masks, maskStackPosition(), and newMask().

1019 {
1020  int p = maskStackPosition(pos);
1021 
1022  if (p >= 0) {
1023  m_Masks[p] -> invertMask();
1024 
1025  m_Masks.changed();
1026 
1027  newMask();
1028  }
1029 }

Here is the call graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::liveData ( ) const
slot

Definition at line 1846 of file qxrddataprocessorbase.cpp.

References m_LiveData.

1847 {
1848  return m_LiveData;
1849 }
QcepDoubleImageDataPtr m_LiveData
void QxrdDataProcessorBase::loadBadPixels ( QString  name)
slot

Definition at line 655 of file qxrddataprocessorbase.cpp.

References QcepImageDataBase::BadPixelsData, DEBUG_FILES, filePathInDataDirectory(), newBadPixelsImage(), printMessage(), qcepDebug(), and takeNextFreeImage().

Referenced by loadDefaultImages().

656 {
657  if (qcepDebug(DEBUG_FILES)) {
658  printMessage(tr("QxrdDataProcessorBase::loadBadPixels(%1)").arg(name));
659  }
660 
662 
663  QString path = filePathInDataDirectory(name);
664 
665  if (res && res -> readImage(path)) {
666 
667  // printf("Read %d x %d image\n", res->get_Width(), res->get_Height());
668 
669  res -> loadMetaData();
670  res -> set_DataType(QcepDoubleImageData::BadPixelsData);
671 
672  newBadPixelsImage(res);
673 
674  set_BadPixelsPath(res -> get_FileName());
675  }
676 }
void newBadPixelsImage(QcepDoubleImageDataPtr image)
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::loadDark ( QString  name)
slot

Definition at line 608 of file qxrddataprocessorbase.cpp.

References QcepImageDataBase::DarkData, DEBUG_FILES, filePathInDataDirectory(), INVOKE_CHECK, newDarkImage(), printMessage(), qcepDebug(), and takeNextFreeImage().

Referenced by loadDefaultImages().

609 {
610  if (QThread::currentThread() != thread()) {
611  INVOKE_CHECK(QMetaObject::invokeMethod(this, "loadDark", Qt::BlockingQueuedConnection, Q_ARG(QString, name)))
612  } else {
613  if (qcepDebug(DEBUG_FILES)) {
614  printMessage(
615  tr("QxrdDataProcessorBase::loadDark(%1)").arg(name));
616  }
617 
619 
620  QString path = filePathInDataDirectory(name);
621 
622  if (res && res -> readImage(path)) {
623 
624  // printf("Read %d x %d image\n", res->get_Width(), res->get_Height());
625 
626  res -> loadMetaData();
627  res -> set_DataType(QcepDoubleImageData::DarkData);
628 
629  newDarkImage(res);
630 
631  set_DarkImagePath(res -> get_FileName());
632 
633  printMessage(tr("Loaded Dark Image from %1").arg(path));
634  } else {
635  printMessage(tr("loadDark(%1) failed").arg(name));
636  }
637  }
638 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void newDarkImage(QcepInt16ImageDataPtr image)
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
#define INVOKE_CHECK(res)
Definition: qcepmacros.h:13
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::loadData ( QString  name)
slot

Definition at line 524 of file qxrddataprocessorbase.cpp.

References darkImage(), DEBUG_FILES, filePathInDataDirectory(), INVOKE_CHECK, newData(), printMessage(), qcepDebug(), QcepImageDataBase::Raw16Data, QcepImageDataBase::Raw32Data, subtractDarkImage(), and takeNextFreeImage().

525 {
526  if (QThread::currentThread() != thread()) {
527  INVOKE_CHECK(QMetaObject::invokeMethod(this, "loadData", Qt::BlockingQueuedConnection, Q_ARG(QString, name)))
528  } else {
529  if (qcepDebug(DEBUG_FILES)) {
530  printMessage(
531  tr("QxrdDataProcessorBase::loadData(%1)").arg(name));
532  }
533 
535 
536  QString path = filePathInDataDirectory(name);
537 
538  if (res && res -> readImage(path)) {
539 
540  // printf("Read %d x %d image\n", res->get_Width(), res->get_Height());
541 
542  res -> loadMetaData();
543 
544  int typ = res->get_DataType();
545 
546  if ((typ == QcepDoubleImageData::Raw16Data) ||
548  {
550  }
551 
552  newData(res, QcepMaskDataPtr());
553 
554  set_DataPath(res -> get_FileName());
555 
556  printMessage(tr("Loaded data from %1").arg(path));
557  }
558  }
559 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void subtractDarkImage(QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark)
QcepDoubleImageDataPtr darkImage() const
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
#define INVOKE_CHECK(res)
Definition: qcepmacros.h:13
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::loadDefaultImages ( )

Definition at line 459 of file qxrddataprocessorbase.cpp.

References fileName, loadBadPixels(), loadDark(), loadGainMap(), and loadMask().

460 {
461  QString fileName = get_MaskPath();
462  QFileInfo fileInfo(fileName);
463 
464  if (fileInfo.exists() && fileInfo.isFile()) {
465  loadMask(fileName);
466  }
467 
468  fileName = get_DarkImagePath();
469  fileInfo.setFile(fileName);
470 
471  if (fileInfo.exists() && fileInfo.isFile()) {
472  loadDark(fileName);
473  }
474 
475  fileName = get_BadPixelsPath();
476  fileInfo.setFile(fileName);
477 
478  if (fileInfo.exists() && fileInfo.isFile()) {
479  loadBadPixels(fileName);
480  }
481 
482  fileName = get_GainMapPath();
483  fileInfo.setFile(fileName);
484 
485  if (fileInfo.exists() && fileInfo.isFile()) {
486  loadGainMap(fileName);
487  }
488 }
void loadBadPixels(QString name)
void loadGainMap(QString name)

Here is the call graph for this function:

void QxrdDataProcessorBase::loadGainMap ( QString  name)
slot

Definition at line 689 of file qxrddataprocessorbase.cpp.

References DEBUG_FILES, filePathInDataDirectory(), QcepImageDataBase::GainData, newGainMapImage(), printMessage(), qcepDebug(), and takeNextFreeImage().

Referenced by loadDefaultImages().

690 {
691  if (qcepDebug(DEBUG_FILES)) {
692  printMessage(tr("QxrdDataProcessorBase::loadGainMap(%1)").arg(name));
693  }
694 
696 
697  QString path = filePathInDataDirectory(name);
698 
699  if (res -> readImage(path)) {
700 
701  // printf("Read %d x %d image\n", res->get_Width(), res->get_Height());
702 
703  res -> loadMetaData();
704  res -> set_DataType(QcepDoubleImageData::GainData);
705  res -> setDefaultValue(1.0);
706 
707  newGainMapImage(res);
708 
709  set_GainMapPath(res -> get_FileName());
710  }
711 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
void newGainMapImage(QcepDoubleImageDataPtr image)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::loadMask ( QString  name)
slot

Definition at line 1115 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), DEBUG_FILES, filePathInDataDirectory(), m_Masks, mask(), QcepImageDataBase::MaskData, QcepAllocator::newMask(), newMask(), printMessage(), pushMaskStack(), qcepDebug(), and QcepAllocator::WaitTillAvailable.

Referenced by loadDefaultImages().

1116 {
1117  if (qcepDebug(DEBUG_FILES)) {
1118  printMessage(tr("QxrdDataProcessorBase::loadMask(%1)").arg(name));
1119  }
1120 
1122 
1123  QString path = filePathInDataDirectory(name);
1124 
1125  if (res -> readImage(path)) {
1126 
1127  // printf("Read %d x %d image\n", res->get_Width(), res->get_Height());
1128 
1129  res -> loadMetaData();
1130  res -> set_DataType(QcepMaskData::MaskData);
1131 
1132  // res -> copyMaskTo(m_Mask);
1133 
1134  pushMaskStack(res);
1135 
1136  m_Masks.changed();
1137 
1138  newMask();
1139 
1140  set_MaskPath(mask() -> get_FileName());
1141 
1142  printMessage(tr("Loaded Mask from %1").arg(path));
1143  }
1144 }
QcepMaskDataPtr mask() const
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void pushMaskStack(QcepMaskDataPtr mask=QcepMaskDataPtr())
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
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:

QStringList QxrdDataProcessorBase::ls ( ) const
slot

Definition at line 504 of file qxrddataprocessorbase.cpp.

References dataDirectory().

505 {
506  QStringList res;
507  QDir dir(dataDirectory());
508 
509  res = dir.entryList(QStringList());
510 
511  return res;
512 }

Here is the call graph for this function:

QStringList QxrdDataProcessorBase::ls ( QString  pattern) const
slot

Definition at line 514 of file qxrddataprocessorbase.cpp.

References dataDirectory().

515 {
516  QStringList res;
517  QDir dir(dataDirectory());
518 
519  res = dir.entryList(QStringList(pattern));
520 
521  return res;
522 }

Here is the call graph for this function:

QcepMaskDataPtr QxrdDataProcessorBase::mask ( ) const
slot
void QxrdDataProcessorBase::maskCircle ( QRectF  pt)
slot

Definition at line 1715 of file qxrddataprocessorbase.cpp.

References createMaskIfNeeded(), mask(), and newMask().

Referenced by QxrdImagePlot::setProcessor().

1716 {
1718 
1719  if (mask()) {
1720  if ((rect.left() == rect.right()) && (rect.bottom() == rect.top())) {
1721  mask() -> maskCircle(rect.left(), rect.top(), get_MaskCircleRadius(), get_MaskSetPixels());
1722  } else {
1723  double cx = rect.center().x();
1724  double cy = rect.center().y();
1725  double rad = rect.width()/2;
1726 
1727  mask() -> maskCircle(cx, cy, rad, get_MaskSetPixels());
1728  }
1729 
1730  newMask();
1731  }
1732 }
QcepMaskDataPtr mask() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::maskPolygon ( QVector< QPointF >  poly)
slot

Definition at line 1734 of file qxrddataprocessorbase.cpp.

References createMaskIfNeeded(), mask(), and newMask().

Referenced by QxrdImagePlot::setProcessor().

1735 {
1737 
1738  if (mask()) {
1739  // printf("QxrdDataProcessorBase::maskPolygon(%d points ...)\n", poly.size());
1740 
1741  int nRows = mask() -> get_Height();
1742  int nCols = mask() -> get_Width();
1743 
1744  QImage polyImage(nCols, nRows, QImage::Format_RGB32);
1745  QPainter polyPainter(&polyImage);
1746  QPolygonF polygon;
1747 
1748  foreach(QPointF pt, poly) {
1749  polygon.append(pt);
1750  }
1751 
1752  polyPainter.setPen(Qt::white);
1753  polyPainter.fillRect(0,0,nCols,nRows,Qt::black);
1754  polyPainter.setBrush(QBrush(Qt::white, Qt::SolidPattern));
1755  polyPainter.drawPolygon(poly);
1756 
1757  bool newval = get_MaskSetPixels();
1758 
1759  for (int j=0; j<nRows; j++) {
1760  for (int i=0; i<nCols; i++) {
1761  if (qGray(polyImage.pixel(i,j))) {
1762  mask() -> setMaskValue(i, j, newval);
1763  }
1764  }
1765  }
1766 
1767  newMask();
1768  }
1769 }
QcepMaskDataPtr mask() const

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdMaskStackPtr QxrdDataProcessorBase::maskStack ( )

Definition at line 746 of file qxrddataprocessorbase.cpp.

References m_Masks.

Referenced by findZingers().

747 {
748  return &m_Masks;
749 }

Here is the caller graph for this function:

int QxrdDataProcessorBase::maskStackPosition ( int  pos)
slot

Definition at line 756 of file qxrddataprocessorbase.cpp.

References m_Masks.

Referenced by andMaskStack(), andNotMaskStack(), exchangeMaskStack(), growMaskStack(), hideMaskAllStack(), hideMaskRangeStack(), invertMaskStack(), orMaskStack(), orNotMaskStack(), showMaskAllStack(), showMaskRangeStack(), shrinkMaskStack(), xorMaskStack(), and xorNotMaskStack().

757 {
758  int len = m_Masks.count();
759 
760  if (pos >= 0 && pos < len) {
761  return pos;
762  } else if (pos < 0 && pos >= -len) {
763  return len-pos;
764  } else {
765  return -1;
766  }
767 }

Here is the caller graph for this function:

int QxrdDataProcessorBase::maskStackSize ( )
slot

Definition at line 751 of file qxrddataprocessorbase.cpp.

References m_Masks.

752 {
753  return m_Masks.count();
754 }
void QxrdDataProcessorBase::measurePolygon ( QVector< QPointF >  poly)
slot

Definition at line 1771 of file qxrddataprocessorbase.cpp.

References m_Data, printMessage(), and summarizeMeasuredPolygon().

Referenced by QxrdImagePlot::setProcessor().

1772 {
1773  foreach(QPointF pt, poly) {
1774  printMessage(tr("Measure pt (%1,%2) = %3").arg(pt.x()).arg(pt.y())
1775  .arg(m_Data -> value(pt.x(),pt.y())));
1776  }
1777 
1779 }
QcepDoubleImageDataPtr m_Data
void summarizeMeasuredPolygon(QVector< QPointF > poly)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::multiplyData ( double  scalar)
slot

Definition at line 2311 of file qxrddataprocessorbase.cpp.

References m_Data.

2312 {
2314 
2315  int wid = dat->get_Width();
2316  int ht = dat->get_Height();
2317 
2318  for (int y=0; y<ht; y++) {
2319  for (int x=0; x<wid; x++) {
2320  dat->setValue(x, y, dat->value(x, y) * scalar);
2321  }
2322  }
2323 }
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdDataProcessorBase::newBadPixelsImage ( QcepDoubleImageDataPtr  image)
protected

Definition at line 428 of file qxrddataprocessorbase.cpp.

References m_BadPixels.

Referenced by clearBadPixels(), and loadBadPixels().

429 {
430  m_BadPixels = image;
431 
432  if (image) {
433  set_BadPixelsPath(image->get_FileName());
434  } else {
435  set_BadPixelsPath("");
436  }
437 }
QcepDoubleImageDataPtr m_BadPixels

Here is the caller graph for this function:

void QxrdDataProcessorBase::newDarkImage ( QcepInt16ImageDataPtr  image)
protected

Definition at line 396 of file qxrddataprocessorbase.cpp.

References m_DarkFrame, and takeNextFreeImage().

Referenced by clearDark(), loadDark(), and newDarkImage().

397 {
398  if (image) {
399  if (m_DarkFrame == NULL) {
400  m_DarkFrame = takeNextFreeImage(image->get_Width(), image->get_Height());
401  }
402 
403  m_DarkFrame -> copyFrom(image);
405 
406  // set_DarkImagePath(m_DarkFrame -> get_FileName());
407  } else {
409  }
410 }
void newDarkImage(QcepInt16ImageDataPtr image)
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
QcepDoubleImageDataPtr m_DarkFrame
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::newDarkImage ( QcepInt32ImageDataPtr  image)
protected

Definition at line 412 of file qxrddataprocessorbase.cpp.

References m_DarkFrame, newDarkImage(), and takeNextFreeImage().

413 {
414  if (image) {
415  if (m_DarkFrame == NULL) {
416  m_DarkFrame = takeNextFreeImage(image->get_Width(), image->get_Height());
417  }
418 
419  m_DarkFrame -> copyFrom(image);
421 
422  // set_DarkImagePath(m_DarkFrame -> get_FileName());
423  } else {
425  }
426 }
void newDarkImage(QcepInt16ImageDataPtr image)
QcepDoubleImageDataPtr takeNextFreeImage(int width, int height)
QcepDoubleImageDataPtr m_DarkFrame
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::newDarkImage ( QcepDoubleImageDataPtr  image)
protected

Definition at line 370 of file qxrddataprocessorbase.cpp.

References m_DarkFrame.

371 {
372  m_DarkFrame = image;
373 
374  if (image) {
375  set_DarkImagePath(image->get_FileName());
376 
377  int height = image->get_Height();
378  int width = image->get_Width();
379  int ndrk = image -> get_SummedExposures();
380  int npixels = width*height;
381  if (ndrk <= 0) ndrk = 1;
382 
383  double *dk = image->data();
384  double avgdark = 0;
385 
386  for (int i=0; i<npixels; i++) {
387  avgdark += dk[i];
388  }
389  set_AverageDark(avgdark/npixels/ndrk);
390  } else {
391  set_DarkImagePath("");
392  set_AverageDark(0);
393  }
394 }
QcepDoubleImageDataPtr m_DarkFrame
void QxrdDataProcessorBase::newData ( QcepDoubleImageDataPtr  image,
QcepMaskDataPtr  overflow 
)
slot

Definition at line 354 of file qxrddataprocessorbase.cpp.

References m_CenterFinder, m_Data, m_Overflow, m_Window, and overflow().

Referenced by QxrdDataProcessorThreaded::addImages(), ellipse(), exponentialTail(), QxrdDataProcessorThreaded::idleInt16Image(), loadData(), newImage(), powderRing(), processAcquiredImage(), QxrdDataProcessorThreaded::projectImages(), reciprocalTail(), QxrdDataProcessorThreaded::reflectHorizontally(), QxrdDataProcessorThreaded::reflectVertically(), setWindow(), QxrdDataProcessorThreaded::shiftImage(), QxrdDataProcessorThreaded::subtractImages(), and QxrdDataProcessorThreaded::sumImages().

355 {
356  m_Data = image;
358 
360 
361  if (w) {
362  w -> newDataAvailable(m_Data, overflow);
363  }
364 
365  if (m_CenterFinder) {
366  m_CenterFinder->setData(m_Data);
367  }
368 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
QxrdCenterFinderPtr m_CenterFinder
QcepDoubleImageDataPtr m_Data
QcepMaskDataPtr overflow() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::newGainMapImage ( QcepDoubleImageDataPtr  image)
protected

Definition at line 439 of file qxrddataprocessorbase.cpp.

References m_GainMap.

Referenced by clearGainMap(), and loadGainMap().

440 {
441  m_GainMap = image;
442 
443  if (image) {
444  set_GainMapPath(image->get_FileName());
445  } else {
446  set_GainMapPath("");
447  }
448 }
QcepDoubleImageDataPtr m_GainMap

Here is the caller graph for this function:

void QxrdDataProcessorBase::newImage ( int  ncols,
int  nrows 
)
slot

Definition at line 1963 of file qxrddataprocessorbase.cpp.

References m_Data, and newData().

1964 {
1965  m_Data -> resize(ncols, nrows);
1966  m_Data -> fill(0);
1967 
1969 }
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::newIntegrationAvailable ( QcepIntegratedDataPtr  data)
signal

Referenced by displayIntegratedData(), QxrdWindow::initialize(), and plotOutputScan().

Here is the caller graph for this function:

void QxrdDataProcessorBase::newMask ( )
int QxrdDataProcessorBase::newMaskHeight ( ) const
protected

Definition at line 784 of file qxrddataprocessorbase.cpp.

References data(), and mask().

Referenced by newMaskStack(), and pushMaskStack().

785 {
787 
788  int h=0;
789 
790  if (d) {
791  h = d->get_Height();
792  } else if (mask()) {
793  h = mask()->get_Height();
794  }
795 
796  return h;
797 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr data() const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::newMaskStack ( )
slot

Definition at line 799 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, QcepAllocator::newMask(), newMask(), newMaskHeight(), newMaskWidth(), printMessage(), and QcepAllocator::WaitTillAvailable.

Referenced by createMaskIfNeeded().

800 {
801 
803  newMaskWidth(), newMaskHeight(), 0, this);
804 
805  m_Masks.push_front(m);
806 
807  printMessage(tr("new mask, %1 on stack").arg(m_Masks.count()));
808 
809  m_Masks.changed();
810 
811  newMask();
812 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
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:

int QxrdDataProcessorBase::newMaskWidth ( ) const
protected

Definition at line 769 of file qxrddataprocessorbase.cpp.

References data(), and mask().

Referenced by newMaskStack(), and pushMaskStack().

770 {
772 
773  int w=0;
774 
775  if (d) {
776  w = d->get_Width();
777  } else if (mask()) {
778  w = mask()->get_Width();
779  }
780 
781  return w;
782 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr data() const
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::newOutputScan ( QString  title)
slot

Definition at line 2221 of file qxrddataprocessorbase.cpp.

References QcepAllocator::AlwaysAllocate, data(), m_OutputScan, and QcepAllocator::newIntegratedData().

2222 {
2224 
2225  m_OutputScan -> set_Title(title);
2226 }
static QcepIntegratedDataPtr newIntegratedData(AllocationStrategy strat, QcepDoubleImageDataPtr image, QcepObject *parent)
QcepDoubleImageDataPtr data() const
QcepIntegratedDataPtr m_OutputScan

Here is the call graph for this function:

void QxrdDataProcessorBase::offsetData ( double  offset)
slot

Definition at line 2325 of file qxrddataprocessorbase.cpp.

References m_Data.

2326 {
2328 
2329  int wid = dat->get_Width();
2330  int ht = dat->get_Height();
2331 
2332  for (int y=0; y<ht; y++) {
2333  for (int x=0; x<wid; x++) {
2334  dat->setValue(x, y, dat->value(x, y) + offset);
2335  }
2336  }
2337 }
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr
void QxrdDataProcessorBase::orMaskStack ( int  pos)
slot

Definition at line 938 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, maskStackPosition(), and newMask().

939 {
940  int p0 = maskStackPosition(0);
941  int p1 = maskStackPosition(pos);
942 
943  if ((p0 >= 0) && (p1 >= 0)) {
944  QcepMaskDataPtr pm = m_Masks[p1];
945 
946  m_Masks[p0] -> orMask(pm);
947 
948  m_Masks.changed();
949 
950  newMask();
951  }
952 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::orNotMaskStack ( int  pos)
slot

Definition at line 986 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, maskStackPosition(), and newMask().

987 {
988  int p0 = maskStackPosition(0);
989  int p1 = maskStackPosition(pos);
990 
991  if ((p0 >= 0) && (p1 >= 0)) {
992  QcepMaskDataPtr pm = m_Masks[p1];
993 
994  m_Masks[p0] -> orNotMask(pm);
995 
996  m_Masks.changed();
997 
998  newMask();
999  }
1000 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

QcepMaskDataPtr QxrdDataProcessorBase::overflow ( ) const
slot

Definition at line 1867 of file qxrddataprocessorbase.cpp.

References m_Overflow.

Referenced by newData(), processAcquiredImage(), processAcquiredInt16Image(), and processAcquiredInt32Image().

1868 {
1869  return m_Overflow;
1870 }

Here is the caller graph for this function:

void QxrdDataProcessorBase::performImageCorrections ( QcepDoubleImageDataPtr  image)
protected
void QxrdDataProcessorBase::plotOutputScan ( )
slot

Definition at line 2235 of file qxrddataprocessorbase.cpp.

References m_OutputScan, and newIntegrationAvailable().

2236 {
2237  if (m_OutputScan) {
2239  }
2240 }
void newIntegrationAvailable(QcepIntegratedDataPtr data)
QcepIntegratedDataPtr m_OutputScan
QxrdPolarNormalizationPtr QxrdDataProcessorBase::polarNormalization ( ) const

Definition at line 1945 of file qxrddataprocessorbase.cpp.

References m_PolarNormalization, and printMessage().

1946 {
1947  if (m_PolarNormalization == NULL) {
1948  printMessage("Problem QxrdDataProcessorBase::polarNormalization == NULL");
1949  }
1950 
1951  return m_PolarNormalization;
1952 }
QxrdPolarNormalizationPtr m_PolarNormalization
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

QxrdPolarTransformPtr QxrdDataProcessorBase::polarTransform ( ) const

Definition at line 1936 of file qxrddataprocessorbase.cpp.

References m_PolarTransform, and printMessage().

1937 {
1938  if (m_PolarTransform == NULL) {
1939  printMessage("Problem QxrdDataProcessorBase::polarTransform == NULL");
1940  }
1941 
1942  return m_PolarTransform;
1943 }
QxrdPolarTransformPtr m_PolarTransform
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

void QxrdDataProcessorBase::popMaskStack ( int  amount = 1)
slot

Definition at line 836 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, and newMask().

Referenced by clearMaskStackTop().

837 {
838  if (amount == 0) {
839  return;
840  } else if (amount > 1) {
841  for (int i=0; i<amount; i++) {
842  popMaskStack(1);
843  }
844  } else if (amount < -1) {
845  for (int i=0; i<(-amount); i++) {
846  popMaskStack(-1);
847  }
848  } else if (amount == 1) {
849  if (m_Masks.count() >= 1) {
850 // m_Mask = m_Masks.first();
851  m_Masks.pop_front();
852  }
853  } else if (amount == -1) {
854  if (m_Masks.count() >= 1) {
855 // m_Mask = m_Masks.last();
856  m_Masks.pop_back();
857  }
858  }
859 
860  m_Masks.changed();
861 
862  newMask();
863 }
void popMaskStack(int amount=1)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::powderRing ( double  cx,
double  cy,
double  radius,
double  width,
double  strength,
int  oversample 
)
slot

Definition at line 2025 of file qxrddataprocessorbase.cpp.

References m_Data, and newData().

2026 {
2027  int nr = m_Data -> get_Height();
2028  int nc = m_Data -> get_Width();
2029 
2030  for (int y=0; y<nr; y++) {
2031  for (int x=0; x<nc; x++) {
2032  double sum = 0;
2033 
2034  for (int iy = 0; iy < oversample; iy++) {
2035  double yy = (double) y + ((double) iy)/((double) oversample) - cy;
2036  double yy2 = yy*yy;
2037  for (int ix = 0; ix < oversample; ix++) {
2038  double xx = (double) x + ((double) ix)/((double) oversample) - cx;
2039  double xx2 = xx*xx;
2040  double r = sqrt(yy2 + xx2);
2041 
2042  double ndr = (r - radius)/width;
2043 
2044  if (fabs(ndr) < 6) {
2045  double val = strength*exp(-2*ndr*ndr)/width*sqrt(2.0/M_PI);
2046  sum += val;
2047  }
2048  }
2049  }
2050 
2051  m_Data -> setValue(x, y, m_Data -> value(x,y) + sum/(oversample*oversample));
2052  }
2053  }
2054 
2056 }
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::printMeasuredPolygon ( QVector< QPointF >  poly)
slot

Definition at line 1781 of file qxrddataprocessorbase.cpp.

References printMessage(), and summarizeMeasuredPolygon().

Referenced by QxrdIntegratorPlot::setDataProcessor(), and QxrdCenterFinderPlot::setWindow().

1782 {
1783  foreach(QPointF pt, poly) {
1784  printMessage(tr("Measure pt (%1,%2)").arg(pt.x()).arg(pt.y()));
1785  }
1786 
1788 }
void summarizeMeasuredPolygon(QVector< QPointF > poly)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::printMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 226 of file qxrddataprocessorbase.cpp.

References m_Experiment.

Referenced by QxrdDataProcessorThreaded::addImages(), calculateHistogram(), calculateROI(), centerFinder(), QxrdDataProcessorThreaded::correlateImages(), distortionCorrection(), experiment(), fileWriteTest(), QxrdDataProcessorThreaded::fixupBadBackgroundSubtraction(), QxrdDataProcessorThreaded::idleInt16Image(), QxrdDataProcessorThreaded::integrateAndAccumulate(), QxrdDataProcessorThreaded::integrateData(), integrateRectangle(), QxrdDataProcessorThreaded::integrateSaveAndDisplay(), integrator(), loadBadPixels(), loadDark(), loadData(), loadGainMap(), loadMask(), measurePolygon(), newMaskStack(), QxrdDataProcessorThreaded::onHistogramDataAvailable(), QxrdDataProcessorThreaded::onIntegratedDataAvailable(), QxrdDataProcessorThreaded::onROIDataAvailable(), polarNormalization(), polarTransform(), printMeasuredPolygon(), processAcquiredImage(), processAcquiredInt16Image(), processAcquiredInt32Image(), QxrdDataProcessorThreaded::processData(), QxrdDataProcessorThreaded::processDataSequence(), QxrdDataProcessorThreaded::processNormalizedFile(), QxrdDataProcessorThreaded::projectImages(), pushMaskStack(), QxrdDataProcessorBase(), saveData(), QxrdDataProcessorThreaded::setFileNormalization(), subtractDarkImage(), QxrdDataProcessorThreaded::subtractImages(), QxrdDataProcessorThreaded::sumImages(), and unsubtractDarkImage().

227 {
229 
230  if (exp) {
231  exp->printMessage(msg, ts);
232  }
233 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment

Here is the caller graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::processAcquiredDoubleImage ( QcepDoubleImageDataPtr  processed,
QcepDoubleImageDataPtr  image,
QcepDoubleImageDataPtr  dark,
QcepMaskDataPtr  mask,
QcepMaskDataPtr  overflow 
)
protected

Definition at line 1312 of file qxrddataprocessorbase.cpp.

References processAcquiredImage().

1318 {
1319  return processAcquiredImage(processed, dimg, dark, mask, overflow);
1320 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr processAcquiredImage(QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr dimg, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v=QcepDoubleList())
QcepMaskDataPtr overflow() const

Here is the call graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::processAcquiredDoubleImage ( QcepDoubleImageDataPtr  processed,
QcepDoubleImageDataPtr  image,
QcepDoubleImageDataPtr  dark,
QcepMaskDataPtr  mask,
QcepMaskDataPtr  overflow,
QcepDoubleList  v 
)
protected

Definition at line 1322 of file qxrddataprocessorbase.cpp.

References processAcquiredImage().

1329 {
1330  return processAcquiredImage(processed, dimg, dark, mask, overflow, v);
1331 }
QcepMaskDataPtr mask() const
QcepDoubleImageDataPtr processAcquiredImage(QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr dimg, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v=QcepDoubleList())
QcepMaskDataPtr overflow() const

Here is the call graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::processAcquiredImage ( QcepDoubleImageDataPtr  processed,
QcepDoubleImageDataPtr  dimg,
QcepDoubleImageDataPtr  dark,
QcepMaskDataPtr  mask,
QcepMaskDataPtr  overflow,
QcepDoubleList  v = QcepDoubleList() 
)
protected

Definition at line 1333 of file qxrddataprocessorbase.cpp.

References correctBadPixels(), correctImageGains(), DEBUG_PROCESS, getAcquiredCount(), newData(), overflow(), printMessage(), qcepDebug(), saveNamedImageData(), saveNamedImageDataAsText(), statusMessage(), subtractDarkImage(), subtractedOutputDirectory(), and updateEstimatedTime().

Referenced by processAcquiredDoubleImage(), processAcquiredInt16Image(), and processAcquiredInt32Image().

1340 {
1341  if (processed && img) {
1342  processed->copyFrom(img);
1343 
1344  statusMessage(tr("Processing Image \"%1\"").arg(processed->get_FileName()));
1345 
1346  QTime tic;
1347  tic.start();
1348 
1349  if (v.length() > 0) {
1350  processed->set_Normalization(v);
1351  }
1352 
1353  if (qcepDebug(DEBUG_PROCESS)) {
1354  printMessage(tr("Processing Image \"%1\", image number %2, count %3")
1355  .arg(processed->get_FileName()).arg(processed->get_ImageNumber()).arg(getAcquiredCount()));
1356  }
1357 
1358  if (get_PerformDarkSubtraction()) {
1359  subtractDarkImage(processed, dark);
1360  processed -> set_ObjectSaved(false);
1361 
1362  int subTime = tic.restart();
1363 
1364  updateEstimatedTime(prop_PerformDarkSubtractionTime(), subTime);
1365 
1366  if (qcepDebug(DEBUG_PROCESS)) {
1367  printMessage(tr("Dark subtraction took %1 msec").arg(subTime));
1368  }
1369  }
1370 
1371  if (get_PerformBadPixels()) {
1372  correctBadPixels(processed);
1373  processed -> set_ObjectSaved(false);
1374 
1375  int badPxlTime = tic.restart();
1376 
1377  updateEstimatedTime(prop_PerformBadPixelsTime(), badPxlTime);
1378 
1379  if (qcepDebug(DEBUG_PROCESS)) {
1380  printMessage(tr("Bad Pixel correction took %1 msec").arg(badPxlTime));
1381  }
1382  }
1383 
1384  if (get_PerformGainCorrection()) {
1385  correctImageGains(processed);
1386  processed -> set_ObjectSaved(false);
1387 
1388  int gainTime = tic.restart();
1389 
1390  updateEstimatedTime(prop_PerformGainCorrectionTime(), gainTime);
1391 
1392  if (qcepDebug(DEBUG_PROCESS)) {
1393  printMessage(tr("Gain correction took %1 msec").arg(gainTime));
1394  }
1395  }
1396 
1397  if (get_SaveSubtracted()) {
1398  if (processed->get_ObjectSaved()) {
1399  printMessage(tr("Image \"%1\" is already saved").arg(processed->rawFileName()));
1400  } else {
1401  saveNamedImageData(QDir(subtractedOutputDirectory()).filePath(processed->get_FileBase()), processed, overflow);
1402  }
1403  }
1404 
1405  if (get_SaveAsText()) {
1406  saveNamedImageDataAsText(processed->get_FileName(), processed, overflow);
1407 
1408  updateEstimatedTime(prop_SaveAsTextTime(), tic.elapsed());
1409  }
1410 
1411  newData(processed, overflow);
1412 
1413  if (qcepDebug(DEBUG_PROCESS)) {
1414  printMessage(tr("Processing took %1 msec").arg(tic.restart()));
1415  }
1416 
1417  statusMessage(tr("Completed Processing Image \"%1\"").arg(processed->get_FileName()));
1418  }
1419 
1420  return processed;
1421 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void subtractDarkImage(QcepDoubleImageDataPtr image, QcepDoubleImageDataPtr dark)
void saveNamedImageDataAsText(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void updateEstimatedTime(QcepDoubleProperty *prop, int msec)
void correctBadPixels(QcepDoubleImageDataPtr image)
QString subtractedOutputDirectory() const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void saveNamedImageData(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QcepMaskDataPtr overflow() const
void correctImageGains(QcepDoubleImageDataPtr image)

Here is the call graph for this function:

Here is the caller graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::processAcquiredInt16Image ( QcepDoubleImageDataPtr  processed,
QcepInt16ImageDataPtr  image,
QcepDoubleImageDataPtr  dark,
QcepMaskDataPtr  mask,
QcepMaskDataPtr  overflow 
)
protected

Definition at line 1248 of file qxrddataprocessorbase.cpp.

References DEBUG_PROCESS, getAcquiredCount(), NoOverwrite, overflow(), printMessage(), processAcquiredImage(), qcepDebug(), and saveNamedRawImageData().

1254 {
1255  if (qcepDebug(DEBUG_PROCESS)) {
1256  printMessage(tr("processing acquired 16 bit image, %1 remaining")
1257  .arg(getAcquiredCount()));
1258  }
1259 
1260  if (img) {
1261  if (get_SaveRawImages()) {
1262  if (img->get_ObjectSaved()) {
1263  printMessage(tr("Image \"%1\" is already saved").arg(img->rawFileName()));
1264  } else {
1266  }
1267  }
1268 
1269  corrected -> copyFrom(img);
1270  corrected -> set_DateTime(QDateTime::currentDateTime());
1271 
1272  processAcquiredImage(corrected, corrected, dark, mask, overflow);
1273 
1274  return corrected;
1275  } else {
1276  return QcepDoubleImageDataPtr();
1277  }
1278 }
QcepMaskDataPtr mask() const
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepDoubleImageDataPtr processAcquiredImage(QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr dimg, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v=QcepDoubleList())
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QcepMaskDataPtr overflow() const
void saveNamedRawImageData(QString name, QcepInt16ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

QcepDoubleImageDataPtr QxrdDataProcessorBase::processAcquiredInt32Image ( QcepDoubleImageDataPtr  processed,
QcepInt32ImageDataPtr  image,
QcepDoubleImageDataPtr  dark,
QcepMaskDataPtr  mask,
QcepMaskDataPtr  overflow 
)
protected

Definition at line 1280 of file qxrddataprocessorbase.cpp.

References DEBUG_PROCESS, getAcquiredCount(), NoOverwrite, overflow(), printMessage(), processAcquiredImage(), qcepDebug(), and saveNamedRawImageData().

1286 {
1287  if (qcepDebug(DEBUG_PROCESS)) {
1288  printMessage(tr("processing acquired 32 bit image, %1 remaining")
1289  .arg(getAcquiredCount()));
1290  }
1291 
1292  if (img) {
1293  if (get_SaveRawImages()) {
1294  if (img->get_ObjectSaved()) {
1295  printMessage(tr("Image \"%1\" is already saved").arg(img->rawFileName()));
1296  } else {
1298  }
1299  }
1300 
1301  corrected -> copyFrom(img);
1302  corrected -> set_DateTime(QDateTime::currentDateTime());
1303 
1304  processAcquiredImage(corrected, corrected, dark, mask, overflow);
1305 
1306  return corrected;
1307  } else {
1308  return QcepDoubleImageDataPtr();
1309  }
1310 }
QcepMaskDataPtr mask() const
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepDoubleImageDataPtr processAcquiredImage(QcepDoubleImageDataPtr processed, QcepDoubleImageDataPtr dimg, QcepDoubleImageDataPtr dark, QcepMaskDataPtr mask, QcepMaskDataPtr overflow, QcepDoubleList v=QcepDoubleList())
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QcepMaskDataPtr overflow() const
void saveNamedRawImageData(QString name, QcepInt16ImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::pushMaskStack ( QcepMaskDataPtr  mask = QcepMaskDataPtr())
slot

Definition at line 814 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, mask(), QcepAllocator::newMask(), newMask(), newMaskHeight(), newMaskWidth(), printMessage(), and QcepAllocator::WaitTillAvailable.

Referenced by findZingers(), and loadMask().

815 {
816  if (m == NULL) {
818  newMaskWidth(), newMaskHeight(), 0, this);
819 
820  if (mask()) {
821  mask()->copyMaskTo(m);
822  }
823  }
824 
825  m_Masks.push_front(m);
826 
827 // m_Mask = mask;
828 
829  printMessage(tr("dup mask, %1 on stack").arg(m_Masks.count()));
830 
831  m_Masks.changed();
832 
833  newMask();
834 }
QcepMaskDataPtr mask() const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)

Here is the call graph for this function:

Here is the caller graph for this function:

QString QxrdDataProcessorBase::pwd ( ) const
slot

Definition at line 490 of file qxrddataprocessorbase.cpp.

References dataDirectory().

491 {
492  return dataDirectory();
493 }

Here is the call graph for this function:

QString QxrdDataProcessorBase::rawOutputDirectory ( ) const
slot

Definition at line 309 of file qxrddataprocessorbase.cpp.

References dataDirectory(), and existingOutputDirectory().

Referenced by filePathInRawOutputDirectory().

310 {
311  if (get_SaveRawInSubdirectory()) {
312  return existingOutputDirectory(dataDirectory(), get_SaveRawSubdirectory());
313  } else {
314  return dataDirectory();
315  }
316 }
QString existingOutputDirectory(QString dir, QString subdir) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDataProcessorBase::readSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 213 of file qxrddataprocessorbase.cpp.

References m_CenterFinder, m_DistortionCorrection, m_Integrator, m_Mutex, m_PolarNormalization, m_PolarTransform, and QcepObject::readSettings().

214 {
215  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
216 
217  QcepObject::readSettings(settings, section);
218 
219  m_CenterFinder -> readSettings(settings, section+"/centerfinder");
220  m_Integrator -> readSettings(settings, section+"/integrator");
221  m_PolarTransform -> readSettings(settings, section+"/polarTransform");
222  m_PolarNormalization -> readSettings(settings, section+"/polarNormalization");
223  m_DistortionCorrection -> readSettings(settings, section+"/distortion");
224 }
QxrdPolarNormalizationPtr m_PolarNormalization
virtual void readSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:119
QxrdCenterFinderPtr m_CenterFinder
void readSettings(QSettings *settings, QString section)
QxrdIntegratorPtr m_Integrator
QxrdPolarTransformPtr m_PolarTransform
QxrdDistortionCorrectionPtr m_DistortionCorrection

Here is the call graph for this function:

void QxrdDataProcessorBase::reciprocalTail ( double  cx,
double  cy,
double  strength,
int  oversample 
)
slot

Definition at line 1998 of file qxrddataprocessorbase.cpp.

References m_Data, and newData().

1999 {
2000  int nr = m_Data -> get_Height();
2001  int nc = m_Data -> get_Width();
2002 
2003  for (int y=0; y<nr; y++) {
2004  for (int x=0; x<nc; x++) {
2005  double sum = 0;
2006 
2007  for (int iy = 0; iy < oversample; iy++) {
2008  double yy = (double) y + ((double) iy)/((double) oversample) - cy;
2009  double yy2 = yy*yy;
2010  for (int ix = 0; ix < oversample; ix++) {
2011  double xx = (double) x + ((double) ix)/((double) oversample) - cx;
2012  double xx2 = xx*xx;
2013  double r = sqrt(yy2 + xx2);
2014  sum += strength/r;
2015  }
2016  }
2017 
2018  m_Data -> setValue(x, y, m_Data -> value(x,y) + sum/(oversample*oversample));
2019  }
2020  }
2021 
2023 }
void newData(QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow)
QcepDoubleImageDataPtr m_Data
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::rollMaskStack ( int  amount)
slot

Definition at line 879 of file qxrddataprocessorbase.cpp.

References QxrdMaskStack::changed(), m_Masks, and newMask().

880 {
881  if (amount == 0) {
882  return;
883  } else if (amount > 1) {
884  for (int i=0; i<amount; i++) {
885  rollMaskStack(1);
886  }
887  } else if (amount < -1) {
888  for (int i=0; i<(-amount); i++) {
889  rollMaskStack(-1);
890  }
891  } else if (amount == 1) {
892  QcepMaskDataPtr m = m_Masks.first();
893  m_Masks.push_back(m);
894  m_Masks.pop_front();
895  } else if (amount == -1) {
896  QcepMaskDataPtr m = m_Masks.last();
897  m_Masks.push_front(m);
898  m_Masks.pop_back();
899  }
900 
901  m_Masks.changed();
902 
903  newMask();
904 }
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::saveBadPixels ( QString  name,
int  canOverwrite = NoOverwrite 
)
slot

Definition at line 678 of file qxrddataprocessorbase.cpp.

References filePathInDataDirectory(), m_BadPixels, and saveNamedImageData().

679 {
680  QString path = filePathInDataDirectory(name);
681 
682  if (m_BadPixels) {
683  saveNamedImageData(path, m_BadPixels, QcepMaskDataPtr(), canOverwrite);
684 
685  set_BadPixelsPath(m_BadPixels -> get_FileName());
686  }
687 }
QcepDoubleImageDataPtr m_BadPixels
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
void saveNamedImageData(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::saveCachedGeometry ( QString  name)
slot

Definition at line 724 of file qxrddataprocessorbase.cpp.

References data(), filePathInDataDirectory(), m_Integrator, and saveNamedImageData().

725 {
726  QString path = filePathInDataDirectory(name);
727 
728  QcepInt32ImageDataPtr data = m_Integrator->cachedGeometry();
729 
730  if (data) {
731  saveNamedImageData(path, data, QcepMaskDataPtr(), true);
732  }
733 }
QcepDoubleImageDataPtr data() const
QxrdIntegratorPtr m_Integrator
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
void saveNamedImageData(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::saveCachedIntensity ( QString  name)
slot

Definition at line 735 of file qxrddataprocessorbase.cpp.

References data(), filePathInDataDirectory(), m_Integrator, and saveNamedImageData().

736 {
737  QString path = filePathInDataDirectory(name);
738 
739  QcepDoubleImageDataPtr data = m_Integrator->cachedIntensity();
740 
741  if (data) {
742  saveNamedImageData(path, data, QcepMaskDataPtr(), true);
743  }
744 }
QcepDoubleImageDataPtr data() const
QxrdIntegratorPtr m_Integrator
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
void saveNamedImageData(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::saveDark ( QString  name,
int  canOverwrite = NoOverwrite 
)
slot

Definition at line 640 of file qxrddataprocessorbase.cpp.

References filePathInDataDirectory(), INVOKE_CHECK, m_DarkFrame, and saveNamedImageData().

641 {
642  if (QThread::currentThread() != thread()) {
643  INVOKE_CHECK(QMetaObject::invokeMethod(this, "saveDark", Qt::BlockingQueuedConnection, Q_ARG(QString, name), Q_ARG(int, canOverwrite)))
644  } else {
645  QString path = filePathInDataDirectory(name);
646 
647  if (m_DarkFrame) {
648  saveNamedImageData(path, m_DarkFrame, QcepMaskDataPtr(), canOverwrite);
649 
650  set_DarkImagePath(m_DarkFrame -> get_FileName());
651  }
652  }
653 }
QcepDoubleImageDataPtr m_DarkFrame
#define INVOKE_CHECK(res)
Definition: qcepmacros.h:13
QString name
Definition: qcepobject.h:49
QString filePathInDataDirectory(QString name) const
void saveNamedImageData(QString name, QcepDoubleImageDataPtr image, QcepMaskDataPtr overflow, int canOverwrite=NoOverwrite)
QSharedPointer< QcepMaskData > QcepMaskDataPtr

Here is the call graph for this function:

void QxrdDataProcessorBase::saveData ( QString  name,
int  canOverwrite = NoOverwrite 
)
slot

Definition at line 561 of file qxrddataprocessorbase.cpp.

References filePathInDataDirectory(), INVOKE_CHECK, m_Data, and saveNamedImageData().

562 {
563  if (QThread::currentThread() != thread()) {
564