Search in sources :

Example 6 with TextFilePeakResults

use of uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults in project GDSC-SMLM by aherbert.

the class ResultsMatchCalculator method createFilePeakResults.

private TextFilePeakResults createFilePeakResults(MemoryPeakResults results) {
    if (!settings.isSaveClassifications()) {
        return null;
    }
    final String filename = ImageJUtils.getFilename("Classifications_File", settings.classificationsFile);
    if (filename != null) {
        settings.classificationsFile = filename;
        final TextFilePeakResults r = new TextFilePeakResults(filename, false, outputEndFrame(results));
        r.copySettings(results);
        r.begin();
        return r;
    }
    return null;
}
Also used : TextFilePeakResults(uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults)

Example 7 with TextFilePeakResults

use of uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults in project GDSC-SMLM by aherbert.

the class CreateData method saveImageResults.

private void saveImageResults(MemoryPeakResults results) {
    if (!settings.getSaveImageResults()) {
        return;
    }
    final String[] path = ImageJUtils.decodePath(settings.getImageResultsFilename());
    final OpenDialog chooser = new OpenDialog("Image_Results_File", path[0], path[1]);
    if (chooser.getFileName() != null) {
        settings.setImageResultsFilename(chooser.getDirectory() + chooser.getFileName());
        settings.setImageResultsFilename(FileUtils.replaceExtension(settings.getImageResultsFilename(), "xls"));
        final TextFilePeakResults r = new TextFilePeakResults(settings.getImageResultsFilename(), false);
        r.copySettings(results);
        r.begin();
        r.addAll(results.toArray());
        r.end();
    }
}
Also used : TextFilePeakResults(uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults) OpenDialog(ij.io.OpenDialog)

Example 8 with TextFilePeakResults

use of uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults in project GDSC-SMLM by aherbert.

the class ResultsManager method save.

private static boolean save(ResultsFileSettings resultsSettings, MemoryPeakResults source) {
    // Assume the directory exists
    String resultsFilename;
    try {
        resultsFilename = new File(resultsSettings.getResultsDirectory(), source.getName() + ".results." + ResultsProtosHelper.getExtension(resultsSettings.getFileFormat())).getCanonicalPath();
    } catch (final IOException ex) {
        return false;
    }
    PeakResults results;
    switch(resultsSettings.getFileFormat()) {
        case BINARY:
            results = new BinaryFilePeakResults(resultsFilename, source.hasDeviations(), source.hasEndFrame(), source.hasId(), resultsSettings.getShowPrecision());
            break;
        case TEXT:
            final TextFilePeakResults f = new TextFilePeakResults(resultsFilename, source.hasDeviations(), source.hasEndFrame(), source.hasId(), resultsSettings.getShowPrecision());
            f.setDistanceUnit(resultsSettings.getDistanceUnit());
            f.setIntensityUnit(resultsSettings.getIntensityUnit());
            f.setAngleUnit(resultsSettings.getAngleUnit());
            f.setComputePrecision(true);
            results = f;
            break;
        case MALK:
            results = new MalkFilePeakResults(resultsFilename);
            break;
        case TSF:
            results = new TsfPeakResultsWriter(resultsFilename);
            break;
        default:
            throw new IllegalArgumentException("Unsupported file format: " + resultsSettings.getFileFormat());
    }
    results.copySettings(source);
    results.begin();
    results.addAll(source.toArray());
    results.end();
    ImageJUtils.log("Saved %s to %s", source.getName(), resultsFilename);
    return true;
}
Also used : BinaryFilePeakResults(uk.ac.sussex.gdsc.smlm.results.BinaryFilePeakResults) MalkFilePeakResults(uk.ac.sussex.gdsc.smlm.results.MalkFilePeakResults) MemoryPeakResults(uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults) ImageJImagePeakResults(uk.ac.sussex.gdsc.smlm.ij.results.ImageJImagePeakResults) PeakResults(uk.ac.sussex.gdsc.smlm.results.PeakResults) BinaryFilePeakResults(uk.ac.sussex.gdsc.smlm.results.BinaryFilePeakResults) MalkFilePeakResults(uk.ac.sussex.gdsc.smlm.results.MalkFilePeakResults) ImageJTablePeakResults(uk.ac.sussex.gdsc.smlm.ij.results.ImageJTablePeakResults) TextFilePeakResults(uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults) TsfPeakResultsWriter(uk.ac.sussex.gdsc.smlm.results.TsfPeakResultsWriter) IOException(java.io.IOException) File(java.io.File) TextFilePeakResults(uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults)

Aggregations

TextFilePeakResults (uk.ac.sussex.gdsc.smlm.results.TextFilePeakResults)8 OpenDialog (ij.io.OpenDialog)2 File (java.io.File)2 ImageJImagePeakResults (uk.ac.sussex.gdsc.smlm.ij.results.ImageJImagePeakResults)2 ImageJTablePeakResults (uk.ac.sussex.gdsc.smlm.ij.results.ImageJTablePeakResults)2 BinaryFilePeakResults (uk.ac.sussex.gdsc.smlm.results.BinaryFilePeakResults)2 MalkFilePeakResults (uk.ac.sussex.gdsc.smlm.results.MalkFilePeakResults)2 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)2 PeakResults (uk.ac.sussex.gdsc.smlm.results.PeakResults)2 Trace (uk.ac.sussex.gdsc.smlm.results.Trace)2 TsfPeakResultsWriter (uk.ac.sussex.gdsc.smlm.results.TsfPeakResultsWriter)2 TextWindow (ij.text.TextWindow)1 Point (java.awt.Point)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 BufferedTextWindow (uk.ac.sussex.gdsc.core.ij.BufferedTextWindow)1 Coordinate (uk.ac.sussex.gdsc.core.match.Coordinate)1 PointPair (uk.ac.sussex.gdsc.core.match.PointPair)1