Skip to content

Commit

Permalink
Add plotting of PSF parameters to summarise results
Browse files Browse the repository at this point in the history
  • Loading branch information
aherbert committed Sep 4, 2023
1 parent e4d92c2 commit c141472
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
import uk.ac.sussex.gdsc.smlm.data.config.CalibrationReader;
import uk.ac.sussex.gdsc.smlm.data.config.FitProtos.PrecisionMethod;
import uk.ac.sussex.gdsc.smlm.data.config.FitProtosHelper;
import uk.ac.sussex.gdsc.smlm.data.config.PSFProtos.PSF;
import uk.ac.sussex.gdsc.smlm.data.config.PSFProtos.PSFParameter;
import uk.ac.sussex.gdsc.smlm.data.config.PsfHelper;
import uk.ac.sussex.gdsc.smlm.data.config.UnitHelper;
import uk.ac.sussex.gdsc.smlm.ij.settings.GUIProtos.SummariseResultsSettings;
import uk.ac.sussex.gdsc.smlm.ij.settings.SettingsManager;
Expand Down Expand Up @@ -340,6 +343,17 @@ private static void showStatistics(MemoryPeakResults result) {
gd.addCheckbox("Plot_noise", settings.getPlotNoise());
gd.addCheckbox("Plot_SNR", settings.getPlotSnr());
gd.addCheckbox("Plot_precision", settings.getPlotPrecision());

// Custom PSF fields
PSF psf = result.getPsf();
if (psf != null) {
for (int i = 0; i < psf.getParametersCount(); i++) {
final PSFParameter p = psf.getParameters(i);
gd.addCheckbox(String.format("PSF_parameter_%d (%s)", i + 1, p.getName()),
i < settings.getPlotPsfCount() && settings.getPlotPsf(i));
}
}

gd.addNumericField("Histgram_bins", settings.getHistgramBins(), 0);
gd.addChoice("Remove_outliers", REMOVE_OUTLIERS, settings.getRemoveOutliers());
gd.showDialog();
Expand All @@ -354,6 +368,18 @@ private static void showStatistics(MemoryPeakResults result) {
settings.setPlotNoise(gd.getNextBoolean());
settings.setPlotSnr(gd.getNextBoolean());
settings.setPlotPrecision(gd.getNextBoolean());

if (psf != null) {
for (int i = 0; i < psf.getParametersCount(); i++) {
boolean value = gd.getNextBoolean();
if (i < settings.getPlotPsfCount()) {
settings.setPlotPsf(i, value);
} else {
settings.addPlotPsf(value);
}
}
}

settings.setHistgramBins(Math.max(0, (int) gd.getNextNumber()));
settings.setRemoveOutliers(gd.getNextChoiceIndex());
SettingsManager.writeSettings(settings);
Expand Down Expand Up @@ -413,6 +439,14 @@ private static void showStatistics(MemoryPeakResults result) {
// Ignore
}
}
if (psf != null) {
for (int i = 0; i < psf.getParametersCount(); i++) {
if (settings.getPlotPsf(i)) {
final PSFParameter p = psf.getParameters(i);
plot(plotBuilder, wo, "PSF " + p.getName(), result, PeakResult.STANDARD_PARAMETERS + i);
}
}
}

wo.tile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ message SummariseResultsSettings {
bool plot_precision = 8;
int32 histgram_bins = 9;
int32 remove_outliers = 10;
repeated bool plot_psf = 11;
}

// Contains settings for the ImageJ 3D Results Viewer plugin
Expand Down

0 comments on commit c141472

Please sign in to comment.