Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
myosoft-imcf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
imcf
myosoft-imcf
Commits
948a18cc
Commit
948a18cc
authored
3 months ago
by
Laurent Guerard
Browse files
Options
Downloads
Patches
Plain Diff
Add background correction method
parent
5f704ad5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
1_identify_fibers.py
+21
-10
21 additions, 10 deletions
1_identify_fibers.py
with
21 additions
and
10 deletions
1_identify_fibers.py
+
21
−
10
View file @
948a18cc
...
...
@@ -107,20 +107,31 @@ def fix_BF_czi_imagetitle(imp):
return
image_title
def
preprocess_membrane_channel
(
imp
):
"""
apply myosoft pre-processing steps for the membrane channel
def
do_background_correction
(
imp
,
gaussian_radius
=
20
):
"""
Perform background correction on an image.
This is done by applying a Gaussian blur to the image and then dividing the
original image by the blurred image.
Parameters
----------
imp : ImagePlus
a single channel image of the membrane staining
imp : ij.ImagePlus
The image to be corrected.
gaussian_radius : int
The radius of the Gaussian filter to be used. Default value is 20.
Returns
-------
ij.ImagePlus
The background-corrected image.
"""
IJ
.
run
(
imp
,
"
Enhance Contrast
"
,
"
saturated=0.35
"
)
IJ
.
run
(
imp
,
"
Apply LUT
"
,
""
)
IJ
.
run
(
imp
,
"
Enhance Contrast
"
,
"
saturated=1
"
)
IJ
.
run
(
imp
,
"
8-bit
"
,
""
)
IJ
.
run
(
imp
,
"
Invert
"
,
""
)
IJ
.
run
(
imp
,
"
Convolve...
"
,
"
text1=[-1.0 -1.0 -1.0 -1.0 -1.0
\n
-1.0 -1.0 -1.0 -1.0 0
\n
-1.0 -1.0 24.0 -1.0 -1.0
\n
-1.0 -1.0 -1.0 -1.0 -1.0
\n
-1.0 -1.0 -1.0 -1.0 0] normalize
"
)
imp_bgd
=
imp
.
duplicate
()
IJ
.
run
(
imp_bgd
,
"
Gaussian Blur...
"
,
"
sigma=
"
+
str
(
gaussian_radius
)
+
"
scaled
"
,
)
return
ImageCalculator
.
run
(
imp
,
imp_bgd
,
"
Divide create 32-bit
"
)
def
get_threshold_from_method
(
imp
,
channel
,
method
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment