fix tic plot crash due to too many points at one rt (imzml)
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.jfree.chart.axis.NumberAxis;
import org.jfree.data.xy.AbstractXYZDataset;
import com.google.common.collect.Range;
import com.google.common.primitives.Ints;
@@ -44,7 +45,7 @@ import javafx.collections.ObservableList;
/**
* TIC visualizer data set. One data set is created per file shown in this visualizer. We need to
* create separate data set for each file because the user may add/remove files later.
- *
+ * <p>
* Added the possibility to switch to TIC plot type from a "non-TICVisualizerWindow" context.
*/
public class TICDataSet extends AbstractXYZDataset implements Task {
@@ -75,6 +76,7 @@ public class TICDataSet extends AbstractXYZDataset implements Task {
private final Range<Double> mzRange;
private double intensityMin;
private double intensityMax;
+ private TICVisualizerTab window;
private TaskStatus status;
private String errorMessage;
@@ -121,6 +123,7 @@ public class TICDataSet extends AbstractXYZDataset implements Task {
processedScans = 0;
intensityMin = 0.0;
intensityMax = 0.0;
+ this.window = window;
status = TaskStatus.WAITING;
errorMessage = null;
@@ -359,6 +362,15 @@ public class TICDataSet extends AbstractXYZDataset implements Task {
// Determine plot type (now done from constructor).
final TICPlotType plotType = this.plotType;
+ // fix for imZML files without a retention time in their scans -> crashes TIC Plot
+ boolean useFakeRt = Double
+ .compare(scans.get(0).getRetentionTime(), scans.get(scans.size() - 1).getRetentionTime())
+ == 0;
+ if(useFakeRt && window != null) {
+ final NumberAxis axis = (NumberAxis) window.getTICPlot().getXYPlot().getDomainAxis();
+ MZmineCore.runLater(() -> axis.setLabel("Scan number"));
+ }
+
// Process each scan.
for (int index = 0; status != TaskStatus.CANCELED && index < totalScans; index++) {
@@ -388,7 +400,7 @@ public class TICDataSet extends AbstractXYZDataset implements Task {
}
intensityValues[index] = intensity;
- rtValues[index] = scan.getRetentionTime();
+ rtValues[index] = useFakeRt ? index : scan.getRetentionTime();
// Update min and max.
if (index == 0) {
