Search in sources :

Example 6 with PlotItem

use of de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem in project elki by elki-project.

the class ExportVisualizations method processNewResult.

@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
    if (output.isFile()) {
        throw new AbortException("Output folder cannot be an existing file.");
    }
    if (!output.exists() && !output.mkdirs()) {
        throw new AbortException("Could not create output directory.");
    }
    if (this.baseResult == null) {
        this.baseResult = newResult;
        context = null;
        counter = new HashMap<>();
        LOG.warning("Note: Reusing visualization exporter for more than one result is untested.");
    }
    if (context == null) {
        context = manager.newContext(hier, baseResult);
    }
    // Projected visualizations
    Hierarchy<Object> vistree = context.getVisHierarchy();
    for (It<Projector> iter2 = vistree.iterAll().filter(Projector.class); iter2.valid(); iter2.advance()) {
        // TODO: allow selecting individual projections only.
        Collection<PlotItem> items = iter2.get().arrange(context);
        for (PlotItem item : items) {
            processItem(item);
        }
    }
    for (It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) {
        VisualizationTask task = iter2.get();
        if (vistree.iterParents(task).filter(Projector.class).valid()) {
            continue;
        }
        PlotItem pi = new PlotItem(ratio, 1.0, null);
        pi.add(task);
        processItem(pi);
    }
}
Also used : Projector(de.lmu.ifi.dbs.elki.visualization.projector.Projector) VisualizationTask(de.lmu.ifi.dbs.elki.visualization.VisualizationTask) PlotItem(de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem) AbortException(de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)

Aggregations

VisualizationTask (de.lmu.ifi.dbs.elki.visualization.VisualizationTask)6 PlotItem (de.lmu.ifi.dbs.elki.visualization.gui.overview.PlotItem)6 ArrayList (java.util.ArrayList)5 ScalesResult (de.lmu.ifi.dbs.elki.result.ScalesResult)3 AbortException (de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)2 LabelVisualization (de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.LabelVisualization)2 AffineTransformation (de.lmu.ifi.dbs.elki.math.linearalgebra.AffineTransformation)1 VisualizationPlot (de.lmu.ifi.dbs.elki.visualization.gui.VisualizationPlot)1 AffineProjection (de.lmu.ifi.dbs.elki.visualization.projections.AffineProjection)1 OPTICSProjection (de.lmu.ifi.dbs.elki.visualization.projections.OPTICSProjection)1 Projection1D (de.lmu.ifi.dbs.elki.visualization.projections.Projection1D)1 Projection2D (de.lmu.ifi.dbs.elki.visualization.projections.Projection2D)1 ProjectionParallel (de.lmu.ifi.dbs.elki.visualization.projections.ProjectionParallel)1 Simple1D (de.lmu.ifi.dbs.elki.visualization.projections.Simple1D)1 Simple2D (de.lmu.ifi.dbs.elki.visualization.projections.Simple2D)1 SimpleParallel (de.lmu.ifi.dbs.elki.visualization.projections.SimpleParallel)1 Projector (de.lmu.ifi.dbs.elki.visualization.projector.Projector)1 Visualization (de.lmu.ifi.dbs.elki.visualization.visualizers.Visualization)1 File (java.io.File)1