use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.
the class YeastMask method showDialog.
private boolean showDialog() {
GenericDialog gd = new GenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
gd.addMessage("Create a mask of a yeast cell as a tube plus end-caps");
gd.addSlider("Tube_length (um)", 10, 20, length);
gd.addSlider("Radius (um)", 0.5, 5, radius);
gd.addCheckbox("Exclude_nucleus", excludeNucleus);
gd.addSlider("Nucleus (fraction)", 0.5, 1, nucleus);
gd.addNumericField("Pixel_pitch", nmPerPixel, 1, 6, "nm");
gd.addNumericField("Pixel_depth", nmPerSlice, 1, 6, "nm");
gd.addCheckbox("Square_output", squareOutput);
gd.addSlider("Border", 0, 10, border);
gd.addCheckbox("2D", is2D);
gd.showDialog();
if (gd.wasCanceled())
return false;
length = gd.getNextNumber();
radius = gd.getNextNumber();
excludeNucleus = gd.getNextBoolean();
nucleus = gd.getNextNumber();
nmPerPixel = gd.getNextNumber();
nmPerSlice = gd.getNextNumber();
squareOutput = gd.getNextBoolean();
border = (int) gd.getNextNumber();
is2D = gd.getNextBoolean();
if (radius < 0.5)
radius = 0.5;
if (length < 0)
length = 0;
if (nmPerPixel < 1)
nmPerPixel = 1;
if (nmPerSlice < 1)
nmPerSlice = 1;
return true;
}
use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.
the class PCPALMAnalysis method showDialog.
private boolean showDialog() {
GenericDialog gd = new GenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
if (blinkingRate < 1 || copiedBlinkingRate != PCPALMMolecules.blinkingRate) {
copiedBlinkingRate = blinkingRate = PCPALMMolecules.blinkingRate;
}
if (nmPerPixel < 1 || copiedNmPerPixel != PCPALMMolecules.nmPerPixel) {
copiedNmPerPixel = nmPerPixel = PCPALMMolecules.nmPerPixel;
}
gd.addMessage("Analyse clusters using Pair Correlation.");
gd.addNumericField("Correlation_distance (nm)", correlationDistance, 0);
if (!spatialDomain) {
gd.addMessage("-=- Frequency domain analysis -=-");
gd.addCheckbox("Binary_image", binaryImage);
gd.addNumericField("Blinking_rate", blinkingRate, 2);
gd.addNumericField("nm_per_pixel", nmPerPixel, 2);
gd.addCheckbox("Show_error_bars", showErrorBars);
gd.addCheckbox("Apply_window", applyWindow);
gd.addCheckbox("Show_high_res_image", showHighResolutionImage);
gd.addCheckbox("Show_correlation_images", showCorrelationImages);
} else {
gd.addMessage("-=- Spatial domain analysis -=-");
gd.addCheckbox("Use_border", useBorder);
gd.addNumericField("Correlation_interval (nm)", correlationInterval, 0);
}
gd.showDialog();
if (gd.wasCanceled())
return false;
correlationDistance = gd.getNextNumber();
if (!spatialDomain) {
binaryImage = gd.getNextBoolean();
blinkingRate = gd.getNextNumber();
nmPerPixel = gd.getNextNumber();
showErrorBars = gd.getNextBoolean();
applyWindow = gd.getNextBoolean();
showHighResolutionImage = gd.getNextBoolean();
showCorrelationImages = gd.getNextBoolean();
} else {
useBorder = gd.getNextBoolean();
correlationInterval = gd.getNextNumber();
}
// Check arguments
try {
if (!spatialDomain) {
Parameters.isAbove("Correlation distance", correlationDistance, 1);
Parameters.isEqualOrAbove("Blinking_rate", blinkingRate, 1);
Parameters.isAboveZero("nm per pixel", nmPerPixel);
} else {
Parameters.isAboveZero("Correlation interval", correlationInterval);
}
} catch (IllegalArgumentException ex) {
error(ex.getMessage());
return false;
}
return true;
}
use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.
the class CreateData method run.
/*
* (non-Javadoc)
*
* @see ij.plugin.PlugIn#run(java.lang.String)
*/
public void run(String arg) {
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
extraOptions = Utils.isExtraOptions();
simpleMode = (arg != null && arg.contains("simple"));
benchmarkMode = (arg != null && arg.contains("benchmark"));
spotMode = (arg != null && arg.contains("spot"));
trackMode = (arg != null && arg.contains("track"));
if ("load".equals(arg)) {
loadBenchmarkData();
return;
}
// Each localisation is a simulated emission of light from a point in space and time
List<LocalisationModel> localisations = null;
// Each localisation set is a collection of localisations that represent all localisations
// with the same ID that are on in the same image time frame (Note: the simulation
// can create many localisations per fluorophore per time frame which is useful when
// modelling moving particles)
List<LocalisationModelSet> localisationSets = null;
// Each fluorophore contains the on and off times when light was emitted
List<? extends FluorophoreSequenceModel> fluorophores = null;
if (simpleMode || benchmarkMode || spotMode) {
if (!showSimpleDialog())
return;
resetMemory();
// 1 second frames
settings.exposureTime = 1000;
areaInUm = settings.size * settings.pixelPitch * settings.size * settings.pixelPitch / 1e6;
// Number of spots per frame
int n = 0;
int[] nextN = null;
SpatialDistribution dist;
if (benchmarkMode) {
// --------------------
// BENCHMARK SIMULATION
// --------------------
// Draw the same point on the image repeatedly
n = 1;
dist = createFixedDistribution();
reportAndSaveFittingLimits(dist);
} else if (spotMode) {
// ---------------
// SPOT SIMULATION
// ---------------
// The spot simulation draws 0 or 1 random point per frame.
// Ensure we have 50% of the frames with a spot.
nextN = new int[settings.particles * 2];
Arrays.fill(nextN, 0, settings.particles, 1);
Random rand = new Random();
rand.shuffle(nextN);
// Only put spots in the central part of the image
double border = settings.size / 4.0;
dist = createUniformDistribution(border);
} else {
// -----------------
// SIMPLE SIMULATION
// -----------------
// The simple simulation draws n random points per frame to achieve a specified density.
// No points will appear in multiple frames.
// Each point has a random number of photons sampled from a range.
// We can optionally use a mask. Create his first as it updates the areaInUm
dist = createDistribution();
// Randomly sample (i.e. not uniform density in all frames)
if (settings.samplePerFrame) {
final double mean = areaInUm * settings.density;
System.out.printf("Mean samples = %f\n", mean);
if (mean < 0.5) {
GenericDialog gd = new GenericDialog(TITLE);
gd.addMessage("The mean samples per frame is low: " + Utils.rounded(mean) + "\n \nContinue?");
gd.enableYesNoCancel();
gd.hideCancelButton();
gd.showDialog();
if (!gd.wasOKed())
return;
}
PoissonDistribution poisson = new PoissonDistribution(createRandomGenerator(), mean, PoissonDistribution.DEFAULT_EPSILON, PoissonDistribution.DEFAULT_MAX_ITERATIONS);
StoredDataStatistics samples = new StoredDataStatistics(settings.particles);
while (samples.getSum() < settings.particles) {
samples.add(poisson.sample());
}
nextN = new int[samples.getN()];
for (int i = 0; i < nextN.length; i++) nextN[i] = (int) samples.getValue(i);
} else {
// Use the density to get the number per frame
n = (int) FastMath.max(1, Math.round(areaInUm * settings.density));
}
}
RandomGenerator random = null;
localisations = new ArrayList<LocalisationModel>(settings.particles);
localisationSets = new ArrayList<LocalisationModelSet>(settings.particles);
final int minPhotons = (int) settings.photonsPerSecond;
final int range = (int) settings.photonsPerSecondMaximum - minPhotons + 1;
if (range > 1)
random = createRandomGenerator();
// Add frames at the specified density until the number of particles has been reached
int id = 0;
int t = 0;
while (id < settings.particles) {
// Allow the number per frame to be specified
if (nextN != null) {
if (t >= nextN.length)
break;
n = nextN[t];
}
// Simulate random positions in the frame for the specified density
t++;
for (int j = 0; j < n; j++) {
final double[] xyz = dist.next();
// Ignore within border. We do not want to draw things we cannot fit.
//if (!distBorder.isWithinXY(xyz))
// continue;
// Simulate random photons
final int intensity = minPhotons + ((random != null) ? random.nextInt(range) : 0);
LocalisationModel m = new LocalisationModel(id, t, xyz, intensity, LocalisationModel.CONTINUOUS);
localisations.add(m);
// Each localisation can be a separate localisation set
LocalisationModelSet set = new LocalisationModelSet(id, t);
set.add(m);
localisationSets.add(set);
id++;
}
}
} else {
if (!showDialog())
return;
resetMemory();
areaInUm = settings.size * settings.pixelPitch * settings.size * settings.pixelPitch / 1e6;
int totalSteps;
double correlation = 0;
ImageModel imageModel;
if (trackMode) {
// ----------------
// TRACK SIMULATION
// ----------------
// In track mode we create fixed lifetime fluorophores that do not overlap in time.
// This is the simplest simulation to test moving molecules.
settings.seconds = (int) Math.ceil(settings.particles * (settings.exposureTime + settings.tOn) / 1000);
totalSteps = 0;
final double simulationStepsPerFrame = (settings.stepsPerSecond * settings.exposureTime) / 1000.0;
imageModel = new FixedLifetimeImageModel(settings.stepsPerSecond * settings.tOn / 1000.0, simulationStepsPerFrame);
} else {
// ---------------
// FULL SIMULATION
// ---------------
// The full simulation draws n random points in space.
// The same molecule may appear in multiple frames, move and blink.
//
// Points are modelled as fluorophores that must be activated and then will
// blink and photo-bleach. The molecules may diffuse and this can be simulated
// with many steps per image frame. All steps from a frame are collected
// into a localisation set which can be drawn on the output image.
SpatialIllumination activationIllumination = createIllumination(settings.pulseRatio, settings.pulseInterval);
// Generate additional frames so that each frame has the set number of simulation steps
totalSteps = (int) Math.ceil(settings.seconds * settings.stepsPerSecond);
// Since we have an exponential decay of activations
// ensure half of the particles have activated by 30% of the frames.
double eAct = totalSteps * 0.3 * activationIllumination.getAveragePhotons();
// Q. Does tOn/tOff change depending on the illumination strength?
imageModel = new ActivationEnergyImageModel(eAct, activationIllumination, settings.stepsPerSecond * settings.tOn / 1000.0, settings.stepsPerSecond * settings.tOffShort / 1000.0, settings.stepsPerSecond * settings.tOffLong / 1000.0, settings.nBlinksShort, settings.nBlinksLong);
imageModel.setUseGeometricDistribution(settings.nBlinksGeometricDistribution);
// Only use the correlation if selected for the distribution
if (PHOTON_DISTRIBUTION[PHOTON_CORRELATED].equals(settings.photonDistribution))
correlation = settings.correlation;
}
imageModel.setRandomGenerator(createRandomGenerator());
imageModel.setPhotonBudgetPerFrame(true);
imageModel.setDiffusion2D(settings.diffuse2D);
imageModel.setRotation2D(settings.rotate2D);
IJ.showStatus("Creating molecules ...");
SpatialDistribution distribution = createDistribution();
List<CompoundMoleculeModel> compounds = createCompoundMolecules();
if (compounds == null)
return;
List<CompoundMoleculeModel> molecules = imageModel.createMolecules(compounds, settings.particles, distribution, settings.rotateInitialOrientation);
// Activate fluorophores
IJ.showStatus("Creating fluorophores ...");
// Note: molecules list will be converted to compounds containing fluorophores
fluorophores = imageModel.createFluorophores(molecules, totalSteps);
if (fluorophores.isEmpty()) {
IJ.error(TITLE, "No fluorophores created");
return;
}
IJ.showStatus("Creating localisations ...");
// TODO - Output a molecule Id for each fluorophore if using compound molecules. This allows analysis
// of the ratio of trimers, dimers, monomers, etc that could be detected.
totalSteps = checkTotalSteps(totalSteps, fluorophores);
if (totalSteps == 0)
return;
imageModel.setPhotonDistribution(createPhotonDistribution());
imageModel.setConfinementDistribution(createConfinementDistribution());
// This should be optimised
imageModel.setConfinementAttempts(10);
localisations = imageModel.createImage(molecules, settings.fixedFraction, totalSteps, (double) settings.photonsPerSecond / settings.stepsPerSecond, correlation, settings.rotateDuringSimulation);
// Re-adjust the fluorophores to the correct time
if (settings.stepsPerSecond != 1) {
final double scale = 1.0 / settings.stepsPerSecond;
for (FluorophoreSequenceModel f : fluorophores) f.adjustTime(scale);
}
// Integrate the frames
localisationSets = combineSimulationSteps(localisations);
localisationSets = filterToImageBounds(localisationSets);
}
datasetNumber++;
localisations = drawImage(localisationSets);
if (localisations == null || localisations.isEmpty()) {
IJ.error(TITLE, "No localisations created");
return;
}
fluorophores = removeFilteredFluorophores(fluorophores, localisations);
double signalPerFrame = showSummary(fluorophores, localisations);
if (!benchmarkMode) {
boolean fullSimulation = (!(simpleMode || spotMode));
saveSimulationParameters(localisations.size(), fullSimulation, signalPerFrame);
}
IJ.showStatus("Saving data ...");
//convertRelativeToAbsolute(molecules);
saveFluorophores(fluorophores);
saveImageResults(results);
saveLocalisations(localisations);
// The settings for the filenames may have changed
SettingsManager.saveSettings(globalSettings);
IJ.showStatus("Done");
}
use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.
the class Configuration method showDialog.
/**
* Show the current properties
*/
@SuppressWarnings("unchecked")
public void showDialog() {
configurationChanged = false;
String filename = SettingsManager.getSettingsFilename();
GlobalSettings settings = SettingsManager.loadSettings(filename);
FitEngineConfiguration config = settings.getFitEngineConfiguration();
FitConfiguration fitConfig = config.getFitConfiguration();
Calibration calibration = settings.getCalibration();
GenericDialog gd = new GenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
gd.addMessage("Configuration settings for the single-molecule localisation microscopy plugins");
gd.addStringField("Config_file", filename, 40);
gd.addNumericField("Calibration (nm/px)", calibration.getNmPerPixel(), 2);
gd.addNumericField("Gain", calibration.getGain(), 2);
gd.addCheckbox("EM-CCD", calibration.isEmCCD());
gd.addNumericField("Exposure_time (ms)", calibration.getExposureTime(), 2);
gd.addMessage("--- Gaussian parameters ---");
gd.addNumericField("Initial_StdDev0", fitConfig.getInitialPeakStdDev0(), 3);
gd.addNumericField("Initial_StdDev1", fitConfig.getInitialPeakStdDev1(), 3);
gd.addNumericField("Initial_Angle", fitConfig.getInitialAngle(), 3);
gd.addMessage("--- Maxima identification ---");
String[] filterTypes = SettingsManager.getNames((Object[]) DataFilterType.values());
gd.addChoice("Spot_filter_type", filterTypes, filterTypes[config.getDataFilterType().ordinal()]);
String[] filterNames = SettingsManager.getNames((Object[]) DataFilter.values());
gd.addChoice("Spot_filter", filterNames, filterNames[config.getDataFilter(0).ordinal()]);
gd.addSlider("Smoothing", 0, 2.5, config.getSmooth(0));
gd.addSlider("Search_width", 0.5, 2.5, config.getSearch());
gd.addSlider("Border", 0.5, 2.5, config.getBorder());
gd.addSlider("Fitting_width", 2, 4.5, config.getFitting());
gd.addMessage("--- Gaussian fitting ---");
Component splitLabel = gd.getMessage();
String[] solverNames = SettingsManager.getNames((Object[]) FitSolver.values());
gd.addChoice("Fit_solver", solverNames, solverNames[fitConfig.getFitSolver().ordinal()]);
String[] functionNames = SettingsManager.getNames((Object[]) FitFunction.values());
gd.addChoice("Fit_function", functionNames, functionNames[fitConfig.getFitFunction().ordinal()]);
// Parameters specific to each Fit solver are collected in a second dialog
gd.addNumericField("Fail_limit", config.getFailuresLimit(), 0);
gd.addCheckbox("Include_neighbours", config.isIncludeNeighbours());
gd.addSlider("Neighbour_height", 0.01, 1, config.getNeighbourHeightThreshold());
gd.addSlider("Residuals_threshold", 0.01, 1, config.getResidualsThreshold());
gd.addSlider("Duplicate_distance", 0, 1.5, fitConfig.getDuplicateDistance());
gd.addMessage("--- Peak filtering ---\nDiscard fits that shift; are too low; or expand/contract");
gd.addCheckbox("Smart_filter", fitConfig.isSmartFilter());
gd.addCheckbox("Disable_simple_filter", fitConfig.isDisableSimpleFilter());
gd.addSlider("Shift_factor", 0.01, 2, fitConfig.getCoordinateShiftFactor());
gd.addNumericField("Signal_strength", fitConfig.getSignalStrength(), 2);
gd.addNumericField("Min_photons", fitConfig.getMinPhotons(), 0);
gd.addSlider("Min_width_factor", 0, 0.99, fitConfig.getMinWidthFactor());
gd.addSlider("Width_factor", 1.01, 5, fitConfig.getWidthFactor());
gd.addNumericField("Precision_threshold", fitConfig.getPrecisionThreshold(), 2);
// Add a mouse listener to the config file field
if (Utils.isShowGenericDialog()) {
Vector<TextField> texts = (Vector<TextField>) gd.getStringFields();
Vector<TextField> numerics = (Vector<TextField>) gd.getNumericFields();
Vector<Checkbox> checkboxes = (Vector<Checkbox>) gd.getCheckboxes();
Vector<Choice> choices = (Vector<Choice>) gd.getChoices();
int n = 0;
int t = 0;
int b = 0;
int ch = 0;
textConfigFile = texts.get(t++);
textConfigFile.addMouseListener(this);
textConfigFile.addTextListener(this);
// TODO: add a value changed listener to detect when typing a new file
textNmPerPixel = numerics.get(n++);
textGain = numerics.get(n++);
textEMCCD = checkboxes.get(b++);
textExposure = numerics.get(n++);
textInitialPeakStdDev0 = numerics.get(n++);
textInitialPeakStdDev1 = numerics.get(n++);
textInitialAngleD = numerics.get(n++);
textDataFilterType = choices.get(ch++);
textDataFilter = choices.get(ch++);
textSmooth = numerics.get(n++);
textSearch = numerics.get(n++);
textBorder = numerics.get(n++);
textFitting = numerics.get(n++);
textFitSolver = choices.get(ch++);
textFitFunction = choices.get(ch++);
textFailuresLimit = numerics.get(n++);
textIncludeNeighbours = checkboxes.get(b++);
textNeighbourHeightThreshold = numerics.get(n++);
textResidualsThreshold = numerics.get(n++);
textDuplicateDistance = numerics.get(n++);
textSmartFilter = checkboxes.get(b++);
textDisableSimpleFilter = checkboxes.get(b++);
textCoordinateShiftFactor = numerics.get(n++);
textSignalStrength = numerics.get(n++);
textMinPhotons = numerics.get(n++);
textMinWidthFactor = numerics.get(n++);
textWidthFactor = numerics.get(n++);
textPrecisionThreshold = numerics.get(n++);
updateFilterInput();
textSmartFilter.addItemListener(this);
textDisableSimpleFilter.addItemListener(this);
}
if (gd.getLayout() != null) {
GridBagLayout grid = (GridBagLayout) gd.getLayout();
int xOffset = 0, yOffset = 0;
int lastY = -1, rowCount = 0;
for (Component comp : gd.getComponents()) {
// Check if this should be the second major column
if (comp == splitLabel) {
xOffset += 2;
yOffset -= rowCount;
}
// Reposition the field
GridBagConstraints c = grid.getConstraints(comp);
if (lastY != c.gridy)
rowCount++;
lastY = c.gridy;
c.gridx = c.gridx + xOffset;
c.gridy = c.gridy + yOffset;
c.insets.left = c.insets.left + 10 * xOffset;
c.insets.top = 0;
c.insets.bottom = 0;
grid.setConstraints(comp, c);
}
if (IJ.isLinux())
gd.setBackground(new Color(238, 238, 238));
}
gd.showDialog();
if (gd.wasCanceled())
return;
filename = gd.getNextString();
calibration.setNmPerPixel(gd.getNextNumber());
calibration.setGain(gd.getNextNumber());
calibration.setEmCCD(gd.getNextBoolean());
calibration.setExposureTime(gd.getNextNumber());
fitConfig.setInitialPeakStdDev0(gd.getNextNumber());
fitConfig.setInitialPeakStdDev1(gd.getNextNumber());
fitConfig.setInitialAngleD(gd.getNextNumber());
config.setDataFilterType(gd.getNextChoiceIndex());
config.setDataFilter(gd.getNextChoiceIndex(), Math.abs(gd.getNextNumber()), 0);
config.setSearch(gd.getNextNumber());
config.setBorder(gd.getNextNumber());
config.setFitting(gd.getNextNumber());
fitConfig.setFitSolver(gd.getNextChoiceIndex());
fitConfig.setFitFunction(gd.getNextChoiceIndex());
config.setFailuresLimit((int) gd.getNextNumber());
config.setIncludeNeighbours(gd.getNextBoolean());
config.setNeighbourHeightThreshold(gd.getNextNumber());
config.setResidualsThreshold(gd.getNextNumber());
fitConfig.setDuplicateDistance(gd.getNextNumber());
fitConfig.setSmartFilter(gd.getNextBoolean());
fitConfig.setDisableSimpleFilter(gd.getNextBoolean());
fitConfig.setCoordinateShiftFactor(gd.getNextNumber());
fitConfig.setSignalStrength(gd.getNextNumber());
fitConfig.setMinPhotons(gd.getNextNumber());
fitConfig.setMinWidthFactor(gd.getNextNumber());
fitConfig.setWidthFactor(gd.getNextNumber());
fitConfig.setPrecisionThreshold(gd.getNextNumber());
// Check arguments
try {
Parameters.isAboveZero("nm per pixel", calibration.getNmPerPixel());
Parameters.isAboveZero("Gain", calibration.getGain());
Parameters.isAboveZero("Exposure time", calibration.getExposureTime());
Parameters.isAboveZero("Initial SD0", fitConfig.getInitialPeakStdDev0());
Parameters.isAboveZero("Initial SD1", fitConfig.getInitialPeakStdDev1());
Parameters.isPositive("Initial angle", fitConfig.getInitialAngleD());
Parameters.isAboveZero("Search_width", config.getSearch());
Parameters.isAboveZero("Fitting_width", config.getFitting());
Parameters.isPositive("Failures limit", config.getFailuresLimit());
Parameters.isPositive("Neighbour height threshold", config.getNeighbourHeightThreshold());
Parameters.isPositive("Residuals threshold", config.getResidualsThreshold());
Parameters.isPositive("Duplicate distance", fitConfig.getDuplicateDistance());
Parameters.isPositive("Coordinate Shift factor", fitConfig.getCoordinateShiftFactor());
Parameters.isPositive("Signal strength", fitConfig.getSignalStrength());
Parameters.isPositive("Min photons", fitConfig.getMinPhotons());
Parameters.isPositive("Min width factor", fitConfig.getMinWidthFactor());
Parameters.isPositive("Width factor", fitConfig.getWidthFactor());
Parameters.isPositive("Precision threshold", fitConfig.getPrecisionThreshold());
} catch (IllegalArgumentException e) {
IJ.error(TITLE, e.getMessage());
return;
}
if (gd.invalidNumber())
return;
configurationChanged = SettingsManager.saveSettings(settings, filename);
if (configurationChanged)
SettingsManager.saveSettingsFilename(filename);
if (!PeakFit.configureSmartFilter(settings, filename))
return;
if (!PeakFit.configureDataFilter(settings, filename, false))
return;
PeakFit.configureFitSolver(settings, filename, false);
}
use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.
the class BlinkEstimator method calculateAveragePrecision.
private double calculateAveragePrecision(MemoryPeakResults results, boolean verbose) {
PCPALMMolecules fitter = new PCPALMMolecules();
ArrayList<Molecule> molecules = fitter.extractLocalisations(results);
String title = (verbose) ? TITLE + " Localisation Precision" : null;
double fittedAverage = fitter.calculateAveragePrecision(molecules, title, histogramBins, true, true);
// Sense check the precision
if (fittedAverage < 5 || fittedAverage > 60) {
GenericDialog gd = new GenericDialog(TITLE);
gd.addMessage("Estimated precision is not within expected bounds.\nPlease enter an estimate:");
gd.addSlider("Precision", 5, 60, fittedAverage);
gd.showDialog();
if (!gd.wasCanceled())
fittedAverage = gd.getNextNumber();
}
// The fitter does checks for a good fit to the histogram so just return the value
return fittedAverage;
}
Aggregations