Search in sources :

Example 1 with FIREResult

use of gdsc.smlm.ij.frc.FRC.FIREResult in project GDSC-SMLM by aherbert.

the class FIRE method calculateFireNumber.

/**
	 * Calculate the Fourier Image REsolution (FIRE) number using the chosen threshold method. Should be called after
	 * {@link #initialise(MemoryPeakResults)}
	 *
	 * @param fourierMethod
	 *            the fourier method
	 * @param samplingMethod
	 *            the sampling method
	 * @param thresholdMethod
	 *            the threshold method
	 * @param images
	 *            the images
	 * @return The FIRE number
	 */
public FireResult calculateFireNumber(FourierMethod fourierMethod, SamplingMethod samplingMethod, ThresholdMethod thresholdMethod, FireImages images) {
    if (images == null)
        return null;
    FRC frc = new FRC();
    // Allow a progress tracker to be input.
    // This should be setup for the total number of repeats. 
    // If parallelised then do not output the text status messages as they conflict. 
    frc.progress = progress;
    frc.setFourierMethod(fourierMethod);
    frc.setSamplingMethod(samplingMethod);
    frc.setPerimeterSamplingFactor(perimeterSamplingFactor);
    FRCCurve frcCurve = frc.calculateFrcCurve(images.ip1, images.ip2, images.nmPerPixel);
    if (frcCurve == null)
        return null;
    if (correctionQValue > 0)
        FRC.applyQCorrection(frcCurve, correctionQValue, correctionMean, correctionSigma);
    double[] originalCorrelationCurve = frcCurve.getCorrelationValues();
    FRC.getSmoothedCurve(frcCurve, true);
    // Resolution in pixels
    FIREResult result = FRC.calculateFire(frcCurve, thresholdMethod);
    if (result == null)
        return new FireResult(Double.NaN, Double.NaN, frcCurve, originalCorrelationCurve);
    double fireNumber = result.fireNumber;
    // than 1/4 of R (the resolution).
    if (fireNumber > 0 && (images.nmPerPixel > fireNumber / 4)) {
        // Q. Should this be output somewhere else?
        Utils.log("%s Warning: The super-resolution pixel size (%s) should be smaller than 1/4 of R (the resolution %s)", TITLE, Utils.rounded(images.nmPerPixel), Utils.rounded(fireNumber));
    }
    return new FireResult(fireNumber, result.correlation, frcCurve, originalCorrelationCurve);
}
Also used : FRCCurve(gdsc.smlm.ij.frc.FRC.FRCCurve) FRC(gdsc.smlm.ij.frc.FRC) FIREResult(gdsc.smlm.ij.frc.FRC.FIREResult)

Aggregations

FRC (gdsc.smlm.ij.frc.FRC)1 FIREResult (gdsc.smlm.ij.frc.FRC.FIREResult)1 FRCCurve (gdsc.smlm.ij.frc.FRC.FRCCurve)1