Package: dotscanner
Dot ScannerSoftware designed for analysis of microscope imaging dataDot Scanner is designed to simplify analysis of microscope imaging data. The program runs entirely within a window-based graphical user interface, so as to not require any programming knowledge from the user in order to complete their image analysis (see the images below for examples). This software isespeciallyuseful for noisy image data, where manual "by-eye" analysis is unreliable.Getting StartedDependenciesPython 3must be installed before Dot Scanner can be installed.Python 2 is not supported.To make sure you have Python 3 installed, open a terminal window and run the following command:python3 --version(Note: Running this command might require installing command line developer tools. This is normal, and it is ok to install this.)This should give version number (i.e., Python 3.x.x). If a "command not found" message is shown instead, then Python 3 is not properly installed.InstallationTo install Dot Scanner, open a terminal window and run the following command:pip3 install dotscanner(Note that thepipcommand may be required instead ofpip3for some Python 3 installations.)To update Dot Scanner to the latest version, run the following command(again, usingpipinstead ofpip3for some Python 3 installations):pip3 install dotscanner --upgradeDot Scanner can also be uninstalled at any time using the following command(again, usingpipinstead ofpip3for some Python 3 installations):pip3 uninstall dotscannerRunning the SoftwareTo launch the main graphical user interface (GUI), run the following command:dotscannerNote:if you are getting an error when trying to run the program, run the following command to check your Python version:python3 --versionPython 2 isnotsupported, and Python 3mustbe installed to run Dot Scanner.Some demo images are included in thedemo images folderof this GitHub project, which can be downloaded and used as explained below to familiarize oneself with how the software works.The Configurations WindowThe first window displayed in the GUI is the Configurations Window:If theFileorFolderbuttons are clicked, another window opens, allowing the user to select a file or folder for analysis (the images in thedemo images foldercan be downloaded to try this out for oneself):If repeated analysis is being performed at the same target filepath, the user can avoid continuously repeating this step by setting a default filepath. This is done by clicking the "Edit defaults" button. An entire configurations file is editable for other defaults as well. Any of the variables in this configurations file can be modified to change the default behavior of the software.The software will run as expected on any folder where the most common file extension within the folder belongs to the images wanting to be analyzed. By default, the entire folder will be scanned, and the most common file type found within the folder will be set as the file type to analyze. If the user is experiencing issues with the wrong file type being selected, it is recommended that they reorganize their data into folders containing only their images to be analyzed.If a folder containing several images is selected, the user has the option to change the default program fromDensitytoLifetime.(Note that trying to run a lifetime program on a single image will not be allowed by the software.)This selection is made through theProgramdropdown menu:IfLifetimeis selected, some additional options will appear:Descriptions of Configuration OptionsSave figuresSelecting this option will output graphical plots to afiguresfolder that will be created within the folder containing the data being analyzed. These plots serve to allow the user to quickly verify their selections made during analysis.Blob sizeThis option sets the radius (or, more accurately, roughly the half width of a square) of exclusion around "blobs" (in pixels). Blobs are regions of the image that are saturated and overexposed. For example, if the blob size is set to 5, then a square region extending 5 pixels in each direction (left, right, up, and down) will be defined from each overexposed pixel (meaning the square will span 11 pixels on each side, including the central pixel), and all of the pixels within those regions will be ignored during analysis. This ensures that the “dots” (the dimmer particles of interest in the image) are not too close to any of these regions, and thus the outer edges of blobs are not confused as dots.Dot sizeSimilar to the blob size option, this sets the size of a "dot" in the dataset. Because dots should not overlap, the larger the dot size, the fewer dots will be detected, as dimmer pixels within a brighter dot's region will not be recognized as dots, and will therefore be removed.ThresholdsThere are three thresholds that can be set to adjust the detection sensitivity for "dots" and "blobs" in a given image. The three editable text boxes correspond to the following variables (displayed from left to right in the Configurations Window):LOWER_DOT_THRESH_SCALE: Scaling for the lower threshold defining the brightness of the dots. The default is 1.5, which corresponds to 1.5 standard deviations above the mean of the data. Lower this value to increase the number of faint dots detected, or raise it to reduce the number.UPPER_DOT_THRESH_SCALE: Scaling for the upper threshold defining the brightness of the dots. The default is 5, which corresponds to 5 standard deviations above the mean. Lower this value to reduce the number of bright dots detected, or raise it to increase the number.LOWER_BLOB_THRESH_SCALE: Scaling for the lower threshold defining the brightness of the blobs. The default is 2, which corresponds to 2 times the value ofUPPER_DOT_THRESH_SCALE. Lower this value to increase the number of blobs detected, or raise it to reduce the number.Edit defaultsThis opens a new window that allows the user to edit the default filepath or edit/reset the entire configuration file directly.Use previous settingsThis opens a new window that allows the user to browse for a previous .txt analysis file to use to repeat analysis. Information on which settings are reused during re-analysis is included in the header of each analysis file. There are two main scenarios for using this feature:Re-analyzing the same image or set of images.This is useful if the user wants to tweak one or two parameters of an analysis without running through the entire folder of images one by one again.Analyzing a new image or set of images with the same analysis settings as a previous analysis.This is useful if the user has already run analysis on a set of green images and wants to run the exact same analysis on their red counterparts, for example.ClickingNext, or pressing thereturnkey on the keyboard, will save the user’s selections and open the Threshold Adjustment Window.Descriptions of Configuration Options for the Lifetime ProgramStart imageThis option sets the first image to be considered in a lifetime calculation. The default is the first image in the folder (as the imagesmust be numbered sequentially).Skips allowedThis sets the number of consecutive images that are allowed to be skipped in a lifetime calculation. This can be useful for dimmer dots where an image or two in a series are relatively out of focus, resulting in an unwanted non-detection for those frames. By increasing the number of skips allowed, these particles will be retained as long as they are back in focus and bright enough for detection in subsequent frames.Remove edge framesThis dictates whether edge frames should be removed from a lifetime calculation. If a particle is detected in the first frame of an image, for example, it cannot be determined whether the particle existed before the first image was taken, so it might not make sense to include this in a lifetime calculation (and the same may also be true for particles in the last frame). If the number of skips allowed in the lifetime calculation is greater than zero, this will increase how many edge frames are removed from analysis.Note: If the user is working with particularly noisy datasets where noise tends to be incorrectly marked as short-lived particles, theLIFETIME_THRESHOLDvalue in the configurations file can be adjusted to mark them as potentially unreliable in the output file.The Threshold Adjustment WindowClicking theNextbutton, or pressing thereturnkey on the keyboard, from the Configurations Window saves the configuration settings selected by the user and advances to the Threshold Adjustment Window. This window shows the image data with the dots and blobs identified, and features several button groups on the left sidebar:From top to bottom, these button groups perform the following actions:ViewThese buttons allow four different viewing options: zooming in on the top left, top right, bottom left, bottom right, or zooming back out to show the full image. The user can also press thespacebaron the keyboard to cycle through these different views.ContrastThese buttons adjust the contrast of the image.DotsThese buttons adjust the sensitivity for detecting “dots” in the image (the fainter, smaller dots, as opposed to the much brighter and larger “blobs”). The user can also press theupanddownarrow keys on the keyboard to make these adjustments.BlobsThese buttons adjust the sensitivity for detecting “blobs” in the image. The user can also press therightandleftarrow keys on the keyboard to make these adjustments.Note: since increasing the blob sensitivity changes the threshold between blobs and dots, this results in a different number of dots being detected as well.EditThis button changes the left button bar view to display some manual threshold and size adjustment options:(Once the thresholds or sizes are changed by entering new numbers into the text boxes, clicking theDonebutton, or pressing thereturnkey on the keyboard, saves the settings and returns the left button bar to the original button configuration.)ResetThis button resets the adjusted thresholds back to the default values.SkipThis button skips the current image (for example, if the user decides the data quality is not sufficient for measurement). Theescapekey on the keyboard can also be pressed to perform a skip.The Region Selector WindowClicking theDonebutton, or pressing thereturnkey on the keyboard, from the main Threshold Adjustment Window saves the threshold settings selected by the user and advances to the Region Selector Window:This window allows the user to click different locations on the image to set the vertices of a polygon within which the measurements will be made. At any point, the polygon can be reset by clicking theResetbutton, or by pressing thebackspacekey on the keyboard. It is important to note that after at least three vertices have been placed, the dotted line shows how the program will enclose the polygon once theDonebutton, or thereturnkey on the keyboard, is pressed.(In other words, it is not necessary to re-click the first vertex created to close the polygon.)Information about the image processing will be displayed in the terminal, including progress bars to estimate the time to completion of longer processes, like lifetime calculations and the saving of multiple figures.Note: the extraneous+[CATransaction synchronize]output in the terminal window is aknown bugin macOS that will not affect your data.AuthorsHolly Allen (holly.allen@colorado.edu)Brian DavisRelease History1.5.8Bug fixes1.5.0Added ability to remove unreliable lifetime data from noisy datasets1.4.0Added option to re-analyze data on different images using previous analysis settings1.3.0Added option to re-analyze data on the same image without redrawing regionsAdded particle displacement tracking during lifetime measurementAdded histogram output for lifetimes measurements1.2.0Added options for editing the configuration fileAdded startup processes to check the configuration file for errors1.1.0Migrated the remaining portions of the app from a terminal interface to a GUI1.0.0Initial ReleaseLicenseThis project is licensed under the MIT License. See theLICENSEfile for details.DevelopmentTo contribute, download or clone the project. From the top level of the project's folder structure, one can use the following command to run a local version of the software (e.g., for UI testing):python -m dotscanner(Note that thepython3command may be required instead ofpythonfor some Python installations.)TestingUnit tests for this software were written for use withPython's built-in unittest framework, and are stored in thetestsfolder. To run tests, download the project, navigate to the top level of the project's folder structure and run the following command:python -m unittest(Note that thepython3command may be required instead ofpythonfor some Python installations.)Bug Reports and Feature RequestsTo report a bug, visit theissues page. New feature requests are also welcome!CitationsWhen using this program on data used in published works, please cite:Allen, H., Davis, B., Patel, J., & Gu, Y. 2024(in prep.)