Search in sources :

Example 1 with BinaryDataArray

use of uk.ac.ebi.jmzml.model.mzml.BinaryDataArray 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;
}
Also used : SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) BinaryDataArray(uk.ac.ebi.jmzml.model.mzml.BinaryDataArray) BinaryDataArrayList(uk.ac.ebi.jmzml.model.mzml.BinaryDataArrayList) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Aggregations

DataPoint (net.sf.mzmine.datamodel.DataPoint)1 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)1 BinaryDataArray (uk.ac.ebi.jmzml.model.mzml.BinaryDataArray)1 BinaryDataArrayList (uk.ac.ebi.jmzml.model.mzml.BinaryDataArrayList)1