use of net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection in project mzmine2 by mzmine.
the class Fx3DStageController method addFeatures.
private void addFeatures() {
for (FeatureSelection featureSelection : featureSelections) {
Fx3DFeatureDataset featureDataset = new Fx3DFeatureDataset(featureSelection, rtResolution, mzResolution, rtRange, mzRange, maxOfAllBinnedIntensity, Color.rgb(255, 255, 0, 0.35));
addDataset(featureDataset);
}
}
use of net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection in project mzmine2 by mzmine.
the class Fx3DStageController method addMenuItems.
private void addMenuItems() {
removeMenu.getItems().clear();
for (Fx3DAbstractDataset dataset : visualizedMeshPlots) {
MenuItem menuItem = new MenuItem(dataset.getFileName());
removeMenu.getItems().add(menuItem);
menuItem.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
LOG.finest("Context menu invoked. Remove Data file button clicked. Removing dataset " + dataset.getFileName() + " from the plot.");
visualizedFiles.remove(dataset.getFile());
visualizedMeshPlots.remove(dataset);
updateGraph();
addMenuItems();
}
});
}
addDatafileMenu.getItems().clear();
for (RawDataFile file : allDataFiles) {
if (!visualizedFiles.contains(file)) {
MenuItem menuItem = new MenuItem(file.getName());
addDatafileMenu.getItems().add(menuItem);
final Fx3DStageController controller = this;
menuItem.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
LOG.finest("Context menu invoked. Add Data file button clicked. Adding dataset " + file.getName() + " to the plot.");
MZmineCore.getTaskController().addTask(new Fx3DSamplingTask(file, scanSel, mzRange, rtResolution, mzResolution, controller), TaskPriority.HIGH);
addMenuItems();
}
});
}
}
addFeatureMenu.getItems().clear();
for (PeakList peakList : allPeakLists) {
Menu peakListMenu = new Menu(peakList.getName());
addFeatureMenu.getItems().add(peakListMenu);
RawDataFile[] dataFiles = peakList.getRawDataFiles();
for (RawDataFile dataFile : dataFiles) {
Menu dataFileMenu = new Menu(dataFile.getName());
peakListMenu.getItems().add(dataFileMenu);
Feature[] features = peakList.getPeaks(dataFile);
for (Feature feature : features) {
if (feature.getRawDataPointsRTRange().lowerEndpoint() >= rtRange.lowerEndpoint() && feature.getRawDataPointsRTRange().upperEndpoint() <= mzRange.upperEndpoint() && feature.getRawDataPointsMZRange().lowerEndpoint() >= mzRange.lowerEndpoint() && feature.getRawDataPointsMZRange().upperEndpoint() <= mzRange.upperEndpoint()) {
if (!visualizedFiles.contains(feature)) {
MenuItem menuItem = new MenuItem(feature.toString());
dataFileMenu.getItems().add(menuItem);
menuItem.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
LOG.finest("Context menu invoked. Add Feature button clicked. Adding dataset " + feature.toString() + " to the plot.");
PeakListRow row = peakList.getPeakRow(feature);
FeatureSelection featureSelection = new FeatureSelection(peakList, feature, row, dataFile);
Fx3DFeatureDataset featureDataset = new Fx3DFeatureDataset(featureSelection, rtResolution, mzResolution, rtRange, mzRange, maxOfAllBinnedIntensity, Color.rgb(165, 42, 42, 0.9));
addDataset(featureDataset);
addMenuItems();
}
});
}
}
}
}
}
}
use of net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection in project mzmine2 by mzmine.
the class Fx3DVisualizerModule method setupNew3DVisualizer.
public static void setupNew3DVisualizer(final RawDataFile dataFile, final Range<Double> mzRange, final Range<Double> rtRange, final Feature featureToShow) {
final ParameterSet myParameters = MZmineCore.getConfiguration().getModuleParameters(Fx3DVisualizerModule.class);
final Fx3DVisualizerModule myInstance = MZmineCore.getModuleInstance(Fx3DVisualizerModule.class);
myParameters.getParameter(Fx3DVisualizerParameters.dataFiles).setValue(RawDataFilesSelectionType.SPECIFIC_FILES, new RawDataFile[] { dataFile });
myParameters.getParameter(Fx3DVisualizerParameters.scanSelection).setValue(new ScanSelection(rtRange, 1));
myParameters.getParameter(Fx3DVisualizerParameters.mzRange).setValue(mzRange);
List<FeatureSelection> featuresList = Lists.newArrayList();
if (featureToShow != null) {
FeatureSelection selectedFeature = new FeatureSelection(null, featureToShow, null, null);
featuresList.add(selectedFeature);
}
myParameters.getParameter(Fx3DVisualizerParameters.features).setValue(featuresList);
if (myParameters.showSetupDialog(MZmineCore.getDesktop().getMainWindow(), true) == ExitCode.OK) {
myInstance.runModule(MZmineCore.getProjectManager().getCurrentProject(), myParameters.cloneParameterSet(), new ArrayList<Task>());
}
}
use of net.sf.mzmine.parameters.parametertypes.selectors.FeatureSelection in project mzmine2 by mzmine.
the class Fx3DVisualizerModule method runModule.
@SuppressWarnings("null")
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
final RawDataFile[] currentDataFiles = parameters.getParameter(Fx3DVisualizerParameters.dataFiles).getValue().getMatchingRawDataFiles();
final ScanSelection scanSel = parameters.getParameter(Fx3DVisualizerParameters.scanSelection).getValue();
final List<FeatureSelection> featureSelList = parameters.getParameter(Fx3DVisualizerParameters.features).getValue();
LOG.finest("Feature selection is:" + featureSelList.toString());
for (FeatureSelection selection : featureSelList) {
LOG.finest("Selected features are:" + selection.getFeature().toString());
}
Range<Double> rtRange = ScanUtils.findRtRange(scanSel.getMatchingScans(MZmineCore.getProjectManager().getCurrentProject().getDataFiles()[0]));
ParameterSet myParameters = MZmineCore.getConfiguration().getModuleParameters(Fx3DVisualizerModule.class);
Range<Double> mzRange = myParameters.getParameter(Fx3DVisualizerParameters.mzRange).getValue();
int rtRes = myParameters.getParameter(Fx3DVisualizerParameters.rtResolution).getValue();
int mzRes = myParameters.getParameter(Fx3DVisualizerParameters.mzResolution).getValue();
Platform.runLater(() -> {
if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {
JOptionPane.showMessageDialog(null, "The platform does not provide 3D support.");
return;
}
FXMLLoader loader = new FXMLLoader((getClass().getResource("Fx3DStage.fxml")));
Stage stage = null;
try {
stage = loader.load();
LOG.finest("Stage has been successfully loaded from the FXML loader.");
} catch (IOException e) {
e.printStackTrace();
return;
}
String title = "";
Fx3DStageController controller = loader.getController();
controller.setScanSelection(scanSel);
controller.setRtAndMzResolutions(rtRes, mzRes);
controller.setRtAndMzValues(rtRange, mzRange);
for (int i = 0; i < currentDataFiles.length; i++) {
MZmineCore.getTaskController().addTask(new Fx3DSamplingTask(currentDataFiles[i], scanSel, mzRange, rtRes, mzRes, controller), TaskPriority.HIGH);
}
controller.addFeatureSelections(featureSelList);
for (int i = 0; i < currentDataFiles.length; i++) {
title = title + currentDataFiles[i].toString() + " ";
}
stage.show();
stage.setMinWidth(stage.getWidth());
stage.setMinHeight(stage.getHeight());
});
return ExitCode.OK;
}
Aggregations