use of gdsc.smlm.results.TSFPeakResultsWriter in project GDSC-SMLM by aherbert.
the class PeakFit method addFileResults.
private void addFileResults(PeakResultsList resultsList) {
String filename = null;
if (resultsSettings.resultsDirectory != null && new File(resultsSettings.resultsDirectory).exists()) {
filename = resultsSettings.resultsDirectory + File.separatorChar + source.getName() + ".results." + resultsSettings.getResultsFileFormat().getExtension();
} else if (resultsSettings.resultsFilename != null && resultsSettings.resultsFilename.length() > 0) {
filename = resultsSettings.resultsFilename;
}
if (filename != null) {
PeakResults r;
switch(resultsSettings.getResultsFileFormat()) {
case GDSC_BINARY:
r = new BinaryFilePeakResults(filename, resultsSettings.showDeviations);
break;
case GDSC_TEXT:
r = new FilePeakResults(filename, resultsSettings.showDeviations);
break;
case MALK:
r = new MALKFilePeakResults(resultsSettings.resultsFilename);
break;
case TSF:
r = new TSFPeakResultsWriter(resultsSettings.resultsFilename);
break;
default:
throw new RuntimeException("Unsupported file format: " + resultsSettings.getResultsFileFormat());
}
if (r instanceof FilePeakResults) {
FilePeakResults fr = (FilePeakResults) r;
fr.setSortAfterEnd(Prefs.getThreads() > 1);
fr.setPeakIdColumnName("Frame");
}
resultsList.addOutput(r);
}
}
use of gdsc.smlm.results.TSFPeakResultsWriter in project GDSC-SMLM by aherbert.
the class ResultsManager method addFileResults.
private void addFileResults(PeakResultsList resultsList, boolean showDeviations, boolean showEndFrame, boolean showId) {
if (resultsSettings.resultsFilename != null && resultsSettings.resultsFilename.length() > 0) {
// Remove extension
resultsSettings.resultsFilename = Utils.replaceExtension(resultsSettings.resultsFilename, resultsSettings.getResultsFileFormat().getExtension());
if (fileInput && inputFilename.equals(resultsSettings.resultsFilename)) {
IJ.log(TITLE + ": Input and output files are the same, skipping output ...");
return;
}
// Check if file exists
File file = new File(resultsSettings.resultsFilename);
if (file.exists()) {
YesNoCancelDialog d = new YesNoCancelDialog(IJ.getInstance(), TITLE, "Overwrite existing file?\n" + resultsSettings.resultsFilename);
if (!d.yesPressed())
return;
}
File parent = file.getParentFile();
if (parent != null && parent.exists()) {
PeakResults r;
switch(resultsSettings.getResultsFileFormat()) {
case GDSC_BINARY:
r = new BinaryFilePeakResults(resultsSettings.resultsFilename, showDeviations, showEndFrame, showId);
break;
case GDSC_TEXT:
r = new FilePeakResults(resultsSettings.resultsFilename, showDeviations, showEndFrame, showId);
break;
case MALK:
r = new MALKFilePeakResults(resultsSettings.resultsFilename);
break;
case TSF:
r = new TSFPeakResultsWriter(resultsSettings.resultsFilename);
break;
default:
throw new RuntimeException("Unsupported file format: " + resultsSettings.getResultsFileFormat());
}
if (r instanceof FilePeakResults) {
FilePeakResults fr = (FilePeakResults) r;
fr.setPeakIdColumnName("Frame");
}
resultsList.addOutput(r);
}
}
}
Aggregations