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
f29a57b5
Commit
f29a57b5
authored
6 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Add imagej.projections module for doing stack projections
parent
fd63418a
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/projections.py
+73
-0
73 additions, 0 deletions
src/imcflibs/imagej/projections.py
with
73 additions
and
0 deletions
src/imcflibs/imagej/projections.py
0 → 100644
+
73
−
0
View file @
f29a57b5
"""
Functions for creating Z projections.
"""
from
.bioformats
import
export_using_orig_name
from
ij.plugin
import
ZProjector
def
average
(
imp
):
"""
Create an average intensity projection.
Parameters
----------
imp : ij.ImagePlus
The input stack to be projected.
Returns
-------
ij.ImagePlus
The result of the projection.
"""
# log.debug("Creating average projection...")
proj
=
ZProjector
.
run
(
imp
,
"
avg
"
)
return
proj
def
maximum
(
imp
):
"""
Create a maximum intensity projection.
Parameters
----------
imp : ij.ImagePlus
The input stack to be projected.
Returns
-------
ij.ImagePlus
The result of the projection.
"""
# log.debug("Creating maximum intensity projection...")
proj
=
ZProjector
.
run
(
imp
,
"
max
"
)
return
proj
def
create_and_save
(
imp
,
projections
,
path
,
filename
,
export_format
):
"""
Wrapper to create one or more projections and export the results.
Parameters
----------
imp : ij.ImagePlus
The image stack to create the projections from.
projections : list(str)
A list of projection types to be done, valid options are
'
Average
'
,
'
Maximum
'
and
'
Sum
'
.
path : str
The path to store the results in.
filename : str
The original file name to derive the results name from.
export_format : str
The suffix to be given to Bio-Formats, determining the storage format.
"""
command
=
{
'
Average
'
:
'
avg
'
,
'
Maximum
'
:
'
max
'
,
'
Sum
'
:
'
sum
'
,
}
for
projection
in
projections
:
# log.debug("Creating '%s' projection..." % projection)
proj
=
ZProjector
.
run
(
imp
,
command
[
projection
])
export_using_orig_name
(
proj
,
path
,
filename
,
"
-%s
"
%
command
[
projection
],
export_format
)
proj
.
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