Calibrating photon counts from a single image · Calibrating photon counts from a single image...

27
Calibrating photon counts from a single image Rainer Heintzmann 1,2* , Peter K. Relich 3 , Robert P.J. Nieuwenhuizen 4 , Keith A. Lidke 3 and Bernd Rieger 4* 1 Leibniz Institute of Photonic Technology, Jena, Germany 2 Institute of Physical Chemistry and Abbe Center of Photonics, Friedrich Schiller University, Jena, Germany 3 Department of Physics and Astronomy, University of New Mexico, Albuquerque, NM, USA 4 Department of Imaging Physics, Delft University of Technology, Delft, The Netherlands * Correspondence to: [email protected] or [email protected] Abstract Current methods for detector gain calibration require acquisition of tens of special calibration images. Here we propose a method that obtains the gain from the actual image for which the photon count is desired by quantifying out-of-band information. We show on simulation and experimental data that our much simpler procedure, which can be retroactively applied to any image, is comparable in precision to traditional gain calibration procedures. Optical recordings consist of detected photons, which typically arrive in an uncorrelated manner at the detector. Therefore the recorded intensity follows a Poisson distribution, where the variance of the photon count is equal to its mean. In many applications images must be further processed based on these statistics and it is therefore of great importance to be able to relate measured values S in analogue-to-digital-units (ADU) to the detected (effective) photon numbers N. The relation between the measured signal S in ADU and the photon count N is given by the linear gain g as S = gN. Only after conversion to photons is it possible to establish the expected precision of intensities in the image, which is essential for single particle localization, maximum-likelihood image deconvolution or denoising [Ober2004, Smith2010, Afanasyev2015, Strohl2015]. The photon count must be established via gain calibration, as most image capturing devices do not directly report the number of detected photons, but a value proportional to the photoelectron charge produced in a photomultiplier tube or collected in a camera pixel. For this calibration typically tens of calibration images are recorded and the linear relationship between mean intensity and its variance is exploited [vanVliet1998]. In current microscopy practise a detector calibration to photon counts is often not done but cannot be performed in retrospect. It thus would be extremely helpful, if that can be determined from analysing the acquisition itself – a single image. A number of algorithms have been published for Gaussian type noise [Donoho1995, Immerkaer1996] and Poissonian type noise [Foi2008, Colom2014, Azzari2014, Pyatykh2014]. However, all these routines use assumed image properties to extract the information rather than just the properties of the acquisition process as in our presented algorithm. This has major implications for their performance on microscopy images governed by photon statistics (see Supplementary Information for a comparison with implementations from Pyatykh et al. [Pyatykh2014] and Azzari et al. [Azzari2014] which performed more than an order of magnitude worse than our method).

Transcript of Calibrating photon counts from a single image · Calibrating photon counts from a single image...

Page 1: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

Calibratingphotoncountsfromasingleimage

RainerHeintzmann1,2*,PeterK.Relich3,RobertP.J.Nieuwenhuizen4,KeithA.Lidke3andBerndRieger4*

1LeibnizInstituteofPhotonicTechnology,Jena,Germany2InstituteofPhysicalChemistryandAbbeCenterofPhotonics,FriedrichSchillerUniversity,Jena,Germany3DepartmentofPhysicsandAstronomy,UniversityofNewMexico,Albuquerque,NM,USA4DepartmentofImagingPhysics,DelftUniversityofTechnology,Delft,TheNetherlands*Correspondenceto:[email protected]@tudelft.nl

AbstractCurrentmethodsfordetectorgaincalibrationrequireacquisitionoftensofspecialcalibrationimages.Hereweproposeamethodthatobtainsthegainfromtheactualimageforwhichthephotoncountisdesiredbyquantifyingout-of-bandinformation.Weshowonsimulationandexperimentaldatathatourmuchsimplerprocedure,whichcanberetroactivelyappliedtoanyimage,iscomparableinprecisiontotraditionalgaincalibrationprocedures.

Opticalrecordingsconsistofdetectedphotons,whichtypicallyarriveinanuncorrelatedmanneratthedetector.ThereforetherecordedintensityfollowsaPoissondistribution,wherethevarianceofthephotoncountisequaltoitsmean.InmanyapplicationsimagesmustbefurtherprocessedbasedonthesestatisticsanditisthereforeofgreatimportancetobeabletorelatemeasuredvaluesSinanalogue-to-digital-units(ADU)tothedetected(effective)photonnumbersN.TherelationbetweenthemeasuredsignalSinADUandthephotoncountNisgivenbythelineargaingasS=gN.Onlyafterconversiontophotonsisitpossibletoestablishtheexpectedprecisionofintensitiesintheimage,whichisessentialforsingleparticlelocalization,maximum-likelihoodimagedeconvolutionordenoising[Ober2004,Smith2010,Afanasyev2015,Strohl2015].Thephotoncountmustbeestablishedviagaincalibration,asmostimagecapturingdevicesdonotdirectlyreportthenumberofdetectedphotons,butavalueproportionaltothephotoelectronchargeproducedinaphotomultipliertubeorcollectedinacamerapixel.Forthiscalibrationtypicallytensofcalibrationimagesarerecordedandthelinearrelationshipbetweenmeanintensityanditsvarianceisexploited[vanVliet1998].Incurrentmicroscopypractiseadetectorcalibrationtophotoncountsisoftennotdonebutcannotbeperformedinretrospect.Itthuswouldbeextremelyhelpful,ifthatcanbedeterminedfromanalysingtheacquisitionitself–asingleimage.AnumberofalgorithmshavebeenpublishedforGaussiantypenoise[Donoho1995,Immerkaer1996]andPoissoniantypenoise[Foi2008,Colom2014,Azzari2014,Pyatykh2014].However,alltheseroutinesuseassumedimagepropertiestoextracttheinformationratherthanjustthepropertiesoftheacquisitionprocessasinourpresentedalgorithm.Thishasmajorimplicationsfortheirperformanceonmicroscopyimagesgovernedbyphotonstatistics(seeSupplementaryInformationforacomparisonwithimplementationsfromPyatykhetal.[Pyatykh2014]andAzzarietal.[Azzari2014]whichperformedmorethananorderofmagnitudeworsethanourmethod).

Page 2: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

Somedevices,suchasavalanchephotodiodes,photomultipliertubes(PMTs)oremCCDcamerascanbeoperatedinasinglephotoncountingmode[Chao2013]wherethegainisknowntobeone.Inmanycases,however,thegainisunknownand/oradevicesetting.Forexample,thegainofPMTscanbecontinuouslycontrolledbychangingthevoltagebetweenthedynodesandthegainofcamerasmaydeviatefromthevaluestatedinthemanual.Tocomplicatematters,devicesnotrunninginphotoncountingmode,useanoffsetOzerotoavoidnegativereadoutvalues,i.e.thedevicewillyieldanon-zeromeanvalueevenifnolightreachesthedetector,S=gN+Ozero.ThisoffsetvalueOzeroissometimeschangingovertime(“offsetdrift”).Traditionally,aseriesofabout20darkimagesand20imagesofasamplewithsmoothlychangingintensityarerecorded[vanVliet1998].Fromtheseimagesthegainiscalculatedasthelinearslopeofthevarianceovertheseimagesversusthemeanintensityg=var(S)/mean(S)(fordetailsseeSupplementaryinformation).InFigure1weshowatypicalcalibrationcurvebyfitting(blueline)theexperimentallyobtaineddata(bluecrosses).Theobtainedgaindoesnotnecessarilycorrespondtotherealgainperdetectedphoton,sinceitincludesmultiplicativenoisesourcessuchasmultiplicativeamplificationnoise,gainfluctuationsortheexcessnoiseofemCCDsandPMTs.Inadditionthereisalsoreadoutnoise,whichincludesthermalnoisebuild-upandclockinducedcharge.Theunknownreadoutnoiseandoffsetmayseematfirstglancedisadvantageousregardinganautomaticquantification.However,asshownbelow,thesedetailsdonotmatterforthepurposeofpredictingthecorrectnoisefromameasuredsignal.

LetusfirstassumethatweknowtheoffsetOzeroandanypotentialreadoutnoisevarianceVread.TheregioninFourierspaceabovethecut-offfrequencyofthesupportoftheopticaltransferfunctiononlycontainsnoiseinanimage[Liu2017],wherebothPoissonandGaussiannoiseareevenlydistributedoverallfrequencies[Chanran1990,Liu2017].BymeasuringthespectralpowerdensityofthenoiseVHFinthishigh-frequencyout-of-bandregionandaccountingfortheareafractionfofthisregioninFourierspace,wecanestimatethetotalvarianceVall=VHF/fofalldetectedphotons.Thenthegaingisthenobtainedas

(1) 𝑔 = !!""!!!"#$(!!!!"#$)

wherewerelatethephoton-noise-onlyvarianceVall-Vreadtothesumoffset-correctedsignaloverallpixelsintheimage(seeOnlineMethods).Thedevicemanufacturersusuallyprovidethereadoutnoiseleavingonlytheoffsetandgaintobedeterminedfromtheimageitselfinpractise.Toalsoestimateboth,theoffsettogetherwiththegain,weneedmoreinformationfromthelinearmean-variancedependencethangivenbyequation(1).Weachievethisbytilingtheinputimage,e.g.into3×3sub-images,andprocesseachofthesesub-imagestogenerateonedatapointinamean-varianceplot.Fromtheseninedatapointsweobtaintheaxisoffset(Ono-noise).Wethenperformthegainestimation(1)onthewholeimageafteroffsetcorrection(SeeOnlineMethodsandSupplementaryInformation).AsseenfromFigure1thelinearregressionofthemean-variancecurvedeterminestheaxisoffsetADUvalueOno-noiseatwhichzeronoisewouldbeexpected.YetwecannotsimultaneouslydeterminebothoffsetOzeroandreadoutnoiseVread.Ifeitherofthemisknownapriori,theothercanbecalculated:Vread=g(Ozero-Ono-noise),whichis,however,notneededtopredictthecorrectnoiselevelforeachbrightnesslevelbasedontheautomaticallydeterminedvalueOno-noise.

Totestthesingle-imagegaincalibration,simulateddatawasgeneratedforarangeofgains(0.1,1,10)withaconstantoffset(100ADU),arangeofreadoutnoise(1,2,10photonRMS)andmaximumexpectedphotoncountsperpixel(10,100,…,105).Offsetandgainwerebothdeterminedfrom

Page 3: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

band-limitedsingleimagesoftwodifferentobjects(resolutiontargetandEinstein)withoutsignificantrelativeerrorsintheoffsetorgain(lessthan2%atmorethan10expectedmaximumphotoncounts)usingtheproposedmethod(seeSupplementaryFiguresS1-S3).Figure1quantitativelycomparestheintensitydependentvariancepredictedbyapplyingourmethodindividuallytomanysingleexperimentalin-focusimages(shadedgreenarea)withtheclassicalmethodevaluatingawholeseriesofcalibrationimages(blueline).Notethatoursingle-imagebasednoisedeterminationdoesnotrequireanypriorknowledgeaboutoffsetorreadoutnoise.Figure2showsafewtypicalexampleimagesacquiredwithvariousdetectorstogetherwiththegainandoffsetdeterminedfromeachofthemandthecalibrationvaluesobtainedfromthestandardprocedureforcomparison.Weevaluatedthegeneralapplicabilityofourmethodondatasetsfromdifferentdetectorsandmodesofacquisition(CCD,emCCD,sCMOS,PMT,GAsPandHybridDetector).Figure3quantitativelycomparesexperimentalsingleimagecalibrationwithclassicalcalibration.20individualimageswereeachsubmittedtoouralgorithmandthedeterminedoffsetandgainwascomparedtotheclassicalmethod.Thevarianceofaseparatelyacquireddarkimagewassubmittedtothealgorithmasareadoutnoiseestimate,butalternativelythereadoutnoisespecificationfromthehandbookcouldbeusedorameasuredoffsetatzerointensity.AsseenfromFigure3thesingle-image-basedgaincalibrationasproposedperformsnearlyaswellasthestandardgaincalibrationusing20images.Therelativegainerrorstaysgenerallywellbelow10%andforcamerasbelow2%.The8.5%biasfortheHyDphotoncountingsystemisunusuallyhigh,andwewereunabletofindaclearexplanationforthisdeviationfromtheclassicalcalibration.UsingonlylowerfrequenciestoestimateVHF(kt=0.4)resultedinamuchsmallererrorof2.5%inthesingle-photoncountingcasesuggestingthatdead-timeeffectsofthedetectormighthaveaffectedthehighspatialfrequencies.

Simulationsaswellasexperimentsshowagoodagreementofthedeterminedgainwiththegroundtruthorgoldstandardcalibrationrespectively.Thebiasofthegaindeterminedbythesingle-imageroutinestayedbelow4%(exceptforHyD).Forintensityquantificationanypotentialoffsetmustbesubtractedbeforeconversiontophotoncounts.Ourmethodestimatesthephotoncountverypreciselyoveralargerangeofparameters(relativeerrorbelow2%insimulations).Ourmethodcouldbeappliedtomanydifferentmicroscopymodes(widefieldtransmission,fluorescence,andconfocal)anddetectortypes(CCD,emCCD,sCMOS,PMT,GAsPandHyDphotoncounting),becauseweonlyrequiretheexistenceofanout-of-bandregion,whichpurelycontainsfrequencyindependentnoise.Thisisusuallytrue,iftheimageissampledcorrectly.AsdiscussedintheSupplementaryInformationthecut-offlimitofouralgorithmcaninpractisebesetbelowthetransferlimitandsingle-imagecalibrationcanevenoutperformthestandardcalibrationifmolecularblinkingperturbsthemeasurement

Insummaryweshowedthatsingleimagecalibrationisasimpleandversatiletool.Weexpectourworktoleadtoabetterabilitytoquantifyintensitiesingeneral.Thiswillhavesignificantimpactonallmethodsthatprofitfromknowledgeaboutthenoisedistribution.Examplesrangefromquantificationoflightintensitiesoverparameterselectionforpatch-baseddenoisinganddeconvolutionprocedurestonoiseprediction.

Page 4: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

AuthorContribution

RHconceivedtheinitialidea.BRandRHextendeditandwrotetheinitialsoftware.PRperformedexperiments.BRandRHperformedsimulationsandwrotethepaper.PRandRPJNcontributedtosolvetheoffsetestimation.KALgaveresearchadvice.Allauthorscommentedonthepaper.

CompetingfinancialinterestsTheauthorsdeclaretohavenocompetinginterest.

AcknowledgementsWethankSteffenDietzel,CoreFacilityBioimagingLMUMünchen,forprovidingcalibrationdatasets.ColinParkandSimon Denham,CarlZeissU.K.,arethankedfortheirhelpinmeasuringdataontheZeissLSM800.UteNeugebauerandChristinaGroßearethankedforhelpintakingdataonaZeiss800systemusingordinaryPMTs.ManythankstoRüdigerBader(Hamamatsu)forhissupportinthesCMOSmeasurements.GabrielaFiczisthankedfordiscussionininitialstagesofthemanuscript.DiederikFeilzeristhankedforhelpingcodingtheImageJplugin.P.K.R.andK.A.L.weresupportedbyNationalScienceFoundationgrantno.0954836.R.H.acknowledgesDeutscheForschungsgemeinschaftgrantsTRR166TPA4,B5andHE3492/7-1.B.R.acknowledgesEuropeanResearchCouncilgrantno.648580andNationalInstituteofHealthgrantno.1U01EB021238-01.

Page 5: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

References

[Afanasyev2015]P.Afanasyev,R.B.G.Ravelli,R.Matadeen,S.deCarlo,G.vanDuinen,P.J.Peters,J.-P.Abrahams,R.V.Portugal,M.Schatz,andM.vanHeel.Aposterioricorrectionofcameracharacteristicsfromlargeimagedatasets.ScientificReports,5:10317,2015.

[Azzari2014]L.AzzariandA.Foi.Indirectestimationofsignal-dependentnoisewithnonadaptiveheterogeneoussamples.IEEETransactionsonImageProcessing,23(8):3459-3466,2014.

[Chanran1990]V.ChanranandS.Elgar.Bispectralanalysisoftwo-dimensionalrandomprocesses.IEEETransactionsonAcoustics,Speech,SignalProcessing,38(12):2181-2186,1990.

[Colom2014]M.Colom,A.Buades,andJ.-M.Morel.Nonparametricnoiseestimationmethodforrawimages.JournalofTheOpticalSocietyofAmericaA,31(4):863-871,2014.

[Donoho1995]D.L.Donoho,I.M.Johnstone,G.Kerkyacharian,andD.Picard.Waveletshrinkage:Asymptopia?JournaloftheRoyalStatisticalSociety.SeriesB(Methodological),57(2):301-369,1995.

[Foi2008]A.Foi,M.Tremeche,V.Katkovnik,andK.Egiazarian.PracticalPoissonian-Gaussiannoisemodelingandfittingforsingle-imageraw-data.IEEETransactionsonImageProcessing,17(10):1737-1754,2008.

[Immerkaer1996]J.Immerkaer.Fastnoisevarianceestimation.ComputerVisionandImageUnderstanding,64(2):300-302,1996.

[Lidke2005]K.A.Lidke,B.Rieger,D.S.Lidke,T.M.Jovin,Theroleofphotonstatisticsinfluorescenceanisotropyimaging,IEEETransactionsonImageProcessing,14:1237-1245,2005

[Liu2017]S.Liu,M.J.Mlodzianoski,Z.Hu,Y.Ren,K.McElmurry,D.M.Suter,andF.Huang.sCMOSnoise-correctionalgorithmformicroscopyimages.NatureMethods,14(8):760-761,2017.

[Ober2004]R.J.Ober,S.Ram,andS.E.Ward.Localizationaccuracyinsinglemoleculemicroscopy.BiophysicalJournal,86:1185-1200,2004.

[Pyatykhm2014]S.PyatykhmandJ.Hesser.Imagesensornoiseparameterestimationbyvariancestabilizationandnormalityassessment.IEEETransactionsonImageProcessing,23(9):3990-3998,2014.

[Smith2010]C.S.Smith,N.Joseph,B.Rieger,andK.A.Lidke.Fast,single-moleculelocalizationthatachievestheoreticallyminimumuncertainty.NatureMethods,7:373-375,2010.

[Strohl2015]F.StröhlandC.F.Kaminski.AjointRichardson-Lucydeconvolutionalgorithmforthereconstructionofmultifocalstructuredilluminationmicroscopydata.MethodsandApplicationsinFluorescence,3:014002,2015.

[vanVliet1998]L.J.vanVliet,D.Sudar,andI.T.Young.CellBiology,volumeIII,chapterDigitalFluorescenceImagingUsingCooledCCDArrayCameras,pages109-120.AcademicPress,NewYork,2ndedition,1998.

Page 6: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

Figure1.Gainestimationbyplottingvarianceovermean.Typicaldetectorcalibrationcurveobtainedfromaseriesofstaticimages.Aseriesof20imagesofadefocussededge(leftinset)andabackgroundseriesof20imagesareprocessedintoavarianceandmeanprojectionimage.Fromtheseamean-varianceintensityplotisobtained(only21datapointsaredisplayedasbluecrossesforbettervisualization).Theexperimentallyfoundmeanbackground(Ozero)andthereadoutnoiseVread,thevarianceatzerointensity,areindicated.Thegaingisobtainedastheslopeofthelinearregression(blueline).Theshadedgreenareacorrespondstotheminimumandmaximumvaluesforsingleimagegainandoffsetresultsobtainedfrom20singlein-focusimageswithourmethod(bottomrightinset,scalebar2µm).

Page 7: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

Figure2:Gainandoffsetestimationforvariousmodesofacquisition.Estimatedgainandoffsetasdeterminedforeachimageandthecomparisontostandardcalibratedvalues.Panelsa)andb)showmitochondriaMuntJacAF555cells.Panelc)displayslabelledactinfilaments(Alexa568)andpaneld)aDAPI-labelledcellnucleusofembryonicmousefibroblasts.(allscalebars2µm)

a)CCDDetector(lowgain)

EstimatedGain:9.78Calib.:9.81EstimatedOffset:103Calib.:100.0

b)emCCDDetector,highgain(100)

EstimatedGain:0.096Calib.:0.097EstimatedOffset:113.7Calib.:106.4

EstimatedGain:0.0046Calib.:0.0045EstimatedOffset:34.08Calib.:59.4

c)ConfocalGAsPPMT,Zeiss800 d)ConfocalHyD,LeicaSP8,countingmode

EstimatedGain:1.07Calib.:0.98EstimatedOffset:-0.072Calib.:0.00087

Page 8: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

Figure3:Performanceofsingleimagegaindeterminationonvariousdetectors.Relativeerrorofthegainestimationfromsingleimagegaindeterminationscomparedwithastandard“groundtruth”calibrationobtainedfrom20smoothand20darkimageseach.Thegainvaluesvariedfrom0.1(lowgainCCD),1.0(confocalHyDcounting)toalmost10(highgainemCCD).Errorbarsindicateonestandarddeviation.SeeSupplementaryFigure5forexampleimagesforallimagingmodes.

Page 9: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

OnlineMethods:Calibratingphotoncountsfromasingleimage

RainerHeintzmann1,2*,PeterK.Relich3,RobertP.J.Nieuwenhuizen4,KeithA.Lidke3,BerndRieger4*

1LeibnizInstituteofPhotonicTechnology,Jena,Germany2InstituteofPhysicalChemistryandAbbeCenterofPhotonics,FriedrichSchillerUniversity,Jena,Germany3DepartmentofPhysicsandAstronomy,UniversityofNewMexico,Albuquerque,NM,USA4QuantitativeImagingGroup,DepartmentofImagingPhysics,DelftUniversityofTechnology,Delft,TheNetherlands

Experimentalsetupsandmethods:Figure1:Calibrationimageswereproducedbyilluminatinganopaqueedgemountedonamicroscopeslide(VWR#48312-003)usingahalogenlamp(OlympusU-LH100L-3).Thesamplewasdefocusedtoproduceasmoothgradientand100imagesofthesamepatternwereacquired.Exposuretimesforeachcompletedatasetrangedbetween15.7msto51.2ms.Foreachdataset,aseriesof100backgroundimageswerecollectedwiththemicroscopecamerashutterclosedatthesameexposuretime.Figure2:Forstandardgaincalibration20imageswereusedinallpanels.AcommerciallyavailabletestslideconsistingoffluorescentlylabeledMuntJacskinfibroblastcells(InvitrogenF36925)wasimagedusinganEMCCDcamera(AndoriXon897)withconventional(panelA)orwithvariousEM(panelB)gainsettings:20,50,100,and200andpre-amplifiergainsettings:1×,2.6×,5.2×.ThemicroscopesetupwasanOlympusIX71withanOlympus150×1.45NAobjective,561nmlaser(CoherentSapphireLP)excitation,575nmdichroicanda600/30nmbandpassemissionfilter.Theresultingbackprojectedpixelsizewas106.7nm.TheexposuretimeforallEMCCDdatasets(panelB)was20ms.WhenthecamerawasoperatedwiththeEMgaindisabledtoactasaconventionalCCDdetector(panelA)theexposuretimewas50ms.PanelCshowsanAlexa-phalloidinstainedcell,imagedusingaZeissLSM800confocalmicroscopeusingaPlanApochromat63×1.4OilobjectiveandGAsPdetector.Thepixelpitchwas82.5nm.ImagedintheAF568channel.PanelDdisplaysaDAPIstainedcellnucleusimagedusinga100x1.4OilHCPlanApoCS2objectiveandthephotoncountingmodeoftheHyDdetectorofaLeicaSP8microscope.Thepixelpitchwas79.6nm.Figure3:Thiscomparisonofvariousdetectorsandimagingmodesusedthefollowingsettings:AllCCDdatawastakenusingvarioussettingsofanAndoriXon897(Andor,Belfast,U.K.)emCCDcamera.For“CCDlowgain”,“CCDmedgain”and“CCDhighgain”,thenon-EMreadoutregisterwasusedandthepre-amplifiergainwassetto1,2and3respectively.Thecalibratedgainresultswere9.8,3.9and1.8respectively.“emCCDlowgain”and“emCCDhighgain”usedtheelectronmultiplyingregisterwithEMgainssetto20and100atpre-amplifiergainof2and3respectively.Calibratedgainresultswere0.88and0.097respectively.“sCMOS”correspondstoaHamamatsuFlash4.0V2(calibratedgain:0.44).“confocalGAsP”usedaZeissconfocalLSM800AiryScanwithaGAsPdetectorin16bitmode(calibratedgain:0.0045).“confocalHyDcounting”referstoaLeicaSP8confocalmicroscopeusingtheHyDdetectorinphotoncountingmode(calibratedgain:0.98).Maximalcountswereabout90ADU.“confocalPMT”usedaZeiss800microscopewitha

Page 10: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

standardPMTdetector(calibratedgain:1.1).Avalueofkt=0.8wasusedinthesingle-imagebasedgainestimationalgorithmandthek-axescrosswasavoidedasdescribed.

Derivationofthegainestimationfromout-of-bandinformationofasingleimageonly:Wemodeltheimageformationas(2) 𝐼 𝑥 = 𝑔 𝐵 𝑥 + 𝑛! 𝑥 + 𝑛! 𝑥 + 𝑂!"#$Withxdenotingthespatialdetectorcoordinates,Btheexpectedphotoncountatthedetector,thephotonnoisenp,thereadoutnoisenrandtheoffsetoftheADconverter𝑂!"#$.Becausenoiseisassumedtohaveameanofzeroandthenoisesourcescanbeassumedtobestatisticallyindependent,theexpectedvalueofI(x)issimplygB+𝑂!"#$andthevarianceofIovertimeisequalto(3) 𝑣𝑎𝑟 𝐼 = 𝑔!𝑣𝑎𝑟 𝑛! + 𝑣𝑎𝑟 𝑛! = 𝑔!𝐵+𝜎!!whereσristhestandarddeviationofthereadoutnoise.OurkeyideaistoextrapolatetheexpectedvarianceofIfromtheaveragepoweratspatialfrequencieskbeyondathresholdfrequencyktabovethecut-offfrequencykcut(out-of-bandenergy)ofasingleimagebecauseinthisregionallspectralpowerisentirelyduetonoise.Thereforetheaveragespectralpowerofthenoisevar(I)atthosefrequenciesisequaltotheaveragespectralpowerofthenoiseatallspatialfrequencies:(4) !

!𝑣𝑎𝑟 𝐼! = !

!𝑔!𝑛!!! + 𝑛!! =

!!

𝑔!! 𝑛!! + 𝑛! ! = !

!𝐼 !! !!!

whereMisthetotalnumberofpixelsandTisthenumberofpixelsintheFouriertransformofIbeingabovethethresholdfrequencykt,thehatdenotestheFouriertransformationandthesummationsoverxandkdenotethesumoverpixelsinrespectivelythespatialandFourierdomain.Inthesecondstepofequation(4)weusedParseval’srelation(conservationofsignalenergy)toconvertthesumoverallpixelsinthespatialdomainintoasumintheFourierdomain.Bycombiningalltheabove,therelationshipbetweenthevarianceandaveragemeasuredintensitycanbeexpressedas(5) !

!𝐼 !! !!! = 𝑔 !

!𝐼+ (𝜎!! − 𝑔𝑂!"#$

!!

)𝑥

oralternatively

(6) !!

𝐼 !! !!! = 𝑔 !!

𝐼− (𝑂!"#$ −!!!

!!!"!!"#$%

)𝑥

Equations(5-7)areequaltoequation(1)asgiveninthemaintext.Clearlythegaingcanbefoundusingequation(6)iftheimageoffset𝑂!"#$andthereadoutnoiseσrareknown:

(7) 𝑔 =! ! !! !!!

! (𝐼𝑥 −𝑂𝑛𝑜−𝑛𝑜𝑖𝑠𝑒)

withthedefinitionof𝑂!"!!"#$% asstatedinequation(6), beingthetheoreticalintensityvalueatwhichzerovariancewouldbeexpected.

However,theoffsetismostoftennotknownwhereasthedetectormanufacturerspecifiesthereadoutnoise(inmostcases).OuralgorithmfirstestimatesOno-noiseexploitingthelinearityofthemeantovariancerelationshipasdetailedbelowtothencomputethegainalsoincasesofunknownimageoffset.

Page 11: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

GainestimationwithanunknownimageoffsetWesubdividetheimageintotiles(e.g.3x3sub-image,thetiles)andplotforalltilestheout-of-bandestimatedmeannoiseenergy!

!𝐼 !! !!! versusthemeasuredmeanintensity

!!

𝐼𝑥 .Thisgives9datapointsonthevarianceversusmeanintensityplotandweestimate𝑂!"!!"#$%byalinearregressiononthedata.Fromthiswethenobtainthegainbycomputingthemeannoisevarianceandmeanintensityfromtheoverallimageasstatedinequation(6).Withthisalgorithmicallydetermined𝑂!"!!"#$%,eitherthedetectoroffset𝑂!"#$orthereadoutnoise𝜎!!canbeobtainediftheotherrespectivevalueisknownapriory.SeeSupplementaryInformationforafurtherdiscussionontheimplementationdetailsandfitting.

Page 12: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

SupplementaryInformation:Calibratingphotoncountsfromasingleimage

RainerHeintzmann1,2,PeterK.Relich3,RobertP.J.Nieuwenhuizen4,KeithA.Lidke3,BerndRieger4

1LeibnizInstituteofPhotonicTechnology,Jena,Germany2InstituteofPhysicalChemistryandAbbeCenterofPhotonics,FriedrichSchillerUniversity,Jena,Germany3DepartmentofPhysicsandAstronomy,UniversityofNewMexico,Albuquerque,NM,USA4QuantitativeImagingGroup,DepartmentofImagingPhysics,DelftUniversityofTechnology,Delft,TheNetherlands

SimulationResultsToobtaininformationonthequalityofthesingle-image-basedgainandoffsetcalibrationprocedureaseriesofsimulationhasbeenperformed.Weusedtwodifferenttypesofimagesboth512×512pixels1)aresolutiontargetand2)apictureofAlbertEinstein(compareFigureS1d)andS2d)),atanoffsetof100ADUs,wherethegroundtruthofthegainisknown.

TheseimageswereconvolvedwithaPSFwithitscutofflimitkcutat2/3oftheNyquistlimit.Avarietyofmaximallyexpectedphotons(10,…,105)andanumberofreadoutnoisecontributions(1,2and10photons)weresimulated.Foreachoftheseconditions,100simulationshavebeenperformed.Foreachindividualsimulatedimagethegainandoffsetwheredeterminedbyouralgorithmusingkt=kcutinthealgorithm,andsupplyingthenominalreadoutnoisetoit.Allsimulatedandexperimentaldataisbasedonthe3×3tileoffsetestimationmethodaspresentedbelow.Theresultswerethencomparedtothegroundtruth(nominalgainandphotoncountobtainedviadetectorcalibrationexperiments)andsummarizedinFigureS1,S2andS3.Herethemidpointofa“relativegainerrorinpercent”entryis

computedby !!!!!"#$!%&!""!!!

!!"#$!%&×100%,where𝑔! istheestimatedgainbyour

algorithminsimulationnumberi.Theerrorbarsrefertoplusandminusthecorrespondingrelativevalueofthestandarddeviation.Thereare4differentrelevantspatialfrequenciesforthesimulations:

• kcut Theopticalcut-offfrequencyoftheOTF.• kt Thethresholdfrequencyforcomputationofspectralpowerdensityof

thenoiseVHF.• kNyquistTherequiredNyquistsamplingfrequencygivenkcut,i.e.kNyquist=2kcut.• ksamp Theactualsamplingfrequency.

Ideallywehaveksamp=kNyquist>=2kcut=2kt.Butinrealitytheserelationsmightdifferslightly.Inpracticetheactualsamplingmightoftendifferfromthestrictlynecessaryone.Ouralgorithmcanonlyvaryktastherestisdetermineduponacquisition.However,asdifferentrelativevaluesofthesefrequenciesinfluenceforemostthecorrectestimationofthespectralpowerdensityofthenoiseVHF,we

Page 13: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

investigatetheperformanceofthealgorithmwithrespecttoseveralcases.Wecreatedaslightlyoversampledtestimagewithkcut=2/3*½kNyquistandwespecifykcutasthefractiontothematchingNyquistsampling,i.e.hereaskcut=2/3.Wespecifyktalsorelativeto½kNquist,i.e.kt=2/3=kcutwillonlyconsiderpurenoisefortheestimationofVHF.LowervaluesofktwillconsidersignalintocomputingVHFwhichisineffectsimilartospatiallyundersamplingtheimage.Observationsfromsimulationsonthegainestimation:

• Thehigherthereadoutnoisetheworsethegainestimate.• Higherphotoncountsgivebetterresultsincaseofhighreadoutnoise.• Thehigherthegain,thehigherthevarianceintheestimationofthegain.

However,therelativegainerrorwasessentiallyindependentofthegain.Asmallpositiveconstantbiasofabout1%wasobserved,whichstayedbelow(resolutiontarget)orwascomparableto(Einstein)thestandarddeviationoftheestimation.

• Readoutnoiseof10at10maximallyexpectedphotonsgaverisetoverylargevariances.However,themeanestimateisstillwithin10-20%error(compareSFig1c)and2c)).

• kt=kcutyieldsthebestresults.Forkcut=2/3thereisplentyofout-of-bandnoisepresentinthepixelatedimageduetotheoversampling.Evenforsmallundersampling10-20%e.g.0.9kt=kcutwestillhaveacceptableresults.

• Gainestimationerrorswithchoosingkcutbelowthecut-offlimit,i.e.kcut=2/3andkt=0.5,remainsacceptablewitherrorsbelow10%exceptfor105expectedphotonsormore,asmoreandmoresignaliswronglyassumedtobenoiseinthecomputationforVHF.Ifwedecreasektfurtherbelowkcutlowerphotoncounts(<103)alreadyshowanincreasederrorasexpected(datanotshown).

Insteadofinvestigatingdirectlytherelativeoffsetestimationerrorasthisvaluecannotbereliablyobtainedindependentlyfromthemeasuredsignal,weinsteadevaluatetheperformanceofthealgorithmtoestimatetheeffectivephotoncount.Fordataprocessingpurposesthephysicaloffsetisoftenirrelevantastheoffset-correcteddataconvertedtoeffectivephotonsisusedforanyfurtheranalysissuchasmaximumlikelihooddeconvolution.Theterm“effectivephotons”referstoasignalwiththenoisevariancebeingequaltothemeanvalue.ThereforeweinvestigatetheperformanceforeffectivephotoncountN

𝑁 =𝑆 − 𝑂!"!!"#$%

𝑔

whereSistheimagevalueinADU,Ono-noiseistheADUoffset(ADUvalueatzeroeffectivephotons)andgthegain.Bypropagationoferrorwefindthevarianceinthephotoncountestimation

∆𝑁 ! =𝜕𝑁𝜕𝑔

!

(∆𝑔)! +𝜕𝑁𝜕𝑂

!

(∆𝑂!"!!"#$%)! =

=𝑁𝑔

!

(∆𝑔)! +1𝑔! (∆𝑂!"!!!"#$%)

!

Page 14: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

HereΔgandΔOno-noisearethestandarddeviationoftheestimateofthegainandoffsetrespectively,whicharedeterminedfromthesimulationsover100runs.Asthesimulatedphotoncountspans5ordersofmagnitudeweplottherelativeerrorΔN/N⋅100%inFigureS3.Thevariationinthegainestimatedominatestheerrorinthephotoncountinmostcases.Asseenfromtheseresults(errorbarsinFigureS1andS2),themeanrelativeerrorinthegainestimationisindependentoftheactualgain,confirmingthatthealgorithmisinvarianttomultiplicativefactors.Onlyinthepresenceofsubstantialreadoutnoiseaninfluenceofamultiplicativefactorisseen.Itisfurtherobservedthatthebiasstaysbelow1%forallcasesbutwhensimulatingwithamaximumnumberof10expectedphotons. Theonlycase,whichleadstoanunacceptablehighvarianceintheestimation,isfor10photonsreadoutnoiseatamaximalsignallevelof10photons.AnexampleimageforthiscaseisshowninFigureS4.Interestinglyeveninthiscasewecanobtainanacceptableresult(standarddeviations~10-20%forthelowergainvalues),ifthethresholdfrequencyktsuppliedtothealgorithmisreducedfrom2/3to0.2.Thereasonisthatatsuchnoiselevelsthesignaliscompletelylostinthenoisealreadyatfrequenciesfarbelowtheactualcut-offlimit.Areducedthresholdlimitktthenhelpstoestimatethenoisemorerobustly.However,atgoodSNR(highphotoncounts),suchaloweredktleadstounwantedbiasesassignalenergyisfalselyaccountedforasnoiseenergy.

Page 15: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS1:Performanceofthesingleimagegainestimationonasimulatedresolutiontargetasshownind).Panelsa,b,c)showtherelativegainestimationerrorforrespectivelydifferentlevelsofreadoutnoisewithstandarddeviationof1,2and10photonsasafunctionofmaximalphotoncount(10,…105)forthreegainlevels.Markersindicatemeanerrorover100runsanderrorbarsonestandarddeviationofthe100runs.Inpanelc)thestandarddeviationoftheresultsfor10expectedphotonsinthemaximumwhichrangedupto600%isnotshown.For100photonsonlyforgain10itisoutsidethedisplayrange.Paneld)showsthesimulatedresolutiontarget(512×512pixels).Parameterskt=kcut=2/3.

d)

Page 16: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS2PerformanceofthesingleimagegainestimationonEinstein(512×512pixels)asshownind).Panelsa,b,c)showtherelativegainestimationerrorfordifferentlevelsofreadoutnoisewithstandarddeviationofrespectively1,2and10photonsasafunctionofmaximalphotoncount(10,…105)forthreegainlevels.Markersindicatemeanerrorover100runsfordifferentsimulatedgainvalues.Parameterskt=kcut=2/3.

d)

Page 17: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS3:Estimatedrelativeerrorinthephotoncountfromthesingle-imageestimationusingtheEinsteinobjectassimulationinput.Panelsa,b,c)showtherelativephotoncountestimationerrorfordifferentlevelsofreadoutnoisewithrespectivestandarddeviationsof1,2and10photonsasafunctionofmaximalphotoncount(10,…105)for7gainlevels.Inpanelc)weomittedtheresultsfor10expectedphotonswhereestimationbreaksdownanderrorsabove100%werefound.

FigureS4:WorstSNRinsimulationsforreadoutnoise10photonsand10photonsexpectedmaximumphotoncount.

Page 18: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

a)CCDlowgain b)CCDmediumgain

c)CCDhighgain d)emCCDlowgain

e)emCCDhighgain

f)sCMOS

Page 19: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS5:a)-i)Exampleimagesusedforthesingleimagephotonquantificationonexperimentaldataofvariousinstrumentsanddetectortypes.RespectiveresultsoftheestimationareshowninFigure3.

g)confocalGAsP h)confocalHyDcounting

i)confocalPMT

Page 20: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

TraditionalGainestimationfromaseriesofexposuresHerewedescribethestandardgaincalibrationprocedureaccordingto[vanVliet1998,Lidke2005]. Twoseriesofimages,eachtypicallyabout20images,areacquiredadarkserieswithnolightexposureandaserieswithasmoothintensitydistribution(gradientsequenceasexemplifiedinthemaintext,Figure1,leftinset).Theintensitydistributionshouldcapturethefulllineardynamicrangeofthedetectorwithoutsaturation.Fortheupperlimitweadviseabouthalfthemaximumofthelinearworkingrangeofthedevice,thefullwellcapacityofthecameraorthemaximumoftheADUconverterrange.Suchadistributioncanbeobtainedbyfindingabrightedgeorisolatedstructureanddefocussingit.Itisimportanttoensurethatbothseriesareacquiredunderidenticalsettings,temperaturesandexposuretimes. Theseseriesarethenprocessedbyfirstdeterminingtheoffset(Ozero)asthemeanvalueofalldarkframes(seeFig.1).Suchanestimateisusuallyprecisesinceimagescontainmanypixelsandthisisaveragedovermanyframes.Ofcoursesuchabackgroundseriescanalsoproveusefultoestimateoffset-drifteffectsbyplottingthemeanofeachframeasatimeseries,orresidualnoisesourcesbyaveragingthemagnitudeofallindividual2DFouriertransforms,whereevenweakperiodicfluctuationsoftenshowupasclearlyvisiblepeaks.Thenfromthesequenceofsmoothimages,themeanandthevariancesarecalculated.Tothisendtheimageisbinnedintoregionsofintensitybinsdeterminedfromtheaverageimage.Weuseastandardof100intensitybinstoobtainarobustestimateandaccountfordrifteffectsthatcouldinfluencepurepixelbasedestimation.Thegaingisobtainedfromtheslopeofthefitof𝑣𝑎𝑟 𝑆 = g 𝑆 − 𝑂!"!!"#$% totheplotofthemeanvarianceovermeanintensity(seeFig.1).ThesignaloutputSinADUcomesfromthedetectorinresponsetoaninputofNeffectivephotonswhichareobtainedas𝑁 = 𝑆 − 𝑂!"!!"#$% /g.NotethatforPoissonstatisticsitholdsthatvar(N)=N.Thefitisareweightedleastsquaremethodwiththesquareofthevarianceandthenumberofaveragedvariancevaluesineachbinpredictingthevarianceofthevariance.Fromtheslopeofsuchaplot,thegaincanbeestimatedasgiveninFigure1.Withthisknowledgethemeanofthevarianceprojectionofthedarkseriescanbeconvertedtothereadoutnoiseofthedeviceinelectrons.

DescriptionofthesingleimagegainestimationalgorithmThemeanspectralenergyofthenoise(”out-of-bandenergy”)iscomputedasdepictedinFigureS6by!

!𝐼 !! !!! ,whereT,isthenumberofFourier-spacepixels

beyondthealgorithmiccut-offfrequency 𝑘!comparedtotheareaofthefullimage.Thethresholdfrequencyktistypicallyequalorlargerthantheopticalcut-offfrequencykcut.ForadiscussiononpracticalvaluesofktseediscussionontheSimulationResults.TheFouriertransformationiscomputedusingthediscreteFouriertransformation(DFT)asoutlinedintheimplementationdetailsbelow.

Page 21: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS6:Spectralenergyintheout-of-bandregionintheFourierdomainoftheimage.Tisthenumberofpixelsbeyondthealgorithmicthresholdfrequency 𝑘!.

GainestimationandimageoffsetTobeabletorelatemeasuredvaluestonoiseprediction,weneedtodeterminethevarianceoffset(Vo)atzeroreadoutvalue.AsdetailedintheOnlineMethodswetiletheinputimageintoanumberofsub-imagesortiles.Itisnotoftheessencehowmanyorhowlargethetilesarefortheestimate.Wechose3×3tiles,whichworkedwellinsimulationsandwasalsousedforallcomputationsofexperimentaldata.TheworkflowisdepictedinFigureS7.Increasingthenumberoftilesgivesmoredatapointsonthevarianceversussumintensityplot,buteachdatapointhasahigheruncertaintyasitiscomputedfromalowernumberofpixels.Inaddition,thedifferenttilesneedtocoverarangeofmeanintensitiestogiveagoodscatterontheplotandreducingthetilesizetoomuch,doesnotfosterthisrequirement.OncethevarianceoffsetVoisfoundbyreweightedlinearregression(asdescribedbelow)thegainisestimatedasfollows.

FigureS7:Workflowtoenablegainestimationfromasingleimageinthecaseofunknownimageoffset.Theinputimageisdividedinto3×3sub-images.Foreachsub-imagetheFouriertransformationiscomputedandthemeanout-of-bandenergyofthenoiseismeasured.Thesevaluesareplottedagainstthemeanintensitiesinthetiles(includingtheunknownoffset).FromareweightedlinearregressionwefindthevarianceoffsetVo,whichisfinallyusedtocomputethegain.Weplotthissumagainstthevarianceduetonoiseineachtilecorrectedforthefractionofthearea.ThevarianceoffsetatzeroreadoutvalueVoisthenusedtofindtheoverallgain.Tothisendwecomputeagain 𝐼 !! !!! and 𝐼! butnowonthe

Page 22: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

wholeinputimageandfinallyobtainthegainas

𝑔 =𝑀 𝐼 2𝑘 >𝑘𝑡 −𝑉𝑜

𝑇 !!.

Torelatemeasuredvaluesnotonlytoanoisepredictionbuttoactualphoton

counts,weneedtosupplyeitherthereadoutnoise(ine-RMS)𝜎!ortheimageoffset(𝑂!"#$inADU)toouralgorithm.Weobtainthevarianceofthereadoutnoiseas𝑉!"#$ = 𝜎!!.Ifthereadoutnoiseissupplied,theimageoffset𝑂!"#$isobtainedafterthegaingisfound,andVofromtheregressionas𝑂!"#$ =

!!"#$!

− !!!.

ToconverttheimagefromADUtoeffectivephotoncountstheoffset𝑂!"#$isfirstsubtractedbeforewedividebythegain.Notethatforhigherphotoncounts,thereadoutnoiseestimatedoesnotneedtobeprecise,stillyieldinggoodestimatesofthegainandoffset.Forimageswithverylowphotoncountswithunknownreadoutnoise,itmaybeadvantageoustoratherestimatetheoffsetfromadarkareaofthatimage.

Weightedlinearregressiononvariancevs.sumintensityTheobtainedmean-variancedataisfittedbyaPoissonianreweightedleastsquareapproachtofindthevarianceoffsetVoasgivinginFigureS7.Theerrorsintheyvaluesaregivenbythesquaresofthevariances,dividedbythenumberofpixelsinthetile.ThevariancesitselfarejustgivenbythemeanyvaluesforPoissonstatistics.Thefitweightsarethentheinverseofthiserrorandtheslopeandoffset(asvector𝛽)arefoundfrom𝛽 = (𝑋!𝑊!!𝑋)!!𝑋!𝑊!!𝑦.WhereWisthecovariancematrixoftheweights(herethemeasurementsareindependentandthematrixisdiagonal)andXisthematrixofxvaluesgivenbysumoftileintensities.

ImplementationdetailsThediscreteFouriertransformationunavoidablyimpliesthattheinputsignaliscyclicwhichgivesrisetoartifacts(falsespatialfrequencies)intheFourierdomain.Toavoidthiswell-knownproblemtypicallyaTuckey,HanningwindoworsimilarisappliedtotheimagebeforeFouriertransformation.However,applyinganysuchwindowalsodisturbsthenoisepowerspectrumandaffectsthesingleimagegainestimation.Thereforewehavechosennottoapplyanywindowbuttousemirroringoftheinputimageandtilingitintoa2×2arraybeforeFouriertransformationasdisplayedinFigureS8.Thisoperationensuresmatchingboundariesandavoidszero-orderdiscontinuitiesofthediscreteFouriertransformationbutleavesthenoisedistributionunperturbed.Somedetectors,suchassCMOScameras,canexhibitfixedpatternnoiseand/orpixeldependentgainextendingintothehigh-frequencyregion[Huang2013].Diffusionandblinkingduring(confocal)scannedimageacquisitionorafterpulsingcanalsoleadstosimilareffects,asforexampleexploitedinRICS[Brown2008].Thesecanleadtopotentialproblemsofourmethod.ThereforeweadditionallychosetoremovethespectralcrossfromtheFourierdomainbeforeestimationthespectralenergyofthenoise.Thatis,wenullouta3pixelwidestrokeontheFourieraxesnexttonullingallspectralcontent|k|<ktasshowninFigureS6andaccountforthisinthefractionf.

Page 23: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS8:SymmetrizinganinputimagebymirroringtoavoidboundarydiscontinuitieswhenapplyingthediscreteFouriertransformation.Note:IftheinputimagedoesnothaveanequalnumberofpixelsalongbothdimensionsandasquarepixelsizethediscreteFouriertransformwillresultinnon-isotropicpixelsinFourierdomainandthephysicalcut-offfrequencywillnotbeacircleintheFouriertransformedimage,butanellipse.Softwarecanbedownloadedfromourwebsitehttp://www.diplib.org/add-onsprovideMatlab(TheMathworks,MA)codeandanImageJ(NIH,VA)plugin.

Comparisonwithpriorartonsingle-imagebasedalgorithmsEstimationofthecombinedGaussianand/orPoissoniannoiseparametersfromsingleimageshasbeenstudiedinthesignalprocessingcommunity[Immerkaer1996,Foi2008,Pyatykh2014].Theestimationstrategiesintheliteraturerelyonfindingthemean-varianceintensitycurvesfromeitherhomogeneousimageparts/blocksorafterhigh-passfilteringandattemptingtoremovesignalcontributionfromtheimage.ForanextensivereviewseeColometal.[Colom2014]andPyatykhetal.[Pyatykh2014].Inotherwordsassumptionsaremadeonthetypicalpropertiesofobjectsintheimage.Weapproachedtheproblemfromtheacquisitionside.Instarkcontrasttothesemethodsweonlyassumethattheimageisacquiredbyaband-limitingprocess(suchasgivenbyanyopticalimagingsystem)andthatitwasatleastroughlysampledcorrectly.Thatmeansourapproachisindependentoftheimagecontentandstructure.ForestimationofthePoissoncomponentofthenoisethenormalapproximationofthePoissondistributionhasbeenappliedinthepriorart(ortheAnscombetransformwasused).Inourapplication,lightmicroscopyandinparticularfluorescenceimaging,thedetectionprocessislargelyshot-noiselimitedduetothelowsignalintensities,butalsotheverylowreadoutnoiseofcurrent(em)CCDandsCMOSdetectors.GainestimationontheexperimentaldatafromFiguresS5withtheavailableimplementationsbyPyatykhetal.[Pyatykh2014]didtypicallyresultinerrorslarger

Page 24: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

than100%(andamuchlargerspread)whencomparedtothegoldstandardcalibrationandtheirimplementationgotstuckinendlessloopsforsomeoftheexperimentalandsimulateddatasets(FigureS9).Thealgorithmhas15freeparameterswhereweusedtheonessetinthesoftwareprovidedbytheauthors.Potentiallyfine-tuningtheparameterscouldsolvetheproblemofthealgorithmgettingstuckbutwedidnotpursuethiseffortasourfine-tuning15parametersseemedfruitlesscomparedtoourveryeasyroutine.FortheCCDmed.gainandemCCDhighgainmodethecodedidnotreturnaresultandweskipthesedatapoints.TheperformanceoftheimplementationofAzzari2014etal.[Azzari2014]wasabitbetterwithrelativeerrorsof10-600%andsmallerspread.However,comparedtoourresultswitharelativegainerrorofonaverage1.4%(0.8%median)(Figure3)theAzzari2014methodisstillabouttwoordersofmagnitudeworsethanourapproachonexperimentaldatawithameanrelativeerrorof181%(66%median),asseeninFigureS9.ForthebestestimationsoftheAzzarimethod,namelytheconfocalGAsPcaseandtheconfocalHyDcountingcase,therelativeerrorvaluesare9.6+-1.6%and9.6+-5.1%respectively,whicharealsostillworsethanourestimationsof5.3+-0.7%and8.4+-1.2%(compareFigure3).

FigureS9:PerformanceofalgorithmbyPytatykhetal.andAzzarietal.forgaindeterminationonvariousdetectors.Relativeerrorofthegainestimationfromsingleimagegaindeterminationscomparedwithastandard“groundtruth”calibrationobtainedfrom20smoothand20darkimageseach.Thegainvaluesvariedfrom0.1(lowgainCCD),1.0(confocalHyDcounting)toalmost10(highgainemCCD).Errorbarsindicateonestandarddeviation.SeeFigureS5forexampleimagesforallimagingmodes.Estimationonsimulateddatawasforbothinvestigatedalgorithmsmuchworsethanouralgorithm.OntheimageoftheresolutiontargetweshowinFigureS10therelativegainestimationerrorsover50noiserealizations.ItisevidentthatespeciallythealgorithmbyAzzarietal.resultsinverypoorestimateswith50-100%relative

Page 25: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

errorswhereasthealgorithmofPyatythetal.isintherangeof0-50%.Pleasenotethattheresultsaregaindependent.Thestandarddeviationisomitted,asitislargerthantherelativeerrors.Pleasealsonotethatthephotoncountisrestrictedto104photonsasforlargercountsthecodegotstucklikefortheexperimentaldatainanendlessloop.

FigureS10:PerformanceofalgorithmbyPytatykhetal.andAzzarietal.forgaindeterminationonsimulationsforthe“resolutiontarget”image.Meanrelativeerrorofthegainestimationover50noiserealizationsfordifferentamountsofaddedreadoutnoise.SimulationsettingsareidenticaltoFiguresS1andS2.

Page 26: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

FigureS11:PerformanceofalgorithmbyPytatykhetal.andAzzarietal.forgaindeterminationonsimulationsforthe“Einstein”image.Meanrelativeerrorofthegainestimationover50noiserealizationsfordifferentamountsofaddedreadoutnoise.SimulationsettingsareidenticaltoFiguresS1andS2.Ourcurrentalgorithmassumesthattheimagedoesnotcontainsaturatedpixels,i.e.novaluesthatareclippedtothemaximumbitdepthoftheA/Dconverter.In(fluorescent)microscopythisissueisirrelevantaslightlevelsareverylowandstudentsaretaughtinentry-levelcoursesalreadyasbestpractisetoneversaturateimagesbyincreasinganyvariablegain.Priorartsuggesttobeabletocopewithsuchundesirableacquisitionproblembutfailedinourhandsalreadyforproperlyacquireddata.

Wearealsolargelyindependentoftheimagecontent/structureaslongastherearedifferentimageintensitiespresentindifferentpartsoftheimageotherwisethetilingapproachmightfail.Thatisalsoincontrasttoearliermethodsthathavedifficultiestodealwithstrongtexturedcontent.

Priorartalsosuggestbeingabletocopewithundersamplingissues.OurexperimentalandsimulateddataareNyquistsampledorbetter,yettheaforementionedpublishedalgorithmsshowpoorperformance.CommercialsoftwareforintegratedsetupscommonlypointsuserstotherequiredNyquistsamplingrateofλ/(4NA).Thisallowstheusertomatchite.g.byadjustingthepixelsizeinaconfocalsystem.Forwidefieldacquisitionsanobjectivewithahighermagnificationoranadditionalopticalrelaysystemcanfixpotentialundersamplingforagivencamerapixelsize.Asindicatedaboveourmethodsalsotoleratessomedegreeofundersampling(10-20%)especiallyforimagesoflowSNRasthemicroscopeOTFfallsofftozerostronglytowardstheopticalcut-offfrequencyand

Page 27: Calibrating photon counts from a single image · Calibrating photon counts from a single image Rainer Heintzmann1,2*, Peter K. Relich3, Robert P.J. Nieuwenhuizen4, Keith A. Lidke3

onlyasmallfractionofthesignalenergyisthenwronglyassumedasnoiseenergy.Furthermorehaveslightlyundersampledimagesstillanout-of-bandregioninthecornersoftheFourier-transformation,whichcanbeusedforouralgorithm(seeFigureS6).References:[Brown2008]C.M.Brown,R.B.Dalal,B.Hebert,M.A.Digman,A.R.Horwitz,andE.Gratton,Rasterimagecorrelationspectroscopy(RICS)formeasuringfastproteindynamicsandconcentrationswithacommerciallaserscanningconfocalmicroscope.JournalofMicroscopy,229:78-91,2008.[Huang2013]F.Huang,T.M.P.Hartwich,F.E.Rivera-Molina,Y.Lin,C.Whitney,J.J.Long,P.D.Uchil,J.R.Myers,M.A.Baird,W.Mothes,M.W.Davidson,D.Toomre,andJ.Bewersdorf.Video-ratenanoscopyusingsCMOScamera-specificsingle-moleculelocalizationalgorithms.NatureMethods,10(7):653-658,2013.