Skip to content

Commit 2819797

Browse files
committed
Add additional preprocessing
1 parent ad051b6 commit 2819797

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

gallery/tutorials/pipeline_demo.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@
126126
# Image Preprocessing
127127
# -------------------
128128
# We apply some image preprocessing techniques to prepare the
129-
# the images for denoising via Class Averaging. When processing
130-
# experimental data additional preprocesing methods such as
131-
# noise whitening, contrast inversion, and background normalization
132-
# can be applied in a similar fashion.
129+
# the images for denoising via Class Averaging.
133130

134131
# %%
135132
# Downsampling
@@ -150,14 +147,38 @@
150147
src.images[:10].show()
151148

152149
# %%
153-
# Cache
154-
# -----
150+
# Normalize Background
151+
# --------------------
152+
# We apply ``normalize_background()`` to prepare the image class averaging.
153+
154+
src = src.normalize_background()
155+
src.images[:10].show()
156+
157+
# %%
158+
# Caching
159+
# -------
155160
# We apply ``cache`` to store the results of the ``ImageSource``
156161
# pipeline up to this point. This is optional, but can provide
157162
# benefit when used intently on machines with adequate memory.
158-
163+
# Since the remaining preprocessing steps, whitening and contrast
164+
# inversion, as well as class averaging require passing over the
165+
# full set of images, caching at this point saves compute time.
159166
src = src.cache()
160-
src.images[0:10].show()
167+
168+
# %%
169+
# Noise Whitening
170+
# ---------------
171+
# We apply ``whiten()`` to estimate and whiten the noise.
172+
173+
src = src.whiten()
174+
src.images[:10].show()
175+
176+
# %%
177+
# Contrast Inversion
178+
# ------------------
179+
# We apply ``invert_contrast()`` to ensure a positive valued signal.
180+
181+
src = src.invert_contrast()
161182

162183
# %%
163184
# Class Averaging

0 commit comments

Comments
 (0)