8 #include <QtCore/QString>
22 using tr1::placeholders::_1;
23 using tr1::placeholders::_2;
43 s.
value(
"BoxSizeY",10).toUInt());
45 s.
value(
"SectionSizeY",512).toUInt());
52 if (!(
_hist && ret))
return;
60 " of hist in pp '"+
_hist->name() +
"'. Condition is '" +
74 const size_t xnbrsections(xsize/xsectionsize);
75 const size_t ynbrsections(ysize/ysectionsize);
76 const size_t xboxsize(
_boxSize.first);
77 const size_t yboxsize(
_boxSize.second);
80 for (
size_t sy=0; sy<ynbrsections; ++sy)
82 for (
size_t sx=0; sx<xnbrsections; ++sx)
84 const size_t xsectionbegin(sx*xsectionsize);
85 const size_t xsectionend(sx*xsectionsize + xsectionsize);
86 const size_t ysectionbegin(sy*ysectionsize);
87 const size_t ysectionend(sy*ysectionsize + ysectionsize);
90 for (
size_t y=ysectionbegin;
y<ysectionend; ++
y)
92 for (
size_t x=xsectionbegin;
x<xsectionend; ++
x)
94 const size_t pixAddr(
y*xsize+
x);
95 const float pixel(image[pixAddr]);
99 result[pixAddr] =
pixel;
103 const size_t xboxbegin(max(static_cast<int>(xsectionbegin),static_cast<int>(
x)-static_cast<int>(xboxsize)));
104 const size_t xboxend(min(xsectionend,
x+xboxsize));
105 const size_t yboxbegin(max(static_cast<int>(ysectionbegin),static_cast<int>(
y)-static_cast<int>(yboxsize)));
106 const size_t yboxend(min(ysectionend,
y+yboxsize));
110 for (
size_t yb=yboxbegin; yb<yboxend;++yb)
112 for (
size_t xb=xboxbegin; xb<xboxend;++xb)
114 const size_t pixAddrBox(yb*xsize+xb);
115 const float pixel_box(image[pixAddrBox]);
117 box.push_back(pixel_box);
123 result[pixAddr] =
pixel;
127 const size_t mid(0.5*box.size());
128 nth_element(box.begin(), box.begin() + mid, box.end());
129 const float median = box[mid];
130 result[pixAddr] = median;
158 const int peakRadius(s.
value(
"BraggPeakRadius",2).toInt());
160 const int goodBoxSize(sqrt(3.1415) * peakRadius);
161 _box = make_pair(s.
value(
"BoxSizeX", goodBoxSize).toUInt(),
162 s.
value(
"BoxSizeY",goodBoxSize).toUInt());
164 s.
value(
"SectionSizeY",512).toUInt());
166 _minSnr = s.
value(
"MinSignalToNoiseRatio",20).toFloat();
182 string output(
"Processor '" +
name() +
"' finds bragg peaks." +
184 "'. SectionSize '" +
toString(_section.first)+
"x"+
toString(_section.second)+
185 "'. Threshold '" +
toString(_threshold) +
188 "'. Square BraggPeakRadius '" +
toString(_peakRadiusSq) +
189 "'. Using input histogram :" +
_hist->name() +
190 "'. Condition is '" +
_condition->name() +
"'");
206 if (bRow == 0 && bCol == 0)
221 const bool pixIsBad(qFuzzyIsNull(bPixel));
222 const int radiussq(bRow*bRow + bCol*bCol);
229 count = stat.
count();
257 vector<imagepos_t> neighboursOffsets(neigbourOffsetArray,
258 neigbourOffsetArray +
sizeof(neigbourOffsetArray)/
sizeof(
int));
260 vector<bool> checkedPixels(image.
size(),
false);
262 vector<bool>::iterator checkedPixel(checkedPixels.begin());
276 const uint16_t col(idx % ncols);
277 const uint16_t row(idx / ncols);
282 if (col <
_box.first || ncols -
_box.first < col ||
283 row <
_box.second || nrows -
_box.second < row ||
312 vector<imagepos_t> peakIdxs;
313 peakIdxs.push_back(idx);
314 *checkedPixel =
true;
315 for (
size_t pix=0; pix < peakIdxs.size(); ++pix)
318 vector<imagepos_t>::const_iterator nOffset(neighboursOffsets.begin());
319 vector<imagepos_t>::const_iterator neighboursEnd(neighboursOffsets.end());
320 while(nOffset != neighboursEnd)
322 const size_t nIdx(pixpos + *nOffset++);
325 if (checkedPixels[nIdx] ||
326 _box.first < abs(col - nCol) ||
327 _box.second < abs(row - nRow))
330 const pixelval_t nPixelWOBckgnd(nPixel - mean);
334 peakIdxs.push_back(nIdx);
335 checkedPixels[nIdx] =
true;
350 for (
int bRow=-
_box.second; bRow <=
_box.second; ++bRow)
352 for (
int bCol=-
_box.first; bCol <=
_box.first; ++bCol)
356 const pixelval_t bPixelWOBckgnd(bPixel - mean);
357 if (checkedPixel[bLocIdx])
359 const imagepos_t radiussq(bRow*bRow + bCol*bCol);
360 if (radiussq > max_radiussq)
361 max_radiussq = radiussq;
362 if (radiussq < min_radiussq)
363 min_radiussq = radiussq;
364 integral += bPixelWOBckgnd;
365 weightCol += (bPixelWOBckgnd * (bCol+col));
366 weightRow += (bPixelWOBckgnd * (bRow+row));
369 checkedPixel[bLocIdx] =
true;
424 s.
value(
"BoxSizeY",10).toUInt());
435 throw runtime_error(
"pp205::loadSettings(): '" +
name() +
"' The requested " +
437 "maximum possible value of '" +
toString(maxIdx) +
"'");
443 "' displays the peaks that are listed in '" +
_table->name() +
444 "' and that were found in '" +
_hist->name() +
"'. Condition is '" +
460 const size_t nTableCols(table.
shape().first);
461 const size_t nTableRows(table.
shape().second);
462 const size_t nImageCols(image.
shape().first);
465 for (
size_t row=0; row < nTableRows; ++row)
468 const int idx(table[row*nTableCols +
_idxCol]);
508 const int bLocIdx(idx + bRow*nImageCols+bCol);
509 if (bLocIdx >= static_cast<int>(result.
size()) || bLocIdx < 0)
512 for (
size_t i(0); i<nTableCols; ++i)
516 throw logic_error(
"pp205 '" +
name() +
517 "': Calculated index out of bounds: " +
518 "nTableRows'" +
toString(nTableRows) +
"', " +
519 "tableRow'" +
toString(row) +
"', " +
520 "tableRowContent'" + tableRow +
"', " +
525 "nImageCols'" +
toString(nImageCols) +
"', " +
526 "localIdx'" +
toString(bLocIdx) +
"'");
528 const bool border = (bCol ==
_boxsize.first ||
543 for(
size_t angle_deg = 0; angle_deg <360; ++angle_deg)
545 const float angle_rad(3.14 * static_cast<float>(angle_deg)/180.);
546 const int cCol (static_cast<size_t>(round(
_radius*sin(angle_rad))));
547 const int cRow (static_cast<size_t>(round(
_radius*cos(angle_rad))));
548 const int cLocIdx(cRow*nImageCols+cCol);
577 _box = make_pair(s.
value(
"BoxSizeX", 10).toUInt(),
578 s.
value(
"BoxSizeY",10).toUInt());
580 s.
value(
"SectionSizeY",512).toUInt());
597 string output(
"Processor '" +
name() +
"' finds bragg peaks." +
599 "'. SectionSize '" +
toString(_section.first)+
"x"+
toString(_section.second)+
600 "'. Threshold '" +
toString(_threshold) +
601 "'. Image Histogram :" +
_imagePP->name() +
602 "'. Noise Histogram :" +
_noisePP->name() +
603 "'. Condition is '" +
_condition->name() +
"'");
625 const uint16_t ncols(image.
shape().first);
626 const uint16_t nrows(image.
shape().second);
632 const uint16_t
x(idx % ncols);
633 const uint16_t
y(idx / ncols);
635 const uint16_t xboxbegin(max(static_cast<int>(0),static_cast<int>(x)-static_cast<int>(
_box.first)));
636 const uint16_t xboxend(min(ncols,static_cast<uint16_t>(x+
_box.first)));
637 const uint16_t yboxbegin(max(static_cast<int>(0),static_cast<int>(y)-static_cast<int>(
_box.second)));
638 const uint16_t yboxend(min(nrows,static_cast<uint16_t>(y+
_box.second)));
641 for (
size_t yb=yboxbegin; yb<yboxend;++yb)
643 for (
size_t xb=xboxbegin; xb<xboxend;++xb)
645 const size_t pixAddrBox(yb*ncols+xb);
646 const float pixel_box(image[pixAddrBox]);
651 if (qFuzzyCompare(pixel_box,0.f) )
654 box.push_back(pixel_box);
660 const size_t mid(0.5*box.size());
661 nth_element(box.begin(), box.begin() + mid, box.end());
662 const float bckgnd = box[mid];
663 const float clrdpixel(*
pixel - bckgnd);
705 s.
value(
"SectionSizeY",512).toUInt());
709 const int peakDiameter(s.
value(
"BraggPeakDiameter",2).toInt());
730 const int bsize(2 * peakDiameter );
731 _box = make_pair(s.
value(
"BoxSizeX", bsize).toInt(),
732 s.
value(
"BoxSizeY",bsize).toInt());
745 bool wlIsDouble(
false);
748 double wlval(wlparam.toDouble(&wlIsDouble));
763 bool ddIsDouble(
false);
764 QString ddkey(
"DetectorDistance_m");
766 double ddval(ddparam.toDouble(&ddIsDouble));
781 bool threshIsDouble(
false);
782 QString threshkey(
"Threshold");
784 const double threshval(threshparam.toDouble(&threshIsDouble));
804 throw invalid_argument(
"pp208:loadSettings '" +
name() +
805 "': input processor '" +
_imagePP->name() +
806 "' is not a 2d result");
808 throw invalid_argument(
"pp208:loadSettings '" +
name() +
809 "': wavelength processor '" + wlparam.toStdString() +
810 "' is not a 0d result");
811 if (!ddIsDouble &&
_detdistPP->result().dim() != 0)
812 throw invalid_argument(
"pp208:loadSettings '" +
name() +
813 "': detector distance processor '" + ddparam.toStdString() +
814 "' is not a 0d result");
815 if (!threshIsDouble &&
_threshPP->result().dim() != 0)
816 throw invalid_argument(
"pp208:loadSettings '" +
name() +
817 "': threshold processor '" + threshparam.toStdString()+
818 "' is not a 0d result");
823 const string filename = s.
value(
"GeometryFilename",
"wrong_file").toString().toStdString();
824 const bool convertCheetahToCASSLayout = s.
value(
"ConvertCheetahToCASSLayout",
true).toBool();
825 const double pixsizeX_m = s.
value(
"PixelSizeX_m",109.92e-6).toDouble();
826 const double pixsizeY_m = s.
value(
"PixelSizeY_m",109.92e-6).toDouble();
828 if (filename !=
"wrong_file")
833 srcImageHist.shape().first,
834 convertCheetahToCASSLayout);
836 for (
size_t i=0; i < src2lab.size(); ++i)
838 const double x_m(src2lab[i].
x *pixsizeX_m);
839 const double y_m(src2lab[i].
y *pixsizeY_m);
864 string output(
"Processor '" +
name() +
"' finds bragg peaks." +
867 "'. Threshold '" + threshparam.toStdString() +
868 "'. MinSignalToNoiseRatio '" +
toString(_minSnr) +
869 "'. MinPixels '" +
toString(_minNbrPixels) +
871 "'. Using input histogram :" +
_imagePP->name() +
872 "'. Wavelength :" + wlparam.toStdString() +
873 "'. Detector Distance :" + ddparam.toStdString() +
874 "'. Geomfile :" + filename +
875 "'. Convert Cheetah to CASS :" + (convertCheetahToCASSLayout?
"true":
"false") +
877 "'. Condition is '" +
_condition->name() +
"'");
885 return wavelength.getValue();
892 return detdist.getValue();
899 return thresh.getValue();
919 if (col < box.first ||
_imageShape.first - box.first < col ||
920 row < box.second ||
_imageShape.second - box.second < row ||
922 (row - box.second) /
_section.second != (row + box.second) /
_section.second)
926 for (shape_t::second_type bRow = -box.second; bRow <= box.second; ++bRow)
928 for (shape_t::first_type bCol = -box.first; bCol <= box.first; ++bCol)
939 if (!qFuzzyIsNull(bPixel))
951 bool boxsizeincreased(
false);
966 boxsizeincreased =
true;
970 boxsizeincreased =
false;
973 while(boxsizeincreased);
997 vector<bool> checkedPixels(image.
size(),
false);
1005 vector<bool>::iterator checkedPixel(checkedPixels.begin());
1009 for (;
pixel != ImageEnd; ++
pixel,++idx, ++checkedPixel)
1020 if (*
pixel < thresh)
1050 vector<index_t> peakIdxs;
1051 peakIdxs.push_back(idx);
1052 *checkedPixel =
true;
1053 for (
size_t pix=0; pix < peakIdxs.size(); ++pix)
1055 const index_t pixpos(peakIdxs[pix]);
1058 while(ngbrOffset != neighboursEnd)
1060 const index_t ngbrIdx(pixpos + *ngbrOffset++);
1068 if (box.first < abs(col - ngbrCol) ||
1069 box.second < abs(row - ngbrRow))
1071 if (checkedPixels[ngbrIdx])
1074 const pixelval_t ngbrPixelWOBckgnd(ngbrPixel - mean);
1075 if ((
_minSnr * stdv) < ngbrPixelWOBckgnd)
1077 peakIdxs.push_back(ngbrIdx);
1078 checkedPixels[ngbrIdx] =
true;
1095 index_t min_radiussq=max(box.first,box.second)*max(box.first,box.second);
1096 for (
int bRow = -box.second; bRow <= box.second; ++bRow)
1098 for (
int bCol = -box.first; bCol <= box.first; ++bCol)
1101 if (checkedPixel[bLocIdx])
1104 const pixelval_t bPixelWOBckgnd(bPixel - mean);
1105 const index_t radiussq(bRow*bRow + bCol*bCol);
1106 if (radiussq > max_radiussq)
1107 max_radiussq = radiussq;
1108 if (radiussq < min_radiussq)
1109 min_radiussq = radiussq;
1110 integral += bPixelWOBckgnd;
1111 weightCol += (bPixelWOBckgnd * (bCol+col));
1112 weightRow += (bPixelWOBckgnd * (bRow+row));
1114 checkedPixel[bLocIdx] =
true;
1180 shape_t threshShape = srcThreshHist.shape();
1184 if (srcImageHist.dim() != 2)
1185 throw invalid_argument(
"pp209:loadSettings '" +
name() +
1186 "': image processor '" +
_imagePP->name() +
1187 "' doesn't contain a 2d result");
1188 if (srcThreshHist.dim() != 2)
1189 throw invalid_argument(
"pp209:loadSettings '" +
name() +
1190 "': threshold processor '" +
_threshPP->name() +
1191 "' doesn't contain a 2d result");
1192 if (_imageShape.first != threshShape.first)
1193 throw invalid_argument(
"pp209:loadSettings '" +
name() +
1194 "': threshold processor '" +
_threshPP->name() +
1195 "' x-size '" +
toString(threshShape.first) +
1196 "' while image processor '" +
_imagePP->name() +
1197 "' has x-size '" +
toString(_imageShape.first));
1198 if (_imageShape.second != threshShape.second)
1199 throw invalid_argument(
"pp209:loadSettings '" +
name() +
1200 "': threshold processor '" +
_threshPP->name() +
1201 "' y-size '" +
toString(threshShape.second) +
1202 "' while image processor '" +
_imagePP->name() +
1203 "' has y-size '" +
toString(_imageShape.second));
1215 string output(
"Processor '" +
name() +
"' clusters pixels above threshold in '" +
1219 "'. Condition is '" +
_condition->name() +
"'");
1238 vector<bool> checkedPixels(image.
size(),
false);
1245 vector<bool>::iterator checkedPixel(checkedPixels.begin());
1250 for (;
pixel != ImageEnd; ++
pixel, ++idx, ++checkedPixel, ++thresh)
1259 *checkedPixel =
true;
1277 vector<index_t> pixIdxs;
1278 pixIdxs.push_back(idx);
1279 for (
size_t pix(0); pix < pixIdxs.size(); ++pix)
1281 const index_t pixpos(pixIdxs[pix]);
1284 while(ngbrOffset != neighboursEnd)
1286 const index_t ngbrIdx(pixpos + *ngbrOffset++);
1296 if (checkedPixels[ngbrIdx])
1299 checkedPixels[ngbrIdx] =
true;
1301 if ((
_factor * thresholds[ngbrIdx])< image[ngbrIdx])
1302 pixIdxs.push_back(ngbrIdx);
1320 vector<index_t>::const_iterator pixIdx(pixIdxs.begin());
1321 vector<index_t>::const_iterator pixIdxEnd(pixIdxs.end());
1322 for (; pixIdx != pixIdxEnd; ++pixIdx)
1331 weightCol += (pixVal *
static_cast<pixelval_t>(pixCol));
1332 weightRow += (pixVal *
static_cast<pixelval_t>(pixRow));
1335 if (maxPixVal < pixVal)
1338 maxPixIdx = *pixIdx;
1344 if (maxCol < pixCol)
1346 if (pixCol < minCol)
1348 if (maxRow < pixRow)
1350 if (pixRow < minRow)
1358 peak[
MaxADU] = maxPixVal;
1359 peak[
Index] = maxPixIdx;
1360 peak[
Column] = maxPixCol;
1361 peak[
Row] = maxPixRow;
1367 peak[
RowSize] = maxRow - minRow;
1396 _minSnr = s.
value(
"MinSignalToNoiseRatio",8).toFloat();
1397 _minNbrSnr = s.
value(
"MinSignalToNoiseRatioForNeighbours",4).toFloat();
1401 _box = make_pair(s.
value(
"BoxSizeX", 5).toInt(),
1402 s.
value(
"BoxSizeY",5).toInt());
1403 _section = make_pair(s.
value(
"SectionSizeX", 1024).toUInt(),
1404 s.
value(
"SectionSizeY",512).toUInt());
1432 string output(
"Processor '" +
name() +
"' finds bragg peaks using mad." +
1433 ". Boxsize '" + to_string(
_box.first)+
"x"+ to_string(
_box.second)+
1434 "'. SectionSize '" + to_string(_section.first)+
"x"+ to_string(_section.second)+
1436 "'. MinSignalToNoiseRatio '" + to_string(
_minSnr) +
1438 "'. Condition is '" +
_condition->name() +
"'");
1454 vector<bool> checkedPixels(image.
size(),
false);
1455 vector<bool>::iterator checkedPixel(checkedPixels.begin());
1461 for (;
pixel != ImageEnd; ++
pixel,++idx, ++checkedPixel)
1482 const shape_t::first_type colLow (col -
_box.first);
1483 const shape_t::first_type colHigh(col +
_box.first);
1484 const shape_t::second_type rowLow (row -
_box.second);
1485 const shape_t::second_type rowHigh(row +
_box.second);
1491 const int colLowSection (colLow /
_section.first);
1492 const int colHighSection(colHigh /
_section.first);
1493 const int rowLowSection (rowLow /
_section.second);
1494 const int rowHighSection(rowHigh /
_section.second);
1495 if (colLowSection != colHighSection ||
1496 rowLowSection != rowHighSection)
1505 vector<float> medCont;
1506 bool isHighest(
true);
1507 for (shape_t::second_type bRow(rowLow);(isHighest) && (bRow < rowHigh); ++bRow)
1509 for (shape_t::first_type bCol(colLow); (isHighest) && (bCol < colHigh); ++bCol)
1512 const float bPixel(image[bCol + bRow*
_imageShape.first]);
1513 if ( *
pixel < bPixel)
1518 medCont.push_back(bPixel);
1525 const size_t medianpos(0.5*medCont.size());
1526 const auto target(medCont.begin() + medianpos);
1527 std::nth_element(medCont.begin(), target, medCont.end());
1528 const float median(*target);
1529 for (
auto &val : medCont) val = fabs(val-median);
1530 std::nth_element(medCont.begin(), target, medCont.end());
1531 const float mad((*target)*1.4862);
1538 const float snr((*
pixel - median) / mad);
1555 vector<index_t> peakIdxs;
1556 peakIdxs.push_back(idx);
1557 *checkedPixel =
true;
1558 bool isGoodSpot(
true);
1559 for (
size_t pix=0; isGoodSpot && (pix < peakIdxs.size()); ++pix)
1561 const index_t pixpos(peakIdxs[pix]);
1564 while(ngbrOffset != neighboursEnd)
1566 const index_t ngbrIdx(pixpos + *ngbrOffset++);
1574 if (
_box.first < abs(col - ngbrCol) ||
1575 _box.second < abs(row - ngbrRow))
1577 if (checkedPixels[ngbrIdx])
1579 checkedPixels[ngbrIdx] =
true;
1584 if (abs(ngbrPixel -
_badPixVal) < std::numeric_limits<pixelval_t>::epsilon())
1589 const pixelval_t ngbrPixelWOBckgnd(ngbrPixel - median);
1592 peakIdxs.push_back(ngbrIdx);
1614 for (
int bRow(-
_box.second); bRow <=
_box.second; ++bRow)
1616 for (
int bCol(-
_box.first); bCol <=
_box.first; ++bCol)
1620 const pixelval_t bPixelWOBckgnd(bPixel - median);
1621 if (checkedPixel[bLocIdx])
1623 const index_t radiussq(bRow*bRow + bCol*bCol);
1624 if (radiussq > max_radiussq)
1625 max_radiussq = radiussq;
1626 if (radiussq < min_radiussq)
1627 min_radiussq = radiussq;
1628 integral += bPixelWOBckgnd;
1629 weightCol += (bPixelWOBckgnd * (bCol+col));
1630 weightRow += (bPixelWOBckgnd * (bRow+row));
1635 else if ((
_minNbrSnr * mad) < bPixelWOBckgnd)
1639 checkedPixel[bLocIdx] =
true;
result_t::storage_t::value_type pixelval_t
define the type of the pixel in image
CachedList::item_type result_t
define the results
shared_pointer _noisePP
processor containing the noise image for thresholding
shared_pointer _wavelengthPP
pp containing wavelength in case its not fixed
storage_t::const_iterator const_iterator
a const iterator on the storage
void addDatum(const value_type &datum)
add a datum to the distribution
virtual void loadSettings(size_t)
load the settings of this pp
double _detdist
the detector distance in case its fixed
pixelval_t _threshold
pixel threshold to be exceeded
float _minSnr
the min signal to noise ratio that needs to be exceeded
std::tr1::function< double(const CASSEvent::id_t &)> _getLambda
function that gets the wavelength
void appendRows(const storage_t &rows)
add row(s) to the result
double lambdaFromProcessor(const CASSEvent::id_t &id)
retrieve the wavelength from the processor
size_t _idxCol
the number of the column where the global index of the pixel is
double distanceFromProcessor(const CASSEvent::id_t &id)
retrieve the detector distance from the processor
pp209(const name_t &name)
constructor
Event to store all LCLS Data.
virtual void createHistList(result_t::shared_pointer result)
create result list.
float _minNeighbourSNR
the min signal to noise ratio that needs to be exceeded
bool fuzzycompare(const T &first, const T &second)
fuzzy compare two floating point variables
const_iterator end() const
retrieve iterator to the end of storage
result_t::value_t pixelval_t
define the values of the pixels
shared_pointer _table
pp containing the results
counter_type count() const
retrieve the number of datum that have been added
std::tr1::function< double(const CASSEvent::id_t &)> _getDistance
function that gets the detectordistance
neighbourList_t _neighbourOffsets
the list of offsets to next neighbours
double _wavelength
the wavelength in case its fixed
shape_t _box
the size of the box within which the peak should lie
pp204(const name_t &name)
constructor
float _threshold
pixel threshold to be exceeded
count_type nbrUpperOutliers()
retrieve the number of outliers higher than the distribution used
float _multiplier
multiplier for the noise threshold
virtual void process(const CASSEvent &, result_t &)
process event
result_t::storage_t table_t
definition of the table
virtual void process(const CASSEvent &, result_t &)
process event
const name_t name() const
retrieve the name of this processor
result_t::storage_t table_t
definition of the table
stat_t::value_type _minSnr
minimum Signal to Noise Ratio thats is needed for a pixel to be an outlier
virtual void loadSettings(size_t)
load the settings for this processor
shared_pointer _hist
pp containing 2d histogram
value_type mean()
retrieve the mean of the distribution without outliers
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
std::pair< int, int > _box
the size of the box within which the peak should lie
statistics calculator for a cummulative statistic, removes outliers
pixelval_t thresholdFromProcessor(const CASSEvent::id_t &id)
retrieve the threshold from the processor
size_type size() const
return the raw size of the storage
Type value_type
define the value type
uint64_t id_t
define the id type
statistics calculator for a cummulative statistic
std::vector< pos_t > conversion_t
define the conversion table type
std::pair< size_t, size_t > _sectionSize
size of a image section
std::pair< int, int > _boxsize
void resetTable()
reset the table like result
virtual void loadSettings(size_t)
load the settings of this pp
int getBoxStatistics(result_t::const_iterator centerPixel, const imagepos_t nColumns, pixelval_t &mean, pixelval_t &stdv, int &count)
check highest pixel and generate the mean and standart deviation
substract the median of the integral from the integral and use
virtual void process(const CASSEvent &, result_t &)
process event
shared_pointer _detdistPP
pp containing detector distance in case its not fixed
stat_t::count_type _minNbrPixels
the minimum nbr of pixels in the bragg peak
value_type mean() const
retrieve the mean of the distribution
conversion_t generateConversionMap(const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
parse the geom file and generate a lookup table
int64_t index_t
define the index in the image
T square(const T &val)
multiply number by itself
std::pair< int, int > _section
size of a image section
shared_pointer _imagePP
processor containing the image to find the bragg peaks in
static void add(Level level, const std::string &line)
add a string to the log
const_iterator begin() const
retrieve a iterator for read access to beginning
count_type nbrPointsUsed()
retrieve the number of points used in the statistics
fromStdString(const std::string &str)
virtual void process(const CASSEvent &, result_t &)
process event
double distanceFromConstant(const CASSEvent::id_t &)
retrieve the constant detector distance
std::tr1::function< pixelval_t(const CASSEvent::id_t &)> _thresh
function that gets the detectordistance
pp210(const name_t &name)
constructor
shared_pointer _hist
processor containing the image to find the bragg peaks in
base class for processors.
shape_t _imageShape
size of the incomming image
shared_pointer setupDependency(const std::string &depVarName, const name_t &name="")
setup the dependecy.
pixelval_t _minNbrSnr
minimum snr when pixel is an neighbour
result_t::value_t _drawInnerValue
std::pair< imagepos_t, imagepos_t > _section
size of a image section
result_t::value_t _drawVal
draw flags as bitmask
std::vector< double > _src2labradius
the conversion table from raw to lab
const axis_t & axis() const
read access to the axis
virtual void process(const CASSEvent &, result_t &)
process event
neighbourList_t _neighbourOffsets
the list of offsets to next neighbours
result_t::storage_t table_t
definition of the table
shape_t _imageShape
size of the incomming image
file contains declaration of classes and functions that help other processors to do their job...
virtual void loadSettings(size_t)
load the settings of this pp
neighbourList_t _neighbourOffsets
the list of offsets to next neighbours
double lambdaFromConstant(const CASSEvent::id_t &)
retrieve the constant wavelength
shape_t _section
size of a image section
result_t::storage_t::value_type pixelval_t
define the type of the pixel in image
QReadWriteLock lock
lock for locking operations on the data of the container
bool fuzzyIsNull(const T &val)
fuzzy compare a floating point number to 0
file contains global definitions for project cass
contains processors that will extract pixels of interrest from 2d histograms.
size_t _maxAdditionalPixels
pixel value of a bad pixel
pp206(const name_t &name)
constructor
float _minRatio
minimum ratio of nbr of points used for statistics to nbr of outliers
class to parse and retrieve info from geom files.
std::string toString(const Type &t)
convert any type to a string
shared_pointer _hist
pp containing 2d histogram
std::pair< index_t, index_t > shape_t
define the shape of the image
result_t::storage_t table_t
definition of the table
std::pair< index_t, index_t > shape_t
define the shape of the image
shared_pointer _imagePP
processor containing the image to find the bragg peaks in
value(const QString &key, const QVariant &defaultValue=QVariant()
virtual void process(const CASSEvent &, result_t &)
process event
int64_t index_t
define the index in the image
stat_t::count_type _minNbrPixels
the minimum nbr of pixels in the bragg peak
pp205(const name_t &name)
constructor
std::pair< imagepos_t, imagepos_t > _box
the size of the box within which the peak should lie
void addDatum(const value_type &datum)
add a datum to the container
storage_t::iterator iterator
a iterator on the storage
shared_pointer _threshPP
processor containing the threshold for each pixel of the image
std::pair< size_t, size_t > _boxSize
the size of the box used for the median filter
pixelval_t _factor
the factor that the pixelwise threshold is multuplied with
void setupGeneral()
general setup of the processor
shape_t _imageShape
size of the incomming image
result_t::storage_t::value_type pixelval_t
define the type of the pixel in image
file contains specialized class that do the settings for cass
pp208(const name_t &name)
constructor
int _minBckgndPixels
min amount of pixels for the background calc
int imagepos_t
define the positions in the image
int isNotHighest(result_t::const_iterator pixel, const index_t linIdx, shape_t box, stat_t &stat)
check if pixel is not highest within box
shape_t _box
the size of the box within which the peak should lie
float _threshold
pixel threshold to be exceeded
shape_t _section
size of a image section
pixelval_t thresholdFromConstant(const CASSEvent::id_t &id)
retrieve the threshold constant
void reset()
reset the container
shared_pointer _condition
pointer to the processor that will contain the condition
pixelval_t _threshold
pixel threshold to be exceeded
shared_pointer _imagePP
processor containing the image to find the bragg peaks in
shape_t shape() const
return the shape of the result
bool setupCondition(bool defaultConditionType=true)
setup the condition.
std::string name_t
define the name type
shared_pointer _imagePP
processor containing the image
contains a logger for cass
virtual void loadSettings(size_t)
load the settings of this pp
int16_t pixel
define a pixel
stat_t::value_type _minSnr
minimum Signal to Noise Ratio thats is needed for a pixel to be an outlier
virtual void loadSettings(size_t)
load the settings of this pp
result_t::storage_t table_t
definition of the table
virtual void loadSettings(size_t)
load the settings of this pp
value_type stdv()
retrieve the standart deviation of the distribution
size_type datasize() const
return the size of the data as determined by the axis
virtual void process(const CASSEvent &, result_t &)
process event
int64_t index_t
define the index in the image
value_type stdv() const
retrieve the standart deviation of the distribution
beginGroup(const QString &prefix)
pixelval_t _badPixVal
pixel value of a bad pixel
shared_pointer _threshPP
pp containing threshold in case its not fixed
int _peakRadiusSq
the square size of bragg peak radius
int getBoxStatistics(result_t::const_iterator pixel, const index_t linIdx, const shape_t &box, stat_t &stat)
retrieve the box statistics
set up how to create the noise