Skip to content

Commit

Permalink
Normalize names for PipelineComponents (#1218)
Browse files Browse the repository at this point in the history
The CLI name for PipelineComponent should match the API name.

Test plan: travis
  • Loading branch information
ttung authored Apr 19, 2019
1 parent e6f7fb3 commit 051f77c
Show file tree
Hide file tree
Showing 70 changed files with 362 additions and 1,317 deletions.
2 changes: 1 addition & 1 deletion docs/source/_static/data_processing_examples/3d_smFISH.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# local intensity maxima, and spots are matched to the gene they represent by looking them up in a
# codebook that records which (round, channel) matches which gene target.

tlmpf = starfish.spots.SpotFinder.TrackpyLocalMaxPeakFinder(
tlmpf = starfish.spots.DetectSpots.TrackpyLocalMaxPeakFinder(
spot_diameter=5, # must be odd integer
min_mass=0.02,
max_size=2, # this is max radius
Expand Down
10 changes: 5 additions & 5 deletions docs/source/_static/data_processing_examples/iss_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import os

import starfish
from starfish.image import ApplyTransform, Filter, LearnTransform, Segmentation
from starfish.spots import SpotFinder, TargetAssignment
from starfish.image import ApplyTransform, Filter, LearnTransform, Segment
from starfish.spots import DetectSpots, AssignTargets
from starfish.types import Axes

test = os.getenv("TESTING") is not None
Expand All @@ -29,7 +29,7 @@ def iss_pipeline(fov, codebook):
filtered = filt.run(registered, verbose=True, in_place=False)

# detect spots using laplacian of gaussians approach
p = SpotFinder.BlobDetector(
p = DetectSpots.BlobDetector(
min_sigma=1,
max_sigma=10,
num_sigma=30,
Expand All @@ -46,15 +46,15 @@ def iss_pipeline(fov, codebook):
decoded = codebook.decode_per_round_max(intensities)

# segment cells
seg = Segmentation.Watershed(
seg = Segment.Watershed(
nuclei_threshold=.16,
input_threshold=.22,
min_distance=57,
)
label_image = seg.run(primary_image, fov.get_image('dots'))

# assign spots to cells
ta = TargetAssignment.Label()
ta = AssignTargets.Label()
assigned = ta.run(label_image, decoded)

return assigned, label_image
Expand Down
8 changes: 4 additions & 4 deletions docs/source/api/image/segmentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
Segmentation
============

Segmentation can be imported using ``starfish.image.Segmentation``, which registers all classes
that subclass ``SegmentationAlgorithmBase``:
Segmentation can be imported using ``starfish.image.Segment``, which registers all classes that subclass
``SegmentAlgorithmBase``:

.. code-block:: python
from starfish.image import Segmentation
from starfish.image import Segment
.. contents::


Watershed
---------

.. autoclass:: starfish.image._segmentation.watershed.Watershed
.. autoclass:: starfish.image._segment.watershed.Watershed
:members:

19 changes: 19 additions & 0 deletions docs/source/api/spots/assign_targets/assign_targets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. _assignment:

Target Assignment
=================

AssignTargets can be imported using ``starfish.spots.AssignTargets``, which registers all classes that subclass
``AssignTargetsAlgorithmBase``:

.. code-block:: python
from starfish.spots import AssignTargets
.. contents::

Label
-----

.. autoclass:: starfish.spots._assign_targets.label.Label
:members:
8 changes: 4 additions & 4 deletions docs/source/api/spots/decoding/decoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
Decoding
========

Decoders can be imported using ``starfish.spots.Decoder``, which registers all classes that subclass
``DecoderAlgorithmBase``:
Decoders can be imported using ``starfish.spots.Decode``, which registers all classes that subclass
``DecodeAlgorithmBase``:

.. code-block:: python
from starfish.spots import Decoder
from starfish.spots import Decode
.. contents::

Per Round Max Channel Decoder
-----------------------------

.. autoclass:: starfish.spots._decoder.per_round_max_channel_decoder.PerRoundMaxChannelDecoder
.. autoclass:: starfish.spots._decode.per_round_max_channel_decoder.PerRoundMaxChannelDecoder
:members:
12 changes: 6 additions & 6 deletions docs/source/api/spots/detection/detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
Detecting
=========

Spot Detectors can be imported using ``starfish.spots.SpotFinder``, which registers all classes that
subclass ``SpotFinderAlgorithmBase``:
Spot Detectors can be imported using ``starfish.spots.DetectSpots``, which registers all classes that
subclass ``DetectSpotsAlgorithmBase``:

.. code-block:: python
from starfish.spots import SpotFinder
from starfish.spots import DetectSpots
.. contents::

Blob Detector
-------------

.. autoclass:: starfish.spots._detector.blob.BlobDetector
.. autoclass:: starfish.spots._detect_spots.blob.BlobDetector
:members:

Local Max Peak Finder
---------------------

.. autoclass:: starfish.spots._detector.local_max_peak_finder.LocalMaxPeakFinder
.. autoclass:: starfish.spots._detect_spots.local_max_peak_finder.LocalMaxPeakFinder
:members:

Pixel Spot Decoder
-------------------

.. autoclass:: starfish.spots._pixel_decoder.pixel_spot_decoder.PixelSpotDecoder
.. autoclass:: starfish.spots._detect_pixels.pixel_spot_decoder.PixelSpotDecoder
:members:
2 changes: 1 addition & 1 deletion docs/source/api/spots/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Spots
detection/detection.rst

.. toctree::
target_assignment/target_assignment.rst
assign_targets/assign_targets.rst
19 changes: 0 additions & 19 deletions docs/source/api/spots/target_assignment/target_assignment.rst

This file was deleted.

296 changes: 53 additions & 243 deletions notebooks/BaristaSeq.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions notebooks/DARTFISH.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"from starfish import IntensityTable\n",
"\n",
"from starfish.image import Filter\n",
"from starfish.spots import PixelSpotDecoder"
"from starfish.spots import DetectPixels"
]
},
{
Expand Down Expand Up @@ -195,7 +195,7 @@
"# here, I set this to be a large number, so I can inspect the distribution of decoded distances below\n",
"distance_threshold = 3\n",
"\n",
"psd = PixelSpotDecoder.PixelSpotDecoder(\n",
"psd = DetectPixels.PixelSpotDecoder(\n",
" codebook=experiment.codebook,\n",
" metric='euclidean',\n",
" distance_threshold=distance_threshold,\n",
Expand Down Expand Up @@ -350,7 +350,7 @@
"source": [
"distance_threshold = min_dist\n",
"\n",
"psd = PixelSpotDecoder.PixelSpotDecoder(\n",
"psd = DetectPixels.PixelSpotDecoder(\n",
" codebook=experiment.codebook,\n",
" metric='euclidean',\n",
" distance_threshold=distance_threshold,\n",
Expand Down
515 changes: 60 additions & 455 deletions notebooks/ISS.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions notebooks/MERFISH.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@
"metadata": {},
"outputs": [],
"source": [
"from starfish.spots import PixelSpotDecoder\n",
"from starfish.spots import DetectPixels\n",
"\n",
"psd = PixelSpotDecoder.PixelSpotDecoder(\n",
"psd = DetectPixels.PixelSpotDecoder(\n",
" codebook=experiment.codebook,\n",
" metric='euclidean', # distance metric to use for computing distance between a pixel vector and a codeword\n",
" norm_order=2, # the L_n norm is taken of each pixel vector and codeword before computing the distance. this is n\n",
Expand Down
238 changes: 44 additions & 194 deletions notebooks/STARmap.ipynb

Large diffs are not rendered by default.

151 changes: 20 additions & 131 deletions notebooks/osmFISH.ipynb

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions notebooks/py/BaristaSeq.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#Load Data
#---------
#Import starfish and extract a single field of view.
#
# EPY: END markdown

# EPY: START code
Expand Down Expand Up @@ -75,7 +74,6 @@
#The first step in BaristaSeq is to do some rough registration. For this data,
#the rough registration has been done for us by the authors, so it is omitted
#from this notebook.
#
# EPY: END markdown

# EPY: START markdown
Expand All @@ -84,7 +82,6 @@
#BaristaSeq is typically processed in 2d. Starfish exposes
#`ImageStack.max_proj` to enable a user to max-project any axes. Here
#we max project Z for both the nissl images and the primary images.
#
# EPY: END markdown

# EPY: START code
Expand All @@ -103,7 +100,6 @@
#There is a slight miss-alignment of the C channel in the microscope used to
#acquire the data. This has been corrected for this data, but here is how it
#could be transformed using python code for future datasets.
#
# EPY: END markdown

# EPY: START code
Expand Down Expand Up @@ -138,7 +134,6 @@
#-----------------------------
#There are some minor registration errors along the pixels for which y < 100
#and x < 50. Those pixels are dropped from this analysis
#
# EPY: END markdown

# EPY: START code
Expand All @@ -153,7 +148,6 @@
#The following matrix contains bleed correction factors for Illumina
#sequencing-by-synthesis reagents. Starfish provides a LinearUnmixing method
#that will unmix the fluorescence intensities
#
# EPY: END markdown

# EPY: START code
Expand All @@ -179,7 +173,6 @@
#Channel 2 should look relative unchanged, as it only receives a bleed through
#of 5% of channel 3. However, Channel 3 should look dramatically sparser after
#spots from Channel 2 have been subtracted
#
# EPY: END markdown

# EPY: START code
Expand Down Expand Up @@ -212,7 +205,6 @@
#To remove image background, BaristaSeq uses a White Tophat filter, which
#measures the background with a rolling disk morphological element and
#subtracts it from the image.
#
# EPY: END markdown

# EPY: START code
Expand Down Expand Up @@ -248,7 +240,6 @@
#is identified and set as the maximum across channels, and the dynamic range is
#extended to equalize the channel intensities. We first demonatrate what
#scaling by the max value does.
#
# EPY: END markdown

# EPY: START code
Expand All @@ -262,7 +253,6 @@
#should see that the histograms are better aligned in terms of intensities.
#It gets most of what we want, but the histograms are still slightly shifted;
#a result of high-value outliers.
#
# EPY: END markdown

# EPY: START code
Expand Down Expand Up @@ -311,7 +301,7 @@ def plot_scaling_result(
# EPY: END markdown

# EPY: START code
psd = starfish.spots.PixelSpotDecoder.PixelSpotDecoder(
psd = starfish.spots.DetectPixels.PixelSpotDecoder(
codebook=exp.codebook, metric='euclidean', distance_threshold=0.5,
magnitude_threshold=0.1, min_area=7, max_area=50
)
Expand Down
6 changes: 3 additions & 3 deletions notebooks/py/DARTFISH.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from starfish import IntensityTable

from starfish.image import Filter
from starfish.spots import PixelSpotDecoder
from starfish.spots import DetectPixels
# EPY: END code

# EPY: START markdown
Expand Down Expand Up @@ -134,7 +134,7 @@ def compute_magnitudes(stack, norm_order=2):
# here, I set this to be a large number, so I can inspect the distribution of decoded distances below
distance_threshold = 3

psd = PixelSpotDecoder.PixelSpotDecoder(
psd = DetectPixels.PixelSpotDecoder(
codebook=experiment.codebook,
metric='euclidean',
distance_threshold=distance_threshold,
Expand Down Expand Up @@ -255,7 +255,7 @@ def compute_magnitudes(stack, norm_order=2):
# EPY: START code
distance_threshold = min_dist

psd = PixelSpotDecoder.PixelSpotDecoder(
psd = DetectPixels.PixelSpotDecoder(
codebook=experiment.codebook,
metric='euclidean',
distance_threshold=distance_threshold,
Expand Down
12 changes: 6 additions & 6 deletions notebooks/py/ISS.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@
# EPY: END markdown

# EPY: START code
from starfish.spots import SpotFinder
from starfish.spots import DetectSpots
import warnings

# parameters to define the allowable gaussian sizes (parameter space)
p = SpotFinder.BlobDetector(
p = DetectSpots.BlobDetector(
min_sigma=1,
max_sigma=10,
num_sigma=30,
Expand Down Expand Up @@ -205,7 +205,7 @@
# EPY: END markdown

# EPY: START code
from starfish.image import Segmentation
from starfish.image import Segment

dapi_thresh = .18 # binary mask for cell (nuclear) locations
stain_thresh = .22 # binary mask for overall cells // binarization of stain
Expand All @@ -217,7 +217,7 @@
nuclei = nuclei.max_proj(Axes.ROUND, Axes.CH, Axes.ZPLANE)


seg = Segmentation.Watershed(
seg = Segment.Watershed(
nuclei_threshold=dapi_thresh,
input_threshold=stain_thresh,
min_distance=min_dist
Expand All @@ -231,10 +231,10 @@
# EPY: END markdown

# EPY: START code
from starfish.spots import TargetAssignment
from starfish.spots import AssignTargets
from starfish.expression_matrix.expression_matrix import ExpressionMatrix

al = TargetAssignment.Label()
al = AssignTargets.Label()
labeled = al.run(masks, decoded)
cg = labeled.to_expression_matrix()
cg
Expand Down
4 changes: 2 additions & 2 deletions notebooks/py/MERFISH.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@
# EPY: END markdown

# EPY: START code
from starfish.spots import PixelSpotDecoder
from starfish.spots import DetectPixels

psd = PixelSpotDecoder.PixelSpotDecoder(
psd = DetectPixels.PixelSpotDecoder(
codebook=experiment.codebook,
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
Expand Down
Loading

0 comments on commit 051f77c

Please sign in to comment.