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
312bc8e7
Commit
312bc8e7
authored
3 weeks ago
by
Kai Schleicher
Browse files
Options
Downloads
Patches
Plain Diff
Add optional calibration parameter
parent
58644cd3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
2d_spots_in_fibers.py
+7
-2
7 additions, 2 deletions
2d_spots_in_fibers.py
with
7 additions
and
2 deletions
2d_spots_in_fibers.py
+
7
−
2
View file @
312bc8e7
...
@@ -227,7 +227,7 @@ def get_threshold_from_method(imp, method):
...
@@ -227,7 +227,7 @@ def get_threshold_from_method(imp, method):
return
threshold_value
return
threshold_value
def
convert_to_binary
(
imp
,
threshold
=
1
,
scale_binary
=
True
):
def
convert_to_binary
(
imp
,
threshold
=
1
,
scale_binary
=
True
,
cal
=
None
):
"""
Convert grayscale image to a mask / binary image
"""
Convert grayscale image to a mask / binary image
Parameters
Parameters
...
@@ -238,6 +238,8 @@ def convert_to_binary(imp, threshold=1, scale_binary=True):
...
@@ -238,6 +238,8 @@ def convert_to_binary(imp, threshold=1, scale_binary=True):
the threshold above which pixels are considered foreground, by default 1
the threshold above which pixels are considered foreground, by default 1
scale_binary : bool, optional
scale_binary : bool, optional
scale the mask image from 0/255 to 0/1, by default True
scale the mask image from 0/255 to 0/1, by default True
cal : ImagePlus Calibration, optional
apply the calibration if given, by default None
Returns
Returns
-------
-------
...
@@ -257,6 +259,9 @@ def convert_to_binary(imp, threshold=1, scale_binary=True):
...
@@ -257,6 +259,9 @@ def convert_to_binary(imp, threshold=1, scale_binary=True):
IJ
.
run
(
mask_imp
,
"
Divide...
"
,
"
value=255
"
)
IJ
.
run
(
mask_imp
,
"
Divide...
"
,
"
value=255
"
)
IJ
.
run
(
mask_imp
,
"
Enhance Contrast
"
,
"
saturated=0.35
"
)
IJ
.
run
(
mask_imp
,
"
Enhance Contrast
"
,
"
saturated=0.35
"
)
mask_imp
.
changes
=
False
mask_imp
.
changes
=
False
if
cal
!=
None
:
mask_imp
.
setCalibration
(
cal
)
return
mask_imp
return
mask_imp
...
@@ -502,7 +507,7 @@ quality_thresholds = quality_thresholds_string.split(",")
...
@@ -502,7 +507,7 @@ quality_thresholds = quality_thresholds_string.split(",")
dapi_channel
=
BFopen_image
(
path_to_image
,
dapi_channel_number
,
series_number
)
dapi_channel
=
BFopen_image
(
path_to_image
,
dapi_channel_number
,
series_number
)
if
threshold
<=
0
:
if
threshold
<=
0
:
threshold
=
get_threshold_from_method
(
dapi_channel
,
"
otsu
"
)
threshold
=
get_threshold_from_method
(
dapi_channel
,
"
otsu
"
)
dapi_binary
=
convert_to_binary
(
dapi_channel
,
threshold
)
dapi_binary
=
convert_to_binary
(
dapi_channel
,
threshold
,
cal
=
dapi_channel
.
getCalibration
()
)
# detect spots and count them per fiber
# detect spots and count them per fiber
results_table
=
ResultsTable
()
results_table
=
ResultsTable
()
...
...
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