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;
}
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();
}
}
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;
}
Aggregations