48 IonHit::IonHit(
float x,
float y,
float z,
float m) : massToCharge(m), pos(x,y,z)
81 #ifdef __LITTLE_ENDIAN__ 82 void IonHit::switchEndian()
92 massToCharge=obj.massToCharge;
100 return massToCharge==obj.massToCharge && pos == obj.pos;
111 p.resize(ions.size());
112 #pragma omp parallel for 113 for(
size_t ui=0;ui<ions.size();ui++)
124 return (std::isnan(massToCharge) || std::isnan(pos[0]) ||
125 std::isnan(pos[1]) || std::isnan(pos[2]));
131 size_t nPoints=points.size();
136 vector<Point3D> centroids(omp_get_max_threads(),
Point3D(0,0,0));
137 #pragma omp parallel for 138 for(
size_t ui=0;ui<nPoints;ui++)
139 centroids[omp_get_thread_num()]+=points[ui].getPos();
141 for(
size_t ui=0;ui<centroids.size();ui++)
142 centroid+=centroids[ui];
146 for(
unsigned int ui=0;ui<nPoints;ui++)
147 centroid+=points[ui].
getPos();
150 centroid*=1.0f/(float)nPoints;
158 for(
unsigned int ui=0;ui<3;ui++)
160 bounds[ui][0]=std::numeric_limits<float>::max();
161 bounds[ui][1]=-std::numeric_limits<float>::max();
164 for(
unsigned int ui=0; ui<points.size(); ui++)
167 p=points[ui].getPos();
168 for(
unsigned int uj=0; uj<3; uj++)
170 bounds[uj][0] = std::min(p.
getValue(uj),bounds[uj][0]);
171 bounds[uj][1] = std::max(p.
getValue(uj),bounds[uj][1]);
176 bounds[2][0],bounds[0][1],
177 bounds[1][1],bounds[2][1]);
196 for(
unsigned int ui=0;ui<3;ui++)
198 bounds[ui][0]=std::numeric_limits<float>::max();
199 bounds[ui][1]=-std::numeric_limits<float>::max();
202 for(
unsigned int ui=0; ui<points.size(); ui++)
205 for(
unsigned int uj=0; uj<3; uj++)
208 p=points[ui].getPos();
217 b.setBounds(bounds[0][0],bounds[1][0],
218 bounds[2][0],bounds[0][1],
219 bounds[1][1],bounds[2][1]);
222 vector<BoundCube> cubes;
224 unsigned int nT=omp_get_max_threads();
226 for(
unsigned int ui=0;ui<cubes.size();ui++)
227 cube[ui].setInverseLimits();
229 unsigned int tCount=1;
230 #pragma omp parallel for reduction(tCount|+) 231 for(
unsigned int ui=0;ui<points.size();ui++)
234 p=points[ui].getPos();
235 for(
unsigned int uj=0;uj<3;uj++)
237 b.setBounds(uj,0,std::min(b.getBound(uj,0),p[uj]));
238 b.setBounds(uj,1,std::min(b.getBound(uj,0),p[uj]));
242 for(
unsigned int ui=0;ui<std::min(tCount,nT);ui++)
275 if(x!=obj.
x || y != obj.
y || z !=obj.
z)
305 for(
size_t ui=0;ui<8;ui++)
313 TEST(bc.isValid(),
"check boundcube");
void setInverseLimits()
Set the cube to be "inside out" at the limits of numeric results;.
const IonHit & operator=(const IonHit &obj)
friend std::ostream & operator<<(std::ostream &stream, const IonHit &)
Output streaming operator. Users (x,y,z,m) as format for output.
const Point3D & getPosRef() const
IonHit operator+(const Point3D &obj)
void setPos(const Point3D &pos)
A 3D point data class storage.
float operator[](unsigned int ui) const
static void getPoints(const std::vector< IonHit > &ions, std::vector< Point3D > &pts)
float timeOfFlight
timeOfFlight in ns. Correction status does not appear to be specified
bool operator==(const IonHit &obj) const
static BoundCube getIonDataLimits(const std::vector< IonHit > &points)
float getMassToCharge() const
float xDetector
X and Y coordinates on the detector in mm, nominally uncorrected.
static void getBoundCube(const std::vector< IonHit > &p, BoundCube &b)
void floatSwapBytes(float *inFloat)
Helper class to define a bounding cube.
bool operator==(const EPOS_ENTRY &obj) const
void setMassToCharge(float newMassToCharge)
This is a data holding class for POS file ions, from.
static void getCentroid(const std::vector< IonHit > &points, Point3D ¢roid)
float getValue(unsigned int ui) const
Get value of ith dimension (0, 1, 2)
void setBounds(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax)
Set the bounds by passing in minima and maxima of each dimension.