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
5d3b5f32
Commit
5d3b5f32
authored
6 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Split process_files() out from process_folder()
parent
1aed64f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/imcflibs/imagej/shading.py
+26
-6
26 additions, 6 deletions
src/imcflibs/imagej/shading.py
with
26 additions
and
6 deletions
src/imcflibs/imagej/shading.py
+
26
−
6
View file @
5d3b5f32
...
@@ -138,6 +138,30 @@ def process_folder(path, suffix, outpath, model_file, fmt):
...
@@ -138,6 +138,30 @@ def process_folder(path, suffix, outpath, model_file, fmt):
fmt : str
fmt : str
The file format suffix for storing the results.
The file format suffix for storing the results.
"""
"""
matching_files
=
listdir_matching
(
path
,
suffix
,
fullpath
=
True
)
process_files
(
matching_files
,
outpath
,
model_file
,
fmt
)
def
process_files
(
files
,
outpath
,
model_file
,
fmt
):
"""
Run shading correction and projections on a list of files.
Parameters
----------
files : list(str)
The files to be processed, as a list of strings with the full path.
outpath : str
The output folder where results will be stored. Existing files will be
overwritten.
model_file : str
The full path to a normalized 32-bit shading model image. If set to
'
-
'
or
'
NONE
'
, no shading correction will be applied, i.e. only the
projection step will have an effect.
fmt : str
The file format suffix for storing the results.
"""
log
.
info
(
"
Running shading correction and projections on %s files...
"
,
len
(
files
))
if
model_file
.
upper
()
in
[
"
-
"
,
"
NONE
"
]:
if
model_file
.
upper
()
in
[
"
-
"
,
"
NONE
"
]:
model
=
None
model
=
None
else
:
else
:
...
@@ -152,12 +176,8 @@ def process_folder(path, suffix, outpath, model_file, fmt):
...
@@ -152,12 +176,8 @@ def process_folder(path, suffix, outpath, model_file, fmt):
except
AttributeError
:
except
AttributeError
:
misc
.
error_exit
(
"
Opening shading model [%s] failed!
"
%
model_file
)
misc
.
error_exit
(
"
Opening shading model [%s] failed!
"
%
model_file
)
matching_files
=
listdir_matching
(
path
,
suffix
)
for
in_file
in
files
:
log
.
info
(
"
Running shading correction and projections on %s files...
"
,
len
(
matching_files
))
for
orig_file
in
matching_files
:
in_file
=
os
.
path
.
join
(
path
,
orig_file
)
correct_and_project
(
in_file
,
outpath
,
model
,
'
ALL
'
,
fmt
)
correct_and_project
(
in_file
,
outpath
,
model
,
'
ALL
'
,
fmt
)
if
model
:
if
model
:
model
.
close
()
model
.
close
()
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