Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-imcflibs
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
imcf
python-imcflibs
Commits
1aed64f1
Commit
1aed64f1
authored
6 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Make correct_and_project() return a tuple of bool
parent
a61a260f
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
src/imcflibs/imagej/shading.py
+13
-2
13 additions, 2 deletions
src/imcflibs/imagej/shading.py
with
13 additions
and
2 deletions
src/imcflibs/imagej/shading.py
+
13
−
2
View file @
1aed64f1
...
@@ -78,22 +78,32 @@ def correct_and_project(filename, path, model, proj, fmt):
...
@@ -78,22 +78,32 @@ def correct_and_project(filename, path, model, proj, fmt):
fmt : str
fmt : str
The file format suffix to be used for the results and projections, e.g.
The file format suffix to be used for the results and projections, e.g.
'
.ics
'
for ICS2 etc. See the Bio-Formats specification for details.
'
.ics
'
for ICS2 etc. See the Bio-Formats specification for details.
Returns
-------
(bool, bool)
A tuple of booleans indicating whether a shading correction has been
applied and whether projections were created. The latter depends on
both, the requested projections as well as the image type (e.g. it can
be False even if projections were requested, but the image)
"""
"""
target
=
gen_name_from_orig
(
path
,
filename
,
""
,
fmt
)
target
=
gen_name_from_orig
(
path
,
filename
,
""
,
fmt
)
if
os
.
path
.
exists
(
target
):
if
os
.
path
.
exists
(
target
):
log
.
info
(
"
Found shading corrected file, not re-creating: %s
"
,
target
)
log
.
info
(
"
Found shading corrected file, not re-creating: %s
"
,
target
)
return
return
False
,
False
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
os
.
makedirs
(
path
)
os
.
makedirs
(
path
)
imps
=
bioformats
.
import_image
(
filename
,
split_c
=
True
)
imps
=
bioformats
.
import_image
(
filename
,
split_c
=
True
)
ret_corr
=
False
if
model
is
not
None
:
if
model
is
not
None
:
log
.
debug
(
"
Applying shading correction on [%s]...
"
,
filename
)
log
.
debug
(
"
Applying shading correction on [%s]...
"
,
filename
)
imp
=
apply_model
(
imps
,
model
)
imp
=
apply_model
(
imps
,
model
)
bioformats
.
export_using_orig_name
(
imp
,
path
,
filename
,
""
,
fmt
,
True
)
bioformats
.
export_using_orig_name
(
imp
,
path
,
filename
,
""
,
fmt
,
True
)
# imps needs to be updated with the new (=merged) stack:
# imps needs to be updated with the new (=merged) stack:
imps
=
[
imp
]
imps
=
[
imp
]
ret_corr
=
True
if
proj
==
'
None
'
:
if
proj
==
'
None
'
:
projs
=
[]
projs
=
[]
...
@@ -102,10 +112,11 @@ def correct_and_project(filename, path, model, proj, fmt):
...
@@ -102,10 +112,11 @@ def correct_and_project(filename, path, model, proj, fmt):
else
:
else
:
projs
=
[
proj
]
projs
=
[
proj
]
for
imp
in
imps
:
for
imp
in
imps
:
projections
.
create_and_save
(
imp
,
projs
,
path
,
filename
,
fmt
)
ret_proj
=
projections
.
create_and_save
(
imp
,
projs
,
path
,
filename
,
fmt
)
imp
.
close
()
imp
.
close
()
log
.
debug
(
"
Done processing [%s].
"
,
os
.
path
.
basename
(
filename
))
log
.
debug
(
"
Done processing [%s].
"
,
os
.
path
.
basename
(
filename
))
return
ret_corr
,
ret_proj
def
process_folder
(
path
,
suffix
,
outpath
,
model_file
,
fmt
):
def
process_folder
(
path
,
suffix
,
outpath
,
model_file
,
fmt
):
...
...
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