-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spot finding and decoding docs #1825
Conversation
…bility.py to accept variable data_set names.
Codecov Report
@@ Coverage Diff @@
## master #1825 +/- ##
==========================================
+ Coverage 87.37% 87.74% +0.36%
==========================================
Files 168 168
Lines 5784 5843 +59
==========================================
+ Hits 5054 5127 +73
+ Misses 730 716 -14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rebase this on top of the changes you made in #1821?
|
||
The spot-based approach finds spots in each image volume based on the brightness of regions | ||
relative to their surroundings and then builds a :term:`spot trace<Feature (Spot, Pixel) Trace>` | ||
using the appropriate ``TraceBuildingStrategies``. The spot traces can then be mapped, or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to link somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does now :)
|
||
.. _section_which_decoding_approach: | ||
|
||
What Decoding Pipeline Should I Use? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so good.
🚀
If you are unsure which spot finding and decoding methods are compatible with your data here is a | ||
handy table that summarizes the three major :term:`codebook <Codebook>` designs and what methods | ||
can be | ||
used to decode each of them. If your codebook doesn't fall into any of these categories, *make a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link "make a feature request on github" to the issue creation page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done.
.. _section_segmenting_cells: | ||
|
||
Segmenting Cells | ||
---------------- | ||
|
||
Unlike single-cell RNA sequencing, image-based transcriptomics methods do not physically separate | ||
cells before acquiring RNA information. Therefore, in order to characterize cells, the RNA must be | ||
cells before acquiring RNA information. Therefore in order to characterize cells, the RNA must be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like stuff that changed in your earlier PR.
@@ -48,6 +48,9 @@ Glossary | |||
A collection of Image Tiles corresponding to a specific volume or plane of the sample, under which the signal for all channels and all imaging rounds were acquired. All tiles within this FOV are the same size, but the manifest allows for different spatial coordinates for different imaging rounds or channels (to accommodate slight movement between rounds, for example). | |||
In microscopy, a field of view corresponds to the camera sensor mapped to the sample plane, and many such fields of view are expected to be taken per tissue slice. | |||
|
|||
Region of Interest (ROI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, was this file alphabetically sorted at one point in time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I was debating between ordering it alphabetically vs by complexity. With ctrl-F and links to terms from within the text, nobody needs to search for things alphabetically anymore. And by ordering it from basic to advanced the glossary page is more educational. This is on my to do list before JOSS submission.
examples/pixelbased_decoding.py
Outdated
important for accurate decoding and it needs vector magnitude and distance thresholds. See | ||
:ref:`howto_metricdistance` for more details. | ||
|
||
After decoding pixels, :py:class:`.PixelSpotDecoder` combines connected pixels into spots with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After decoding pixels, :py:class:`.PixelSpotDecoder` combines connected pixels into spots with | |
After decoding pixels, :py:class:`.PixelSpotDecoder` combines connected pixels into spots with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
min_mass=0.02, | ||
max_size=2, # this is max radius | ||
separation=7, | ||
noise_size=0.65, # this is not used because preprocess is False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's not used, can we not specify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it because noise_size
is mentioned in the text and is a reminder of what preprocess
does. But okay, removed.
separation=7, | ||
noise_size=0.65, # this is not used because preprocess is False | ||
preprocess=False, | ||
percentile=10, # this is irrelevant when min_mass, spot_diameter, and max_size are set properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is important to keep imo because it's like a safety measure. I changed "is irrelevant" to "has no effect", do you think that is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect.
examples/pixelbased_decoding.py
Outdated
dpsf.run(imgs, in_place=True) | ||
glp.run(imgs, in_place=True) | ||
|
||
# scale data with user-defined factors to normalize images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# scale data with user-defined factors to normalize images | |
# scale data with user-defined factors to normalize images. For this data set, the scale factors are stored in experiment.json. |
^^ suggested this because it's not required that the scale factors be in experiment.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
examples/pixelbased_decoding.py
Outdated
metric='euclidean', # distance metric to use for computing distance between a pixel vector and a codeword | ||
norm_order=2, # the L_n norm is taken of each pixel vector and codeword before computing the distance. this is n | ||
distance_threshold=0.5176, # minimum distance between a pixel vector and a codeword for it to be called as a gene | ||
magnitude_threshold=1.77e-5, # discard any pixel vectors below this magnitude | ||
min_area=2, # do not call a 'spot' if it's area is below this threshold (measured in pixels) | ||
max_area=np.inf, # do not call a 'spot' if it's area is above this threshold (measured in pixels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are great explanations!
Can we align the comments?
metric='euclidean', # distance metric to use for computing distance between a pixel vector and a codeword | |
norm_order=2, # the L_n norm is taken of each pixel vector and codeword before computing the distance. this is n | |
distance_threshold=0.5176, # minimum distance between a pixel vector and a codeword for it to be called as a gene | |
magnitude_threshold=1.77e-5, # discard any pixel vectors below this magnitude | |
min_area=2, # do not call a 'spot' if it's area is below this threshold (measured in pixels) | |
max_area=np.inf, # do not call a 'spot' if it's area is above this threshold (measured in pixels) | |
metric='euclidean', # distance metric to use for computing distance between a pixel vector and a codeword | |
norm_order=2, # the L_n norm is taken of each pixel vector and codeword before computing the distance. this is n | |
distance_threshold=0.5176, # minimum distance between a pixel vector and a codeword for it to be called as a gene | |
magnitude_threshold=1.77e-5, # discard any pixel vectors below this magnitude | |
min_area=2, # do not call a 'spot' if it's area is below this threshold (measured in pixels) | |
max_area=np.inf, # do not call a 'spot' if it's area is above this threshold (measured in pixels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -235,6 +348,8 @@ segmenting images of stained cells. | |||
Assigning Spots to Cells | |||
------------------------ | |||
|
|||
* :ref:`Assigning Spots to Cells <tutorial_assigning_spots_to_cells>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this belongs or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is just a temporary placeholder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This work is really amazing, thank you so much for all the detailed explanations and charts!
about how spots can be found and decoded in starfish see :ref:`section_finding_and_decoding`. | ||
|
||
There are two methods for viewing spots. The first is to access the :py:class:`.SpotAttributes` | ||
of a selected ImageSlice and add it as points to the napari viewer. The second is to use a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually, we call an entry in SpotFiindinigResults PerImageSliceSpotResults
examples/how_to/blob_detector.py
Outdated
that can be chosen with the ``detector_method`` argument when instantiating the | ||
detector. The default LoG approach is best unless computation time becomes a concern. | ||
|
||
In order to detects spots of various sizes in the same set of images, :py:class:`.BlobDetector` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to detects spots of various sizes in the same set of images, :py:class:`.BlobDetector` | |
In order to detect spots of various sizes in the same set of images, :py:class:`.BlobDetector` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
.. image:: /_static/design/tracebuilder_decisiontree.png | ||
:scale: 50 % | ||
:alt: Which TraceBuilder To Use | ||
:align: center | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^^ love a good flowchart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job, Matt! a few changes suggested, but looks good to me
using the appropriate ``TraceBuildingStrategies``. The spot traces can then be mapped, or | ||
*decoded*, to codewords in the codebook using a :py:class:`.DecodeSpotsAlgorithm`. | ||
|
||
.. list-table:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will the "width" option prevent the tables from overflowing?
https://docutils.sourceforge.io/docs/ref/rst/directives.html#table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I tried multiple widths and units, none of them worked. Possibly due to a bug in readthedocs sphinx theme? I know I could fix this by making a grid table. But if we settle on a different sphinx theme that might fix the issue. I've made a note to fix this before JOSS submission.
examples/how_to/blob_detector.py
Outdated
or filters as they are sometimes called, find spots that are the same size as it. | ||
|
||
Starfish implements this blob detection technique with :py:class:`.BlobDetector`. It supports three | ||
`approaches <https://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.html>_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
""" | ||
.. _tutorial_spot_based_decoding: | ||
|
||
Spot-Based Decoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this has no code to render, I think it makes more sense to move this content into the "finding and decoding spots" tutorial, perhaps replacing the "spot finding" section there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added code that compares the three spot finding algorithms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
…inding how-tos regarding their compatibility with cropped data sets and their support for 2D slices of a volume
closes #1480 |
closes #1749 |
Added tutorials for spot based decoding components and pixel based decoding. Also made minor edits to some of the related classes as well as added ROI to glossary.