float getHeight() { float maxIntensity = 0f; float intensityBuffer[] = dataPoints.getIntensityBuffer(); for (int i = 0; i < dataPoints.getSize(); i++) { maxIntensity = Math.max(maxIntensity, intensityBuffer[i]); } return maxIntensity; }
static void extractDataPoints( uk.ac.ebi.jmzml.model.mzml.Chromatogram jmzChromatogram, ChromatogramDataPointList dataPointList) { dataPointList.clear(); BinaryDataArrayList dataList = jmzChromatogram.getBinaryDataArrayList(); if ((dataList == null) || (dataList.getCount().equals(0))) return; // Obtain the data arrays from spectrum final BinaryDataArray rtArray = dataList.getBinaryDataArray().get(0); final BinaryDataArray intensityArray = dataList.getBinaryDataArray() .get(1); final Number rtValues[] = rtArray.getBinaryDataAsNumberArray(); final Number intensityValues[] = intensityArray .getBinaryDataAsNumberArray(); // Allocate space for the data points dataPointList.allocate(rtValues.length); final ChromatographyInfo rtBuffer[] = dataPointList.getRtBuffer(); final float intensityBuffer[] = dataPointList.getIntensityBuffer(); // Copy the actual data point values for (int i = 0; i < rtValues.length; i++) { final float rt = rtValues[i].floatValue(); final float intensity = intensityValues[i].floatValue(); final ChromatographyInfo chromatographyInfo = MSDKObjectBuilder .getChromatographyInfo1D(SeparationType.UNKNOWN, rt); rtBuffer[i] = chromatographyInfo; intensityBuffer[i] = intensity; } // Commit the changes dataPointList.setSize(rtValues.length); }
/** * <p>Getter for the field <code>buildingSegmentLength</code>.</p> * * @return a float. */ @SuppressWarnings("null") public float getBuildingSegmentLength() { if (buildingSegmentLength < 2) return 0.0f; ChromatographyInfo rtBuffer[] = dataPoints.getRtBuffer(); ChromatographyInfo firstChromInfo = rtBuffer[dataPoints.getSize() - buildingSegmentLength]; ChromatographyInfo lastChromInfo = rtBuffer[dataPoints.getSize() - 1]; if ((firstChromInfo == null) || (lastChromInfo == null)) throw new MSDKRuntimeException( "Scans do not contain retention times"); float firstRT = firstChromInfo.getRetentionTime(); float lastRT = lastChromInfo.getRetentionTime(); return (lastRT - firstRT); }
void addDataPoint(@Nonnull ChromatographyInfo rt, @Nonnull Double mz, @Nonnull Float intensity) { Preconditions.checkNotNull(rt); dataPoints.add(rt, intensity); mzValues.add(mz); buildingSegmentLength++; }
float getLastIntensity() { if (dataPoints.getSize() == 0) throw new MSDKRuntimeException( "Cannot return the last data point of an empty chromatogram"); return dataPoints.getIntensityBuffer()[dataPoints.getSize() - 1]; }