Giter Club home page Giter Club logo

napari-spot-detection's Introduction

napari-spot-detection

License PyPI Python Version tests codecov napari hub

Interactive parameters selection and visualization of intermediate results for spot detection.


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Installation

This package relies on spots3d, that details how to install the QI2lab fork of GPUfit, as well as CUDA dependencies. Once spots3d is installed, you can run:

pip install git+https://github.com/QI2lab/napari-spot-detection.git

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the GNU GPL v3.0 license, "napari-spot-detection" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

napari-spot-detection's People

Contributors

alexcoul avatar sjshep avatar dpshepherd avatar ptbrown1729 avatar

Stargazers

FermiQ avatar Benjamin Pavie avatar Robert Haase avatar

napari-spot-detection's Issues

scale can't be set via GUI

In script the image scale is set programmatically, and the plugin uses the scale of the existing layer, set in the script, to display correctly new data. After a drag and drop of an image there is no scale, so data is not displayed correctly.
TODO: add a button to set the scale

add hot pixel correction

TODO:
Add a widget that asks the user for the location of the dark field image and then runs the function.

def replace_hot_pixels(darkfield_image: Union[NDArray,ArrayLike],
                       data: Union[NDArray,ArrayLike]) -> Union[NDArray,ArrayLike]:
    """
    Replace hot pixels with mean values surrounding it

    Parameters
    ----------
    darkfield_image: Union[NDArray,ArrayLike]
        darkfield image for FISH channels
    data: Union[NDArray,ArrayLike]
        ND data [broadcast_dim,z,y,x]


    Returns
    -------
    corrected_data: Union[NDArray,ArrayLike]
        corrected data
    """

spot filtering not working

After localizing, when I hit "filter spots", there is the following error in the GUI. Looks like the function signature needs to be updated for the new filtered parameters.

starting filter spots
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File ~/Projects/napari-spot-detection_private/src/napari_spot_detection/_widget.py:1200, in SpotDetection._filter_spots(self=<napari_spot_detection._widget.SpotDetection object>)
   1198 if self._verbose > 0:
   1199     print("starting filter spots")
-> 1200 self._spots3d.run_filter_spots(return_values=True)
        self._spots3d = <opm_merfish_analysis.SPOTS3D.SPOTS3D object at 0x7f5f89b6cdc0>
        self = <napari_spot_detection._widget.SpotDetection object at 0x7f6036392440>
   1201 if self._verbose > 0:
   1202     print("finished filter spots")

File ~/miniconda3/envs/fish/lib/python3.10/site-packages/opm_merfish_analysis/SPOTS3D.py:606, in SPOTS3D.run_filter_spots(self=<opm_merfish_analysis.SPOTS3D.SPOTS3D object>, return_values=True)
    596         self._to_keep, self._conditions, self._condition_names, \
    597         self._filter_values, self._filter_names =\
    598             _imageprocessing.filter_localizations(self._fit_params,
   (...)
    601                                                   self._spot_filter_params,
    602                                                   return_values)
    603     else:
    604         self._to_keep, self._conditions, self._condition_names, self._filter_settings, \
    605         self._filter_values, self._filter_names =\
--> 606             localize.filter_localizations(self._fit_params,
        self = <opm_merfish_analysis.SPOTS3D.SPOTS3D object at 0x7f5f89b6cdc0>
        self._fit_params = <class 'numpy.ndarray'> (2731, 7) float32
        localize = <module 'localize_psf.localize' from '/home/qi2lab/miniconda3/envs/fish/lib/python3.10/site-packages/localize_psf/localize.py'>
        self._init_params = <class 'numpy.ndarray'> (2731, 7) float64
        self._coords = (<class 'numpy.ndarray'> (33, 1, 1) float64, <class 'numpy.ndarray'> (1, 1161, 1) float64, <class 'numpy.ndarray'> (1, 1, 1161) float64)
        self._spot_filter_params = {'sigma_min_z_factor': 0.2, 'sigma_min_xy_factor': 0.25, 'sigma_max_z_factor': 3.0, 'sigma_max_xy_factor': 8.0, 'fit_dist_max_err_z_factor': 5.0, 'fit_dist_max_err_xy_factor': 7.0, 'min_spot_sep_z_factor': 2.0, 'min_spot_sep_xy_factor': 1.0, 'amp_min': 2.0, 'dist_boundary_z_factor': 0.05, 'dist_boundary_xy_factor': 0.05, 'min_sigma_ratio': 1.25, 'max_sigma_ratio': 3.0, 'sigma_min_xy': 0.027296296296296294, 'sigma_min_z': 0.08025850200901927, 'sigma_max_xy': 0.8734814814814814, 'sigma_max_z': 1.2038775301352889, 'sigma_bounds': ((0.08025850200901927, 0.027296296296296294), (1.2038775301352889, 0.8734814814814814)), 'fit_dist_max_err': (2.0064625502254816, 0.7642962962962963), 'min_spot_sep': (0.8025850200901926, 0.10918518518518518), 'dist_boundary_min': (0.00435, 0.00435), 'sigma_ratios_bounds': (1.25, 6)}
        self._spot_filter_params['fit_dist_max_err'] = (2.0064625502254816, 0.7642962962962963)
        self._spot_filter_params['min_spot_sep'] = (0.8025850200901926, 0.10918518518518518)
        self._spot_filter_params['sigma_bounds'] = ((0.08025850200901927, 0.027296296296296294), (1.2038775301352889, 0.8734814814814814))
        self._spot_filter_params['amp_min'] = 2.0
        self._spot_filter_params['dist_boundary_min'] = (0.00435, 0.00435)
        self._spot_filter_params['sigma_ratios_bounds'] = (1.25, 6)
        return_values = True
    607                                           self._init_params,
    608                                           self._coords,
    609                                           self._spot_filter_params['fit_dist_max_err'],
    610                                           self._spot_filter_params['min_spot_sep'],
    611                                           self._spot_filter_params['sigma_bounds'],
    612                                           self._spot_filter_params['amp_min'],
    613                                           self._spot_filter_params['dist_boundary_min'],
    614                                           self._spot_filter_params['sigma_ratios_bounds'],
    615                                           return_values)
    616 else:
    617     if self._is_skewed:

TypeError: filter_localizations() takes from 6 to 8 positional arguments but 10 were given

loose view of initial data after fitting spots

Some fitted spots are remote outliers, the view adapts to them, so it becomes hard to see the initial data and well fitted spots.
TODO: add a post-fitting filter that removes any spots outside of the defined ZYX coords array.

Candidates vs threshold plot

Generate semi-logy plot of found candidates vs threshold. This will allow user to decide on reasonable starting threshold.

Perform calculation every 100 ADUs from min value in image to max value in image.

Display in matplotlib window.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.