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
aa9f80b0
Commit
aa9f80b0
authored
1 month ago
by
Laurent Guerard
Browse files
Options
Downloads
Patches
Plain Diff
Add rescaling if image is too big for Cellpose even on Naboo
parent
2ef8b8cc
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
+11
-41
11 additions, 41 deletions
1_identify_fibers.py
with
11 additions
and
41 deletions
1_identify_fibers.py
+
11
−
41
View file @
aa9f80b0
...
...
@@ -747,8 +747,13 @@ if __name__ == "__main__":
raw
,
membrane_channel
,
membrane_channel
,
1
,
1
,
1
,
1
)
if
not
os
.
path
.
exists
(
str
(
output_dir
)):
os
.
makedirs
(
str
(
output_dir
))
if
(
membrane
.
getWidth
()
*
membrane
.
getHeight
())
>
100000
:
misc
.
timed_log
(
"
Image is too large, resizing to speed up processing
"
)
membrane
=
membrane
.
resize
(
membrane
.
getWidth
()
/
2
,
membrane
.
getHeight
()
/
2
,
"
none
"
,
)
imp_bgd_corrected
=
do_background_correction
(
membrane
)
IJ
.
run
(
"
Conversions...
"
,
"
scale
"
)
IJ
.
run
(
imp_bgd_corrected
,
"
16-bit
"
,
""
)
...
...
@@ -764,46 +769,11 @@ if __name__ == "__main__":
perimeter_thresh
=
[
minPer
,
maxPer
],
)
# update the log for the user
misc
.
timed_log
(
"
Now working on
"
+
str
(
raw_image_title
))
if
raw_image_calibration
.
scaled
()
is
False
:
IJ
.
log
(
"
Your image is not spatially calibrated! Size measurements are only possible in [px].
"
imp_result
=
imp_result
.
resize
(
raw
.
getWidth
(),
raw
.
getHeight
(),
"
none
"
,
)
# Only print it once since we'll use the same settings everytime
if
index
==
0
:
IJ
.
log
(
"
-- settings used --
"
)
IJ
.
log
(
"
area =
"
+
str
(
minAr
)
+
"
-
"
+
str
(
maxAr
))
IJ
.
log
(
"
perimeter =
"
+
str
(
minPer
)
+
"
-
"
+
str
(
maxPer
))
IJ
.
log
(
"
circularity =
"
+
str
(
minCir
)
+
"
-
"
+
str
(
maxCir
))
IJ
.
log
(
"
ROI expansion [microns] =
"
+
str
(
enlarge_radius
))
IJ
.
log
(
"
Membrane channel =
"
+
str
(
membrane_channel
))
IJ
.
log
(
"
MHC positive fiber channel =
"
+
str
(
fiber_channel
))
# IJ.log("sub-tiling = " + str(tiling_factor))
IJ
.
log
(
"
-- settings used --
"
)
# image (pre)processing and segmentation (-> ROIs)# imp, firstC, lastC, firstZ,
# lastZ, firstT, lastT
membrane
=
Duplicator
().
run
(
raw
,
membrane_channel
,
membrane_channel
,
1
,
1
,
1
,
1
)
imp_bgd_corrected
=
do_background_correction
(
membrane
)
IJ
.
run
(
"
Conversions...
"
,
"
scale
"
)
IJ
.
run
(
imp_bgd_corrected
,
"
16-bit
"
,
""
)
imp_result
=
run_tm
(
imp_bgd_corrected
,
1
,
cellpose_dir
.
getPath
(),
PretrainedModel
.
CYTO2
,
30.0
,
area_thresh
=
[
minAr
,
maxAr
],
circularity_thresh
=
[
minCir
,
maxCir
],
perimeter_thresh
=
[
minPer
,
maxPer
],
)
IJ
.
saveAs
(
imp_result
,
"
Tiff
"
,
os
.
path
.
join
(
output_dir
,
raw_image_title
+
"
_all_fibers_binary
"
),
)
IJ
.
saveAs
(
imp_result
,
...
...
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