use of uk.ac.ebi.jmzml.model.mzml.BinaryDataArrayList in project mzmine2 by mzmine.
the class MzMLReadTask method extractDataPoints.
private DataPoint[] extractDataPoints(Spectrum spectrum) {
BinaryDataArrayList dataList = spectrum.getBinaryDataArrayList();
if ((dataList == null) || (dataList.getCount().equals(0)))
return new DataPoint[0];
BinaryDataArray mzArray = dataList.getBinaryDataArray().get(0);
BinaryDataArray intensityArray = dataList.getBinaryDataArray().get(1);
Number[] mzValues = mzArray.getBinaryDataAsNumberArray();
Number[] intensityValues = intensityArray.getBinaryDataAsNumberArray();
DataPoint[] dataPoints = new DataPoint[mzValues.length];
for (int i = 0; i < dataPoints.length; i++) {
double mz = mzValues[i].doubleValue();
double intensity = intensityValues[i].doubleValue();
dataPoints[i] = new SimpleDataPoint(mz, intensity);
}
return dataPoints;
}
Aggregations