ProSHADE  0.7.6.6 (JUL 2022)
Protein Shape Detection
ProSHADE_internal_peakSearch Namespace Reference

This namespace contains all the functions required for peak searching in 3D maps. More...

Functions

std::vector< proshade_double * > findAllPointsAboveNeighbours (proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double *medianIQR)
 This function finds all indices with higher value then all neighbours. More...
 
void pointsAboveNeighboursRemoveSmallHeight (std::vector< proshade_double * > *pointVec, proshade_double *medianIQR, proshade_double noIQRs)
 This function clears the 'higher than neighbour' vector from background values. More...
 
void allocatePeakOptimisationMemory (proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
 This function allocates and checks all the peak optimisation memory. More...
 
void releasePeakOptimisationMemory (proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
 This function deletes all the peak optimisation memory. More...
 
void optimisePeakPositions (std::vector< proshade_double * > *pointVec, proshade_signed peakSize, proshade_signed band)
 This function optimises all the peaks in the input vector using the values of their neighbours. More...
 
std::vector< proshade_double * > getAllPeaksNaive (proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double noIQRs)
 This function finds peaks in the 3D map using the "naive" approach. More...
 
void getBestPeakEulerAngsNaive (proshade_complex *map, proshade_unsign dim, proshade_double *eulA, proshade_double *eulB, proshade_double *eulG, ProSHADE_settings *settings)
 This function finds the highest peaks optimised Euler angles using the "naive" approach. More...
 
void allocateSmoothingZScoreMemory (proshade_unsign dim, proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap, proshade_unsign smLag)
 This function allocates the memory required for smoothed Z score computation. More...
 
void releaseSmoothingZScoreMemory (proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap)
 This function releases the memory required for smoothed Z score computation. More...
 
void getSmoothedZScore1D (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals)
 This function computes the 1D peaks for a 1D input array and returns array of int's as signal. More...
 
void getXAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *YZMap)
 This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs. More...
 
void getYAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XZMap)
 This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs. More...
 
void getZAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XYMap)
 This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs. More...
 
void findAllPointNeighbours (proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign *visitedMap, proshade_signed dim, proshade_signed x, proshade_signed y, proshade_signed z, std::vector< proshade_unsign > *retVals)
 This is a support function for the Z-score peak detection. It is currently not being used. More...
 
void findAllDisconnectedIslands (proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign dim, std::vector< proshade_unsign > *allIslandBests)
 This function combines the three Z score maps, locates individual islands and returns a vector of highest point indices for each such island. More...
 
void findAllSmoothedZScorePeaksWithNeighbours (proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_signed dim, proshade_signed peakSize, std::vector< proshade_double * > *allPeaksWithNeighbours)
 This function firstly determines the highest peak of all smoothed Z score islands and then returns this point as well as all its neighbours. More...
 
std::vector< proshade_double * > getAllPeaksSmoothedZ (proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize)
 This function finds peaks in the 3D map using the smoothed Z score approach. More...
 
void getBestPeakEulerAngsSmoothedZ (proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize, proshade_double *eulA, proshade_double *eulB, proshade_double *eulG)
 This function finds the highest peaks optimised Euler angles using the smoothed Z score approach. More...
 

Detailed Description

This namespace contains all the functions required for peak searching in 3D maps.

Peak searching may be one of the bottlenecks of the "old" ProSHADE and therefore a dedicated header with functions related to 3D peak searching is created to allow more testing and work to be done on this task.

Function Documentation

◆ allocatePeakOptimisationMemory()

void ProSHADE_internal_peakSearch::allocatePeakOptimisationMemory ( proshade_double *&  avgMat,
proshade_double *&  hlpMat,
proshade_double *&  eA,
proshade_double *&  eB,
proshade_double *&  eG,
proshade_double *&  uAV 
)

This function allocates and checks all the peak optimisation memory.

Parameters
[in]avgMatThe matrix which will take the weighted sum of the neighbour values.
[in]hlpMatThe helper matrix to store temporary results.
[in]eAThe Euler angle alpha value.
[in]eBThe Euler beta alpha value.
[in]eGThe Euler gamma alpha value.
[in]uAVThe U and V^T matrices resulting from the SVD.

Definition at line 161 of file ProSHADE_peakSearch.cpp.

162 {
163  //================================================ Allocate the memory
164  avgMat = new proshade_double [9];
165  hlpMat = new proshade_double [9];
166  eA = new proshade_double;
167  eB = new proshade_double;
168  eG = new proshade_double;
169  uAV = new proshade_double [18];
170 
171  //================================================ Check the memory allocation
172  ProSHADE_internal_misc::checkMemoryAllocation ( avgMat, __FILE__, __LINE__, __func__ );
173  ProSHADE_internal_misc::checkMemoryAllocation ( hlpMat, __FILE__, __LINE__, __func__ );
174  ProSHADE_internal_misc::checkMemoryAllocation ( eA, __FILE__, __LINE__, __func__ );
175  ProSHADE_internal_misc::checkMemoryAllocation ( eB, __FILE__, __LINE__, __func__ );
176  ProSHADE_internal_misc::checkMemoryAllocation ( eG, __FILE__, __LINE__, __func__ );
177  ProSHADE_internal_misc::checkMemoryAllocation ( uAV, __FILE__, __LINE__, __func__ );
178 
179  //================================================ Done
180  return ;
181 
182 }

◆ allocateSmoothingZScoreMemory()

void ProSHADE_internal_peakSearch::allocateSmoothingZScoreMemory ( proshade_unsign  dim,
proshade_double *&  scoreOverVals,
proshade_signed *&  signals,
proshade_double *&  filteredY,
proshade_double *&  avgFilter,
proshade_double *&  stdFilter,
proshade_double *&  subVec,
proshade_double *&  medianIQR,
proshade_double *&  YZMap,
proshade_double *&  XZMap,
proshade_double *&  XYMap,
proshade_unsign  smLag 
)

This function allocates the memory required for smoothed Z score computation.

Parameters
[in]dimThe size of one dimension of the map (assuming cube map).
[in]scoreOverValsPointer to where the 1D cuts from the 3D map will be saved.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]YZMapPointer to where the X-axis peaks will be saved.
[in]XZMapPointer to where the Y-axis peaks will be saved.
[in]XYMapPointer to where the Z-axis peaks will be saved.
[in]PeakMapPointer to where the axis peak combinations will be saved.
[in]smLagThe size of the smoothing window.

Definition at line 419 of file ProSHADE_peakSearch.cpp.

420 {
421  //================================================ Allocate the memory
422  signals = new proshade_signed[dim];
423  scoreOverVals = new proshade_double[dim];
424  filteredY = new proshade_double[dim];
425  avgFilter = new proshade_double[dim];
426  stdFilter = new proshade_double[dim];
427  subVec = new proshade_double[smLag];
428  medianIQR = new proshade_double[2];
429  YZMap = new proshade_double[dim * dim * dim];
430  XZMap = new proshade_double[dim * dim * dim];
431  XYMap = new proshade_double[dim * dim * dim];
432 
433  //================================================ Check memory allocation
434  ProSHADE_internal_misc::checkMemoryAllocation ( signals, __FILE__, __LINE__, __func__ );
435  ProSHADE_internal_misc::checkMemoryAllocation ( scoreOverVals, __FILE__, __LINE__, __func__ );
436  ProSHADE_internal_misc::checkMemoryAllocation ( filteredY, __FILE__, __LINE__, __func__ );
437  ProSHADE_internal_misc::checkMemoryAllocation ( avgFilter, __FILE__, __LINE__, __func__ );
438  ProSHADE_internal_misc::checkMemoryAllocation ( stdFilter, __FILE__, __LINE__, __func__ );
439  ProSHADE_internal_misc::checkMemoryAllocation ( subVec, __FILE__, __LINE__, __func__ );
440  ProSHADE_internal_misc::checkMemoryAllocation ( medianIQR, __FILE__, __LINE__, __func__ );
441  ProSHADE_internal_misc::checkMemoryAllocation ( YZMap, __FILE__, __LINE__, __func__ );
442  ProSHADE_internal_misc::checkMemoryAllocation ( XZMap, __FILE__, __LINE__, __func__ );
443  ProSHADE_internal_misc::checkMemoryAllocation ( XYMap, __FILE__, __LINE__, __func__ );
444 
445  //================================================ Done
446  return ;
447 
448 }

◆ findAllDisconnectedIslands()

void ProSHADE_internal_peakSearch::findAllDisconnectedIslands ( proshade_complex *  map,
proshade_double *  YZMap,
proshade_double *  XZMap,
proshade_double *  XYMap,
proshade_unsign  dim,
std::vector< proshade_unsign > *  allIslandBests 
)

This function combines the three Z score maps, locates individual islands and returns a vector of highest point indices for each such island.

This function considers each point common to all the three input maps and checks if this point has a signal along all three axes (i.e. is a peak in terms of the 3D smoothed Z score). If so, it finds all its neighbours and from this set (island), it finds the one point with the highest height. It then saves the index of this point and proceeds to another common point in the three input maps.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]YZMapThe map containing peaks detected along the X-axis dimension using the smoothed Z score method.
[in]XZMapThe map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
[in]XYMapThe map containing peaks detected along the z-axis dimension using the smoothed Z score method.
[in]dimThe size of one dimension of the map (assuming cube map).
[in]allIslandBestsA vector which will be filled with the indices of the highest height point indices for each island.

Definition at line 778 of file ProSHADE_peakSearch.cpp.

779 {
780  //================================================ Initialise local variables
781  std::vector< proshade_unsign > ret;
782  std::vector< proshade_unsign > thisIsland;
783  proshade_unsign* visitedMap = new proshade_unsign[dim*dim*dim];
784  ProSHADE_internal_misc::checkMemoryAllocation ( visitedMap, __FILE__, __LINE__, __func__ );
785  for ( proshade_unsign i = 0; i < ( dim * dim * dim ); i++ ) { visitedMap[i] = 0; }
786  proshade_unsign index, maxIndex;
787  proshade_double maxHeight;
788 
789  //================================================ For each point
790  for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
791  {
792  for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
793  {
794  for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
795  {
796  //==================================== Find index
797  index = xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt;
798 
799  //==================================== If already visited, next point
800  if ( visitedMap[index] == 1 ) { continue; }
801  else { visitedMap[index] = 1; }
802 
803  //==================================== If not peak, next point
804  const FloatingPoint< proshade_double > lhs ( YZMap[index] + XZMap[index] + XYMap[index] ), rhs ( 3.0 );
805  if ( !lhs.AlmostEquals ( rhs ) ) { continue; }
806 
807  //==================================== This is a new island! Save this point
808  thisIsland.clear ( );
809  ProSHADE_internal_misc::addToUnsignVector ( &thisIsland, index );
810 
811  //==================================== ... and find all neighbours
812  findAllPointNeighbours ( YZMap, XZMap, XYMap, visitedMap, static_cast<proshade_signed>(dim), static_cast<proshade_signed>(xIt), static_cast<proshade_signed>(yIt), static_cast<proshade_signed>(zIt), &thisIsland );
813 
814  //==================================== Find the largest of the island peaks
815  maxHeight = 0.0;
816  maxIndex = 0;
817  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( thisIsland.size() ); iter++ )
818  {
819  if ( ( pow( map[thisIsland.at(iter)][0], 2.0 ) + pow( map[thisIsland.at(iter)][1], 2.0) ) > maxHeight )
820  {
821  maxHeight = pow( map[thisIsland.at(iter)][0], 2.0 ) + pow( map[thisIsland.at(iter)][1], 2.0 );
822  maxIndex = thisIsland.at(iter);
823  }
824  }
825 
826  //==================================== Save the results
827  ProSHADE_internal_misc::addToUnsignVector ( allIslandBests, maxIndex );
828  }
829  }
830  }
831 
832  //================================================ Release memory
833  delete[] visitedMap;
834 
835  //================================================ Done
836  return ;
837 
838 }

◆ findAllPointNeighbours()

void ProSHADE_internal_peakSearch::findAllPointNeighbours ( proshade_double *  YZMap,
proshade_double *  XZMap,
proshade_double *  XYMap,
proshade_unsign *  visitedMap,
proshade_signed  dim,
proshade_signed  x,
proshade_signed  y,
proshade_signed  z,
std::vector< proshade_unsign > *  retVals 
)

This is a support function for the Z-score peak detection. It is currently not being used.

This function should not really be present here, it is a support function for smoothed Z-score peak detection, which is currently not being used.

Parameters
[in]YZMapThe map containing peaks detected along the X-axis dimension using the smoothed Z score method.
[in]XZMapThe map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
[in]XYMapThe map containing peaks detected along the z-axis dimension using the smoothed Z score method.
[in]visitedMapThe map with 0 if point not yet considered and 1 if already done.
[in]dimThe size of one dimension of the map (assuming cube map).
[in]xThe X-axis position of the currently considered point.
[in]yThe Y-axis position of the currently considered point.
[in]zThe Z-axis position of the currently considered point.
[in]retValsA vector to which all neighbour indices will be added.

Definition at line 719 of file ProSHADE_peakSearch.cpp.

720 {
721  //================================================ Initialise local variables
722  proshade_signed newIter = 0;
723  proshade_signed peakX, peakY, peakZ;
724  proshade_signed xDim = static_cast<proshade_signed>(4 * pow ( ( dim / 2 ), 2 ));
725 
726  //================================================ Iterate through all neighbours
727  for ( proshade_signed xCh = -1; xCh <= +1; xCh++ )
728  {
729  for ( proshade_signed yCh = -1; yCh <= +1; yCh++ )
730  {
731  for ( proshade_signed zCh = -1; zCh <= +1; zCh++ )
732  {
733  //==================================== Do not use this point
734  if ( ( xCh == 0 ) && ( yCh == 0 ) && ( zCh == 0 ) ) { continue; }
735 
736  //==================================== Find the nieghbout peak indices (with periodicity)
737  peakX = x + xCh; if ( peakX >= dim ) { peakX -= dim; }; if ( peakX < 0 ) { peakX += dim; }
738  peakY = y + yCh; if ( peakY >= dim ) { peakY -= dim; }; if ( peakY < 0 ) { peakY += dim; }
739  peakZ = z + zCh; if ( peakZ >= dim ) { peakZ -= dim; }; if ( peakZ < 0 ) { peakZ += dim; }
740  newIter = peakX * xDim + peakY * dim + peakZ;
741 
742  //==================================== If already visited, next point
743  if ( visitedMap[newIter] == 1 ) { continue; }
744  else { visitedMap[newIter] = 1; }
745 
746  //==================================== If not peak, next point
747  const FloatingPoint< proshade_double > lhs ( YZMap[newIter] + XZMap[newIter] + XYMap[newIter] ), rhs ( 3.0 );
748  if ( lhs.AlmostEquals ( rhs ) ) { continue; }
749 
750  //==================================== This is a valid neighbour! Save
751  ProSHADE_internal_misc::addToUnsignVector ( retVals, static_cast< proshade_unsign > ( newIter ) );
752 
753  //==================================== ... and recurse!
754  findAllPointNeighbours ( YZMap, XZMap, XYMap, visitedMap, dim, peakX, peakY, peakZ, retVals );
755  }
756  }
757  }
758 
759  //================================================ Done
760  return ;
761 
762 }

◆ findAllPointsAboveNeighbours()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::findAllPointsAboveNeighbours ( proshade_complex *  map,
proshade_unsign  dim,
proshade_signed  peakSize,
proshade_double *  medianIQR 
)

This function finds all indices with higher value then all neighbours.

This function finds all map indices with higher height than all their neighbours (the size of neighbours in terms of surrounding points can be changed) and saves these as well as the neighbours into the output vector of double*. It also keeps track of the non-peak values and saves their median height and its IQR, so that the output vector could be cleared from these small (background) values.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]dimThe size of one dimension of the map (assuming cube map).
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]medianIQRPointer to double[2] array where median and IQR of non-peak values will be saved.
[out]XVector of pointers to double numbers, first is the 'peak' (x,y,z and height) and then all neighbours follow in sets of 4 numbers.

Definition at line 38 of file ProSHADE_peakSearch.cpp.

39 {
40  //================================================ Initialise local variables
41  std::vector< proshade_double* > ret;
42  std::vector< proshade_double > nonPeakVals;
43  proshade_double* retHlp = nullptr;
44  proshade_double pointHeight = 0.0;
45  proshade_signed x, y, z, peakX, peakY, peakZ, newIter, ptrIter;
46  proshade_signed xDim = static_cast< proshade_signed > ( std::pow ( dim, 2 ) );
47  proshade_signed yDim = static_cast< proshade_signed > ( dim );
48  bool breakPeak;
49 
50  //================================================ Check all points
51  for ( proshade_signed iter = 0; iter < static_cast< proshade_signed > ( pow( static_cast<proshade_unsign> ( dim ), 3 ) ); iter++ )
52  {
53  //============================================ Find point height
54  pointHeight = pow( map[iter][0], 2.0 ) + pow( map[iter][1], 2.0 );
55 
56  //============================================ Find the x, y and z
57  x = static_cast< proshade_signed > ( std::floor ( iter / xDim ) );
58  y = static_cast< proshade_signed > ( std::floor ( ( iter - x * xDim ) / yDim ) );
59  z = static_cast< proshade_signed > ( iter - x * xDim - y * yDim );
60 
61  //==================================== Initialise the output pointer
62  if ( retHlp == nullptr )
63  {
64  retHlp = new proshade_double[static_cast<proshade_unsign>( pow( ((peakSize*2)+1), 3) * 4 )];
65  ProSHADE_internal_misc::checkMemoryAllocation ( retHlp, __FILE__, __LINE__, __func__ );
66  }
67 
68  //============================================ Get the X surrounding values and check for all being lower than point in question
69  breakPeak = false;
70  ptrIter = 4;
71  for ( proshade_signed xCh = -peakSize; xCh <= +peakSize; xCh++ )
72  {
73  if ( breakPeak ) { break; }
74  for ( proshade_signed yCh = -peakSize; yCh <= +peakSize; yCh++ )
75  {
76  if ( breakPeak ) { break; }
77  for ( proshade_signed zCh = -peakSize; zCh <= +peakSize; zCh++ )
78  {
79  if ( breakPeak ) { break; }
80  if ( ( xCh == 0 ) && ( yCh == 0 ) && ( zCh == 0 ) ) { continue; }
81 
82  //================================ Find the nieghbout peak indices (with periodicity)
83  peakX = x + xCh; if ( peakX >= yDim ) { peakX = yDim - 1; }; if ( peakX < 0 ) { peakX = 0; }
84  peakY = y + yCh; if ( peakY >= yDim ) { peakY = yDim - 1; }; if ( peakY < 0 ) { peakY = 0; }
85  peakZ = z + zCh; if ( peakZ >= yDim ) { peakZ = yDim - 1; }; if ( peakZ < 0 ) { peakZ = 0; }
86  newIter = peakX * xDim + peakY * yDim + peakZ;
87 
88  //================================ If neighbour has higher value than index in question, break out
89  if ( ( pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 ) ) > pointHeight ) { breakPeak = true; break; }
90 
91  //================================ Save neighbour values for optimisation of peaks later
92  retHlp[ptrIter] = static_cast<proshade_double> ( peakX );
93  retHlp[ptrIter+1] = static_cast<proshade_double> ( peakY );
94  retHlp[ptrIter+2] = static_cast<proshade_double> ( peakZ );
95  retHlp[ptrIter+3] = pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 );
96  ptrIter += 4;
97  }
98  }
99  }
100  if ( breakPeak ) { ProSHADE_internal_misc::addToDoubleVector ( &nonPeakVals, pointHeight ); continue; }
101 
102  //============================================ If passing, save for returning
103  retHlp[0] = static_cast< proshade_double > ( x );
104  retHlp[1] = static_cast< proshade_double > ( y );
105  retHlp[2] = static_cast< proshade_double > ( z );
106  retHlp[3] = pointHeight;
108  retHlp = nullptr;
109  }
110 
111  //================================================ Save non-peak median and IQR
112  ProSHADE_internal_maths::vectorMedianAndIQR ( &nonPeakVals, medianIQR );
113 
114  //================================================ Release memory if need be
115  if ( retHlp != nullptr ) { delete[] retHlp; }
116 
117  //================================================ Done
118  return ( ret );
119 
120 }

◆ findAllSmoothedZScorePeaksWithNeighbours()

void ProSHADE_internal_peakSearch::findAllSmoothedZScorePeaksWithNeighbours ( proshade_complex *  map,
proshade_double *  YZMap,
proshade_double *  XZMap,
proshade_double *  XYMap,
proshade_signed  dim,
proshade_signed  peakSize,
std::vector< proshade_double * > *  allPeaksWithNeighbours 
)

This function firstly determines the highest peak of all smoothed Z score islands and then returns this point as well as all its neighbours.

This function firstly uses the findAllDisconnectedIslands function to combine the smoothed Z score maps and detect all discontinuous inslands in the combined map. Then, it uses the highest point in each island, finds all its neighbours as well as its X, Y and Z position and returns a vector containing all these values in a proshade_double pointer, which it allocates.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]YZMapThe map containing peaks detected along the X-axis dimension using the smoothed Z score method.
[in]XZMapThe map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
[in]XYMapThe map containing peaks detected along the z-axis dimension using the smoothed Z score method.
[in]dimThe size of one dimension of the map (assuming cube map).
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]allPeaksWithNeighboursA vector which will have the x, y, and z positions and heights of all peaks and all their neighbours.

Definition at line 854 of file ProSHADE_peakSearch.cpp.

855 {
856  //================================================ Initialise local variables
857  proshade_signed x, y, z, peakX, peakY, peakZ, newIter, ptrIter;
858  proshade_unsign noNeighbours = static_cast< proshade_unsign > ( std::pow( ( ( peakSize * 2 ) + 1 ), 3 ) * 4 );
859 
860  //================================================ Find all islands and their best representative
861  std::vector < proshade_unsign > allPeaksRepresentatives;
862  findAllDisconnectedIslands ( map, YZMap, XZMap, XYMap, static_cast< proshade_unsign > ( dim ), &allPeaksRepresentatives );
863 
864  //================================================ For each peak
865  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaksRepresentatives.size() ); iter++ )
866  {
867  //============================================ Reset loop
868  ptrIter = 0;
869 
870  //============================================ Determine x, y and z
871  z = ( static_cast< proshade_signed > ( allPeaksRepresentatives.at(iter) ) % (dim*dim) ) % dim;
872  y = ( static_cast< proshade_signed > ( allPeaksRepresentatives.at(iter) ) - z ) % (dim*dim) / dim;
873  x = ( static_cast< proshade_signed > ( allPeaksRepresentatives.at(iter) ) - z - ( y * dim ) ) / (dim*dim);
874 
875  //============================================ Allocate the memory
876  proshade_double* neighbours = new proshade_double[noNeighbours];
877  ProSHADE_internal_misc::checkMemoryAllocation ( neighbours, __FILE__, __LINE__, __func__ );
878  ProSHADE_internal_misc::addToDblPtrVector ( allPeaksWithNeighbours, neighbours );
879 
880  //============================================ Find all neighbours
881  for ( proshade_signed xCh = -peakSize; xCh <= +peakSize; xCh++ )
882  {
883  for ( proshade_signed yCh = -peakSize; yCh <= +peakSize; yCh++ )
884  {
885  for ( proshade_signed zCh = -peakSize; zCh <= +peakSize; zCh++ )
886  {
887  //================================ Find the nieghbout peak indices (with periodicity)
888  peakX = x + xCh; if ( peakX >= dim ) { peakX -= dim; }; if ( peakX < 0 ) { peakX += dim; }
889  peakY = y + yCh; if ( peakY >= dim ) { peakY -= dim; }; if ( peakY < 0 ) { peakY += dim; }
890  peakZ = z + zCh; if ( peakZ >= dim ) { peakZ -= dim; }; if ( peakZ < 0 ) { peakZ += dim; }
891  newIter = peakX * (dim*dim) + peakY * dim + peakZ;
892 
893  //================================ Save neighbour values for optimisation of peaks later
894  allPeaksWithNeighbours->at(iter)[ptrIter] = static_cast<proshade_double> ( peakX );
895  allPeaksWithNeighbours->at(iter)[ptrIter+1] = static_cast<proshade_double> ( peakY );
896  allPeaksWithNeighbours->at(iter)[ptrIter+2] = static_cast<proshade_double> ( peakZ );
897  allPeaksWithNeighbours->at(iter)[ptrIter+3] = pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 );
898  ptrIter += 4;
899  }
900  }
901  }
902 
903  //============================================ Release memory
904  delete[] neighbours;
905  }
906 
907  //================================================ Done
908  return ;
909 
910 }

◆ getAllPeaksNaive()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::getAllPeaksNaive ( proshade_complex *  map,
proshade_unsign  dim,
proshade_signed  peakSize,
proshade_double  noIQRs 
)

This function finds peaks in the 3D map using the "naive" approach.

This function uses the "naive" approach (used in early versions of ProSHADE) to find all significant peaks in a map. To do this, it firstly locates all map points which have higher value than all their neighbours in all directions. It also computes the median and IQR of all non-higher points and it then uses the median + x * IQR threshold (x is the noIQRs parameter) to remove all map points with value under this thereshold. Finally, it optimises all the remaining values using the weighted average of all the neighbour points. The final output then is a vector with a single entry for each passing peak; this array has 4 values, the alpha, beta and gamma Euler angle values and the maximum peak heigh.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]dimThe size of one dimension of the map (assuming cube map).
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]noIQRsThe number of IQRs from the median to determine minimal peak height.
[out]XVector of located peaks with pointers to arrays of 4 values: alpha, beta, gamma and peak heighht.

Definition at line 316 of file ProSHADE_peakSearch.cpp.

317 {
318  //================================================ Find all indices with higher value than all neighbours
319  std::vector< proshade_double* > allHigherIndices;
320  proshade_double* nonPeakMedianIQR = new proshade_double[2];
321  ProSHADE_internal_misc::checkMemoryAllocation ( nonPeakMedianIQR, __FILE__, __LINE__, __func__ );
322  allHigherIndices = findAllPointsAboveNeighbours ( map, dim, peakSize, nonPeakMedianIQR );
323 
324  //================================================ Remove all indices with too small height
325  pointsAboveNeighboursRemoveSmallHeight ( &allHigherIndices, nonPeakMedianIQR, noIQRs );
326 
327  //================================================ Optimise the peaks using the neighbour values
328  optimisePeakPositions ( &allHigherIndices, peakSize, dim/2 );
329 
330  //================================================ Release memory
331  delete[] nonPeakMedianIQR;
332 
333  //================================================ Done
334  return ( allHigherIndices );
335 
336 }

◆ getAllPeaksSmoothedZ()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::getAllPeaksSmoothedZ ( proshade_complex *  map,
proshade_unsign  dim,
proshade_double  smoothingFraction,
proshade_double  noIQRs,
proshade_signed  peakSize 
)

This function finds peaks in the 3D map using the smoothed Z score approach.

This function implements the smoothed Z-score peak detection. It is currently not being used and is most likely severly bugged.

Parameters
[in]mapPointer to 1D array holding the 3D map values in which the peaks are to be found. Map must be cube!
[in]dimThe size of one dimension of the map (assuming cube map).
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]noIQRsThe number of IQRs from the median to determine minimal peak height.
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[out]XVector of located peaks with pointers to arrays of 5 values: x, y, z, angle and peak heighht.

Definition at line 923 of file ProSHADE_peakSearch.cpp.

924 {
925  //================================================ Initialise local variables
926  std::vector< proshade_double* > allHigherIndices;
927  proshade_unsign smoothingLag = static_cast< proshade_unsign > ( std::floor ( smoothingFraction * static_cast< proshade_double > ( dim ) ) );
928  proshade_double ZScoreThreshold = noIQRs;
929  proshade_signed *signals;
930  proshade_double *scoreOverVals, *filteredY, *avgFilter, *stdFilter, *subVec, *medianIQR, *YZMap, *XZMap, *XYMap;
931 
932  //================================================ Sanity check
933  if ( dim <= smoothingLag + 2)
934  {
935  // throw error
936  }
937 
938  //================================================ Allocate required memory
939  allocateSmoothingZScoreMemory ( dim, scoreOverVals, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, YZMap, XZMap, XYMap, smoothingLag );
940 
941  //================================================ Get smoothed Z score peaks for X-axis arrays
942  getXAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, YZMap );
943 
944  //================================================ Get smoothed Z score peaks for Y-axis arrays
945  getYAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, XZMap );
946 
947  //================================================ Get smoothed Z score peaks for Y-axis arrays
948  getZAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, XYMap );
949 
950  //================================================ Put all dimension peaks together and detect disconnected islands
951  findAllSmoothedZScorePeaksWithNeighbours ( map, YZMap, XZMap, XYMap, static_cast< proshade_signed > ( dim ), peakSize, &allHigherIndices );
952 
953  //================================================ Optimise the peaks using the neighbour values
954  optimisePeakPositions ( &allHigherIndices, peakSize, dim/2 );
955 
956  //================================================ Release the required memory
957  releaseSmoothingZScoreMemory ( scoreOverVals, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, YZMap, XZMap, XYMap );
958 
959  //================================================ Done
960  return ( allHigherIndices );
961 
962 }

◆ getBestPeakEulerAngsNaive()

void ProSHADE_internal_peakSearch::getBestPeakEulerAngsNaive ( proshade_complex *  map,
proshade_unsign  dim,
proshade_double *  eulA,
proshade_double *  eulB,
proshade_double *  eulG,
ProSHADE_settings settings 
)

This function finds the highest peaks optimised Euler angles using the "naive" approach.

This function uses the same "naive" approach as discussed in the previous function. It firstly gets the full list of all "naive" peaks, it then optimises all such peaks and finds the largest (i.e. highest height) peak. For this single best peak, it finally returns the Euler angle values.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]dimThe size of one dimension of the map (assuming cube map).
[in]noIQRsThe number of IQRs from the median to determine minimal peak height.
[in]eulAPointer to where the Euler alpha angle value will be saved.
[in]eulBPointer to where the Euler beta angle value will be saved.
[in]eulGPointer to where the Euler gamma angle value will be saved.
[in]settingsThe ProSHADE_settings object containing all the values required for making decisions.

Definition at line 352 of file ProSHADE_peakSearch.cpp.

353 {
354  //================================================ Report progress
355  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Looking for Euler angles of highest peak.", settings->messageShift );
356 
357  //================================================ Get all peaks
358  std::vector< proshade_double* > allPeaks = getAllPeaksNaive ( map, dim, static_cast< proshade_signed > ( settings->peakNeighbours ), settings->noIQRsFromMedianNaivePeak );
359 
360  //================================================ Report progress
361  std::stringstream hlpSSP;
362  hlpSSP << "Found " << allPeaks.size() << " possible peaks.";
363  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSSP.str(), settings->messageShift );
364 
365  //================================================ Sanity check
366  if ( allPeaks.size() == 0 )
367  {
368  *eulA = 0.0;
369  *eulB = 0.0;
370  *eulG = 0.0;
371  return ;
372  }
373 
374  //================================================ Find the highest peak from the list
375  proshade_double highestPeak = 0.0;
376  proshade_unsign highestPeakIndex = 0;
377  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign>( allPeaks.size() ); iter++ )
378  {
379  if ( allPeaks.at(iter)[3] > highestPeak ) { highestPeak = allPeaks.at(iter)[3]; highestPeakIndex = iter; }
380  }
381 
382  //================================================ Get Euler ZYZ for the highest peak
383  *eulA = allPeaks.at(highestPeakIndex)[0];
384  *eulB = allPeaks.at(highestPeakIndex)[1];
385  *eulG = allPeaks.at(highestPeakIndex)[2];
386 
387  //================================================ Release memory
388  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaks.size() ); iter++ )
389  {
390  delete[] allPeaks.at(iter);
391  }
392 
393  //================================================ Report progress
394  std::stringstream hlpSS;
395  hlpSS << "Optimal Euler angles are " << *eulA << " ; " << *eulB << " ; " << *eulG << " with peak height " << highestPeak;
396  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str(), settings->messageShift );
397 
398  //================================================ Done
399  return ;
400 
401 }

◆ getBestPeakEulerAngsSmoothedZ()

void ProSHADE_internal_peakSearch::getBestPeakEulerAngsSmoothedZ ( proshade_complex *  map,
proshade_unsign  dim,
proshade_double  smoothingFraction,
proshade_double  noIQRs,
proshade_signed  peakSize,
proshade_double *  eulA,
proshade_double *  eulB,
proshade_double *  eulG 
)

This function finds the highest peaks optimised Euler angles using the smoothed Z score approach.

This function uses the best peak detected using the smoothed Z-score peak detection to compute its Euler angles. It is currently not being used and is most likely severly bugged.

Parameters
[in]mapPointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
[in]dimThe size of one dimension of the map (assuming cube map).
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]noIQRsThe number of IQRs from the median to determine minimal peak height.
[in]eulAPointer to where the Euler alpha angle value will be saved.
[in]eulBPointer to where the Euler beta angle value will be saved.
[in]eulGPointer to where the Euler gamma angle value will be saved.

Definition at line 976 of file ProSHADE_peakSearch.cpp.

977 {
978  //================================================ Get all peaks
979  std::vector< proshade_double* > allPeaks = getAllPeaksSmoothedZ ( map, dim, smoothingFraction, noIQRs, peakSize );
980 
981  //================================================ Find the highest peak from the list
982  proshade_double highestPeak = 0.0;
983  proshade_unsign highestPeakIndex = 0;
984  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign>( allPeaks.size() ); iter++ )
985  {
986  if ( allPeaks.at(iter)[4] > highestPeak ) { highestPeak = allPeaks.at(iter)[4]; highestPeakIndex = iter; }
987  }
988 
989  //================================================ Get Euler ZYZ from Angle-axis
990  proshade_double* rotMat = new proshade_double[9];
991  ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
992  ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat, allPeaks.at(highestPeakIndex)[0], allPeaks.at(highestPeakIndex)[1], allPeaks.at(highestPeakIndex)[2], allPeaks.at(highestPeakIndex)[3] );
993  ProSHADE_internal_maths::getEulerZYZFromRotMatrix ( rotMat, eulA, eulB, eulG );
994 
995  //================================================ Release memory
996  delete[] rotMat;
997  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaks.size() ); iter++ )
998  {
999  delete[] allPeaks.at(iter);
1000  }
1001 
1002  //================================================ Done
1003  return ;
1004 
1005 }

◆ getSmoothedZScore1D()

void ProSHADE_internal_peakSearch::getSmoothedZScore1D ( proshade_unsign  dim,
proshade_unsign  smoothingLag,
proshade_double  ZScoreThreshold,
proshade_signed *  signals,
proshade_double *  filteredY,
proshade_double *  avgFilter,
proshade_double *  stdFilter,
proshade_double *  subVec,
proshade_double *  medianIQR,
proshade_double *  scoreOverVals 
)

This function computes the 1D peaks for a 1D input array and returns array of int's as signal.

This function implements the smoothed Z score peak searching algorithm. It takes a number of previous values (assuming periodicity) and computes the median and IQR. It then checks if the current value is X IQR's from the median and reports peak if so. In this case, it also saves the value with decreased weight to make sure the sliding window for following indices will not have too high values due to previous peaks. If no peak is found, it saves the value as is. Finally, the function pre- computes the median and IQR for the next index and iterates.

Parameters
[in]dimThe size of one dimension of the map (assuming cube map).
[in]smoothingLagThe size of the smoothing window.
[in]ZScoreThresholdThe number of IQRs from median forming a peak.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]scoreOverValsPointer to where the 1D cuts from the 3D map live.

Definition at line 501 of file ProSHADE_peakSearch.cpp.

502 {
503  //================================================ Re-set the run
504  for ( proshade_unsign i = 0; i < dim; i++ ) { signals[i] = 0; avgFilter[i] = 0.0; stdFilter[i] = 0.0; filteredY[i] = 0.0; }
505  for ( proshade_unsign i = 0; i < smoothingLag; i++ ) { subVec[i] = scoreOverVals[i-smoothingLag+dim]; }
506  ProSHADE_internal_maths::arrayMedianAndIQR ( subVec, smoothingLag, medianIQR );
507  avgFilter[0] = medianIQR[0];
508  stdFilter[0] = medianIQR[1];
509 
510  //================================================ Find peaks for 1D array
511  for ( proshade_unsign i = 0; i < dim; i++)
512  {
513  //============================================ Is this peak?
514  if ( std::abs ( scoreOverVals[i] - avgFilter[i]) > ZScoreThreshold * stdFilter[i] )
515  {
516  if ( scoreOverVals[i] > avgFilter[i] )
517  {
518  signals[i] = 1;
519  }
520  else
521  {
522  signals[i] = -1;
523  }
524 
525  //======================================== Decrease influence for this window
526  if ( i != 0 ) { filteredY[i] = 0.5 * scoreOverVals[i] + (1 - 0.5) * filteredY[i - 1]; }
527  else { filteredY[i] = 0.5 * scoreOverVals[i]; }
528  }
529  else
530  {
531  signals[i] = 0;
532  filteredY[i] = scoreOverVals[i];
533  }
534 
535  //============================================ Filters adjustments
536  for ( proshade_signed subIt = 0; subIt < static_cast<proshade_signed> ( smoothingLag ); subIt++ )
537  {
538  if ( ( static_cast<proshade_signed>(i) + static_cast<proshade_signed>(subIt) - static_cast<proshade_signed>(smoothingLag) + 1 ) < 0 )
539  {
540  subVec[subIt] = scoreOverVals[( i + static_cast< proshade_unsign > ( subIt ) - smoothingLag + 1 ) + dim];
541  }
542  else
543  {
544  subVec[subIt] = filteredY[( i + static_cast< proshade_unsign > ( subIt ) - smoothingLag + 1 )];
545  }
546  }
547  ProSHADE_internal_maths::arrayMedianAndIQR ( subVec, smoothingLag, medianIQR );
548  avgFilter[i+1] = medianIQR[0];
549  stdFilter[i+1] = medianIQR[1];
550  }
551 
552  //================================================ Done
553  return ;
554 
555 }

◆ getXAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getXAxisArraysSmoothedZScorePeaks ( proshade_unsign  dim,
proshade_unsign  smoothingLag,
proshade_double  ZScoreThreshold,
proshade_signed *  signals,
proshade_double *  filteredY,
proshade_double *  avgFilter,
proshade_double *  stdFilter,
proshade_double *  subVec,
proshade_double *  medianIQR,
proshade_double *  scoreOverVals,
proshade_complex *  map,
proshade_double *  YZMap 
)

This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs.

This function iterates through all YZ map positions and at each, takes all the X values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the X-axis peaks of the map.

Parameters
[in]dimThe size of one dimension of the map (assuming cube map).
[in]smoothingLagThe size of the smoothing window.
[in]ZScoreThresholdThe number of IQRs from median forming a peak.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]scoreOverValsPointer to where the 1D cuts from the 3D map live.
[in]mapThe map in which the peaks are to be found.
[in]YZMapThe map where the results will be saved.

Definition at line 576 of file ProSHADE_peakSearch.cpp.

577 {
578  //================================================ For each YZ point
579  for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
580  {
581  for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
582  {
583  //======================================== Get all X values for this YZ position
584  for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
585  {
586  scoreOverVals[xIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
587  pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
588  }
589 
590  //======================================== Run 1D smoothed Z score algorithm
591  getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
592 
593  //======================================== Save signals to YZMap
594  for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
595  {
596  YZMap[xIt * static_cast< proshade_unsign > (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = static_cast< proshade_double > ( signals[xIt] );
597  }
598  }
599  }
600 
601  //================================================ Done
602  return ;
603 
604 }

◆ getYAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getYAxisArraysSmoothedZScorePeaks ( proshade_unsign  dim,
proshade_unsign  smoothingLag,
proshade_double  ZScoreThreshold,
proshade_signed *  signals,
proshade_double *  filteredY,
proshade_double *  avgFilter,
proshade_double *  stdFilter,
proshade_double *  subVec,
proshade_double *  medianIQR,
proshade_double *  scoreOverVals,
proshade_complex *  map,
proshade_double *  XZMap 
)

This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs.

This function iterates through all YZ map positions and at each, takes all the Y values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the Y-axis peaks of the map.

Parameters
[in]dimThe size of one dimension of the map (assuming cube map).
[in]smoothingLagThe size of the smoothing window.
[in]ZScoreThresholdThe number of IQRs from median forming a peak.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]scoreOverValsPointer to where the 1D cuts from the 3D map live.
[in]mapThe map in which the peaks are to be found.
[in]XZMapThe map where the results will be saved.

Definition at line 625 of file ProSHADE_peakSearch.cpp.

626 {
627  //================================================ For each XZ point
628  for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
629  {
630  for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
631  {
632  //======================================== Get all Y values for this XZ position
633  for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
634  {
635  scoreOverVals[yIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
636  pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
637  }
638 
639  //======================================== Run 1D smoothed Z score algorithm
640  getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
641 
642  //======================================== Save signals to YZMap
643  for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
644  {
645  XZMap[xIt * static_cast< proshade_unsign > (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = static_cast< proshade_double > ( signals[xIt] );
646  }
647  }
648  }
649 
650  //================================================ Done
651  return ;
652 
653 }

◆ getZAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getZAxisArraysSmoothedZScorePeaks ( proshade_unsign  dim,
proshade_unsign  smoothingLag,
proshade_double  ZScoreThreshold,
proshade_signed *  signals,
proshade_double *  filteredY,
proshade_double *  avgFilter,
proshade_double *  stdFilter,
proshade_double *  subVec,
proshade_double *  medianIQR,
proshade_double *  scoreOverVals,
proshade_complex *  map,
proshade_double *  XYMap 
)

This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs.

This function iterates through all XY map positions and at each, takes all the Z values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the Z-axis peaks of the map.

Parameters
[in]dimThe size of one dimension of the map (assuming cube map).
[in]smoothingLagThe size of the smoothing window.
[in]ZScoreThresholdThe number of IQRs from median forming a peak.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]scoreOverValsPointer to where the 1D cuts from the 3D map live.
[in]mapThe map in which the peaks are to be found.
[in]XYMapThe map where the results will be saved.

Definition at line 674 of file ProSHADE_peakSearch.cpp.

675 {
676  //================================================ For each XZ point
677  for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
678  {
679  for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
680  {
681  //======================================== Get all Y values for this XZ position
682  for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
683  {
684  scoreOverVals[yIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
685  pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
686  }
687 
688  //======================================== Run 1D smoothed Z score algorithm
689  getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
690 
691  //======================================== Save signals to YZMap
692  for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
693  {
694  XYMap[xIt * static_cast< proshade_unsign > (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = static_cast< proshade_double > ( signals[xIt] );
695  }
696  }
697  }
698 
699  //================================================ Done
700  return ;
701 
702 }

◆ optimisePeakPositions()

void ProSHADE_internal_peakSearch::optimisePeakPositions ( std::vector< proshade_double * > *  pointVec,
proshade_signed  peakSize,
proshade_signed  band 
)

This function optimises all the peaks in the input vector using the values of their neighbours.

This function takes the vector of arrays containing the peak and all its neighbours and proceeds to obtain the rotation matrices for the peak and all its neighbours. It then computes the weighted average matrix from the combination of all the matrices. By subjecting this weighted average matrix to SVD (using LAPACK) and combining the two rotation matrices (U and V^T), the optimised rotation matrix is obtained. This rotation matrix is then converted to Euler angles representation and these values are finally saved over the old all neighbours containing pointers. Thus, the number of peaks does not change, but each peak now only has 4 values - alpha, beta, gamma and peak height.

Parameters
[in]pointVecVector of double pointers as returned by pointsAboveNeighboursRemoveSmallHeight().
[in]peakSizeThe number of neighbouring points in single direction which should be considered as neighbours.
[in]bandThe maximum bandwidth of the computation.

Definition at line 221 of file ProSHADE_peakSearch.cpp.

222 {
223  //================================================ Initialise local variables
224  proshade_double *avgMat, *hlpMat, *eulA, *eulB, *eulG, *uAndV;
225  proshade_unsign noPoints = static_cast< proshade_unsign > ( std::pow( ( ( peakSize * 2 ) + 1 ), 3 ) * 4 );
226  proshade_double matWeight;
227 
228  //================================================ Allocate the required memory
229  allocatePeakOptimisationMemory ( avgMat, hlpMat, eulA, eulB, eulG, uAndV );
230 
231  //================================================ For each peak
232  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( pointVec->size() ); iter++ )
233  {
234  //============================================ Re-set loop
235  for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] = 0.0; }
236  matWeight = 0.0;
237 
238  //============================================ For each neighbout and the point itself
239  for ( proshade_unsign it = 0; it < noPoints; it += 4 )
240  {
241  //======================================== Get the Euler angles
242  ProSHADE_internal_maths::getEulerZYZFromSOFTPosition ( band, static_cast< proshade_signed > ( pointVec->at(iter)[it+0] ), static_cast< proshade_signed > ( pointVec->at(iter)[it+1] ), static_cast< proshade_signed > ( pointVec->at(iter)[it+2] ), eulA, eulB, eulG );
243 
244  //======================================== Convert Euler angles to rotation matrix
245  ProSHADE_internal_maths::getRotationMatrixFromEulerZYZAngles ( *eulA, *eulB, *eulG, hlpMat );
246 
247  //======================================== Add the matrix to the sum
248  for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] += hlpMat[i] * pointVec->at(iter)[it+3]; }
249 
250  //======================================== Find matrix weight
251  matWeight += pointVec->at(iter)[it+3];
252  }
253 
254  //============================================ Normalise weighted sum matrix by sum of weights
255  for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] /= matWeight; }
256 
257  //============================================ Decompose the average matrix using SVD
258  ProSHADE_internal_maths::realMatrixSVDUandVOnly ( avgMat, 3, uAndV, false );
259  const FloatingPoint< proshade_double > lhs ( uAndV[0] ), rhs ( -777.7 );
260  if ( lhs.AlmostEquals ( rhs ) )
261  {
262  //======================================== SVD Failed. Just use the central value
263  ProSHADE_internal_maths::getEulerZYZFromSOFTPosition ( band, static_cast< proshade_signed > ( pointVec->at(iter)[0] ), static_cast< proshade_signed > ( pointVec->at(iter)[1] ), static_cast< proshade_signed > ( pointVec->at(iter)[2] ), eulA, eulB, eulG );
264  matWeight = pointVec->at(iter)[3];
265  pointVec->at(iter) = new proshade_double [4];
266  ProSHADE_internal_misc::checkMemoryAllocation ( pointVec->at(iter), __FILE__, __LINE__, __func__ );
267  pointVec->at(iter)[0] = *eulA;
268  pointVec->at(iter)[1] = *eulB;
269  pointVec->at(iter)[2] = *eulG;
270  pointVec->at(iter)[3] = matWeight;
271 
272  continue ;
273  }
274 
275  //============================================ SVD Succeeded. Compute U * V^T
276  for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] = 0.0; }
277  ProSHADE_internal_maths::multiplyTwoSquareMatrices ( uAndV, uAndV+9, avgMat, 3 );
278 
279  //============================================ Convert to Euler
280  ProSHADE_internal_maths::getEulerZYZFromRotMatrix ( avgMat, eulA, eulB, eulG );
281 
282  //============================================ Save over input
283  matWeight = pointVec->at(iter)[3];
284  delete[] pointVec->at(iter);
285  pointVec->at(iter) = new proshade_double [4];
286  ProSHADE_internal_misc::checkMemoryAllocation ( pointVec->at(iter), __FILE__, __LINE__, __func__ );
287  pointVec->at(iter)[0] = *eulA;
288  pointVec->at(iter)[1] = *eulB;
289  pointVec->at(iter)[2] = *eulG;
290  pointVec->at(iter)[3] = matWeight;
291  }
292 
293  //================================================ Release memory
294  releasePeakOptimisationMemory ( avgMat, hlpMat, eulA, eulB, eulG, uAndV );
295 
296  //================================================ Done
297  return ;
298 
299 }

◆ pointsAboveNeighboursRemoveSmallHeight()

void ProSHADE_internal_peakSearch::pointsAboveNeighboursRemoveSmallHeight ( std::vector< proshade_double * > *  pointVec,
proshade_double *  medianIQR,
proshade_double  noIQRs 
)

This function clears the 'higher than neighbour' vector from background values.

This function simply takes all the 'higher than all neighbours' indices vector and a threshold defining values and proceeds to compute the threshold for calling the indice a peak. Then, it applies this threshold to the vector, keeping only the indices which have higher value than the threshold.

Parameters
[in]pointVecVector of double pointers as returned by findAllPointsAboveNeighbours().
[in]medianIQRArray of two numbers, the median and IQR for which should be used to remove 'background' points in the vector.
[in]noIQRsThe number of IQRs from median to be used to create the cut-off threshold.

Definition at line 132 of file ProSHADE_peakSearch.cpp.

133 {
134  //================================================ Determine the threshold
135  proshade_double backgroundThreshold = std::min ( std::max ( medianIQR[0] + ( medianIQR[1] * noIQRs ), 0.05 ), 0.5 );
136 
137  //================================================ Check for passing the threshold
138  for ( proshade_signed iter = static_cast<proshade_signed> ( pointVec->size()-1 ); iter >= 0 ; iter-- )
139  {
140  if ( pointVec->at( static_cast< size_t > ( iter ) )[3] <= backgroundThreshold )
141  {
142  delete[] pointVec->at( static_cast< size_t > ( iter ) );
143  pointVec->erase ( pointVec->begin() + iter );
144  }
145  }
146 
147  //================================================ Done
148  return ;
149 
150 }

◆ releasePeakOptimisationMemory()

void ProSHADE_internal_peakSearch::releasePeakOptimisationMemory ( proshade_double *&  avgMat,
proshade_double *&  hlpMat,
proshade_double *&  eA,
proshade_double *&  eB,
proshade_double *&  eG,
proshade_double *&  uAV 
)

This function deletes all the peak optimisation memory.

Parameters
[in]avgMatThe matrix which will take the weighted sum of the neighbour values.
[in]hlpMatThe helper matrix to store temporary results.
[in]eAThe Euler angle alpha value.
[in]eBThe Euler beta alpha value.
[in]eGThe Euler gamma alpha value.
[in]uAVThe U and V^T matrices resulting from the SVD.

Definition at line 193 of file ProSHADE_peakSearch.cpp.

194 {
195  //================================================ Release the memory
196  delete[] avgMat;
197  delete[] hlpMat;
198  delete[] eA;
199  delete[] eB;
200  delete[] eG;
201  delete[] uAV;
202 
203  //================================================ Done
204  return ;
205 
206 }

◆ releaseSmoothingZScoreMemory()

void ProSHADE_internal_peakSearch::releaseSmoothingZScoreMemory ( proshade_double *&  scoreOverVals,
proshade_signed *&  signals,
proshade_double *&  filteredY,
proshade_double *&  avgFilter,
proshade_double *&  stdFilter,
proshade_double *&  subVec,
proshade_double *&  medianIQR,
proshade_double *&  YZMap,
proshade_double *&  XZMap,
proshade_double *&  XYMap 
)

This function releases the memory required for smoothed Z score computation.

Parameters
[in]scoreOverValsPointer to where the 1D cuts from the 3D map will be saved.
[in]signalsPointer to where the results of the 1D peak searches will be saved.
[in]filteredYPointer to where the weighted smoothed scores will be saved.
[in]avgFilterPointer to where the median values will be saved.
[in]stdFilterPointer to where the IQR values will be saved.
[in]subVecPointer to where temporary computations will be done.
[in]medianIQRPointer to simple array of 2 for returning results.
[in]YZMapPointer to where the X-axis peaks will be saved.
[in]XZMapPointer to where the Y-axis peaks will be saved.
[in]XYMapPointer to where the Z-axis peaks will be saved.

Definition at line 463 of file ProSHADE_peakSearch.cpp.

464 {
465  //================================================ Release the memory
466  delete[] scoreOverVals;
467  delete[] signals;
468  delete[] filteredY;
469  delete[] avgFilter;
470  delete[] stdFilter;
471  delete[] subVec;
472  delete[] medianIQR;
473  delete[] YZMap;
474  delete[] XZMap;
475  delete[] XYMap;
476 
477  //================================================ Done
478  return ;
479 
480 }
ProSHADE_settings::noIQRsFromMedianNaivePeak
proshade_double noIQRsFromMedianNaivePeak
When doing peak searching, how many IQRs from the median the threshold for peak height should be (in ...
Definition: ProSHADE_settings.hpp:124
ProSHADE_internal_maths::getEulerZYZFromSOFTPosition
void getEulerZYZFromSOFTPosition(proshade_signed band, proshade_signed x, proshade_signed y, proshade_signed z, proshade_double *eulerAlpha, proshade_double *eulerBeta, proshade_double *eulerGamma)
Function to find Euler angles (ZYZ convention) from index position in the inverse SOFT map.
Definition: ProSHADE_maths.cpp:966
ProSHADE_internal_peakSearch::releaseSmoothingZScoreMemory
void releaseSmoothingZScoreMemory(proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap)
This function releases the memory required for smoothed Z score computation.
Definition: ProSHADE_peakSearch.cpp:463
ProSHADE_internal_misc::addToDblPtrVector
void addToDblPtrVector(std::vector< proshade_double * > *vecToAddTo, proshade_double *elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:143
ProSHADE_internal_peakSearch::getSmoothedZScore1D
void getSmoothedZScore1D(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals)
This function computes the 1D peaks for a 1D input array and returns array of int's as signal.
Definition: ProSHADE_peakSearch.cpp:501
ProSHADE_internal_maths::getRotationMatrixFromEulerZYZAngles
void getRotationMatrixFromEulerZYZAngles(proshade_double eulerAlpha, proshade_double eulerBeta, proshade_double eulerGamma, proshade_double *matrix)
Function to find the rotation matrix from Euler angles (ZYZ convention).
Definition: ProSHADE_maths.cpp:1019
ProSHADE_internal_peakSearch::getAllPeaksNaive
std::vector< proshade_double * > getAllPeaksNaive(proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double noIQRs)
This function finds peaks in the 3D map using the "naive" approach.
Definition: ProSHADE_peakSearch.cpp:316
ProSHADE_internal_peakSearch::getAllPeaksSmoothedZ
std::vector< proshade_double * > getAllPeaksSmoothedZ(proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize)
This function finds peaks in the 3D map using the smoothed Z score approach.
Definition: ProSHADE_peakSearch.cpp:923
ProSHADE_internal_peakSearch::getYAxisArraysSmoothedZScorePeaks
void getYAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XZMap)
This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:625
ProSHADE_internal_peakSearch::findAllPointNeighbours
void findAllPointNeighbours(proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign *visitedMap, proshade_signed dim, proshade_signed x, proshade_signed y, proshade_signed z, std::vector< proshade_unsign > *retVals)
This is a support function for the Z-score peak detection. It is currently not being used.
Definition: ProSHADE_peakSearch.cpp:719
ProSHADE_internal_peakSearch::allocatePeakOptimisationMemory
void allocatePeakOptimisationMemory(proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
This function allocates and checks all the peak optimisation memory.
Definition: ProSHADE_peakSearch.cpp:161
ProSHADE_settings::verbose
proshade_signed verbose
Should the software report on the progress, or just be quiet? Value between -1 (nothing) and 4 (loud)
Definition: ProSHADE_settings.hpp:152
ProSHADE_settings::messageShift
proshade_signed messageShift
This value allows shifting the messages to create more readable log for sub-processes.
Definition: ProSHADE_settings.hpp:153
ProSHADE_internal_misc::addToDoubleVector
void addToDoubleVector(std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:77
ProSHADE_internal_maths::getEulerZYZFromRotMatrix
void getEulerZYZFromRotMatrix(proshade_double *rotMat, proshade_double *eA, proshade_double *eB, proshade_double *eG)
This function converts rotation matrix to the Euler ZYZ angles representation.
Definition: ProSHADE_maths.cpp:1561
ProSHADE_internal_peakSearch::pointsAboveNeighboursRemoveSmallHeight
void pointsAboveNeighboursRemoveSmallHeight(std::vector< proshade_double * > *pointVec, proshade_double *medianIQR, proshade_double noIQRs)
This function clears the 'higher than neighbour' vector from background values.
Definition: ProSHADE_peakSearch.cpp:132
ProSHADE_internal_peakSearch::findAllSmoothedZScorePeaksWithNeighbours
void findAllSmoothedZScorePeaksWithNeighbours(proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_signed dim, proshade_signed peakSize, std::vector< proshade_double * > *allPeaksWithNeighbours)
This function firstly determines the highest peak of all smoothed Z score islands and then returns th...
Definition: ProSHADE_peakSearch.cpp:854
ProSHADE_internal_peakSearch::getXAxisArraysSmoothedZScorePeaks
void getXAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *YZMap)
This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:576
ProSHADE_internal_maths::getRotationMatrixFromAngleAxis
void getRotationMatrixFromAngleAxis(proshade_double *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang)
This function converts the axis-angle representation to the rotation matrix representation.
Definition: ProSHADE_maths.cpp:1458
ProSHADE_internal_peakSearch::getZAxisArraysSmoothedZScorePeaks
void getZAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XYMap)
This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:674
ProSHADE_internal_maths::realMatrixSVDUandVOnly
void realMatrixSVDUandVOnly(proshade_double *mat, int dim, proshade_double *uAndV, bool fail=true)
Function to compute the real matrix SVD and return the U and V matrices.
Definition: ProSHADE_maths.cpp:874
ProSHADE_settings::peakNeighbours
proshade_unsign peakNeighbours
Number of points in any direction that have to be lower than the considered index in order to conside...
Definition: ProSHADE_settings.hpp:123
ProSHADE_internal_misc::checkMemoryAllocation
void checkMemoryAllocation(chVar checkVar, std::string fileP, unsigned int lineP, std::string funcP, std::string infoP="This error may occurs when ProSHADE requests memory to be\n : allocated to it and this operation fails. This could\n : happen when not enough memory is available, either due to\n : other processes using a lot of memory, or when the machine\n : does not have sufficient memory available. Re-run to see\n : if this problem persists.")
Checks if memory was allocated properly.
Definition: ProSHADE_misc.hpp:73
ProSHADE_internal_peakSearch::optimisePeakPositions
void optimisePeakPositions(std::vector< proshade_double * > *pointVec, proshade_signed peakSize, proshade_signed band)
This function optimises all the peaks in the input vector using the values of their neighbours.
Definition: ProSHADE_peakSearch.cpp:221
ProSHADE_internal_maths::vectorMedianAndIQR
void vectorMedianAndIQR(std::vector< proshade_double > *vec, proshade_double *&ret)
Function to get vector median and inter-quartile range.
Definition: ProSHADE_maths.cpp:149
ProSHADE_internal_misc::addToUnsignVector
void addToUnsignVector(std::vector< proshade_unsign > *vecToAddTo, proshade_unsign elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:99
ProSHADE_internal_peakSearch::releasePeakOptimisationMemory
void releasePeakOptimisationMemory(proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
This function deletes all the peak optimisation memory.
Definition: ProSHADE_peakSearch.cpp:193
ProSHADE_internal_peakSearch::allocateSmoothingZScoreMemory
void allocateSmoothingZScoreMemory(proshade_unsign dim, proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap, proshade_unsign smLag)
This function allocates the memory required for smoothed Z score computation.
Definition: ProSHADE_peakSearch.cpp:419
ProSHADE_internal_peakSearch::findAllDisconnectedIslands
void findAllDisconnectedIslands(proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign dim, std::vector< proshade_unsign > *allIslandBests)
This function combines the three Z score maps, locates individual islands and returns a vector of hig...
Definition: ProSHADE_peakSearch.cpp:778
ProSHADE_internal_maths::multiplyTwoSquareMatrices
void multiplyTwoSquareMatrices(proshade_double *A, proshade_double *B, proshade_double *res, proshade_unsign dim=3)
Function to compute matrix multiplication.
Definition: ProSHADE_maths.cpp:1693
ProSHADE_internal_peakSearch::findAllPointsAboveNeighbours
std::vector< proshade_double * > findAllPointsAboveNeighbours(proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double *medianIQR)
This function finds all indices with higher value then all neighbours.
Definition: ProSHADE_peakSearch.cpp:38
ProSHADE_internal_messages::printProgressMessage
void printProgressMessage(proshade_signed verbose, proshade_signed messageLevel, std::string message, proshade_signed messageShift=0)
General stdout message printing.
Definition: ProSHADE_messages.cpp:71
ProSHADE_internal_maths::arrayMedianAndIQR
void arrayMedianAndIQR(proshade_double *vec, proshade_unsign vecSize, proshade_double *&ret)
Function to get array median and inter-quartile range.
Definition: ProSHADE_maths.cpp:200