Skip to content
Snippets Groups Projects
Commit 4822aad6 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Make sure input dataset actually is a stack before projecting

parent eabdfcf8
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,10 @@ def average(imp): ...@@ -19,6 +19,10 @@ def average(imp):
ij.ImagePlus ij.ImagePlus
The result of the projection. The result of the projection.
""" """
if imp.getDimensions()[3] < 2:
log.warn("ImagePlus is not a z-stack, not creating a projection!")
return imp
log.debug("Creating average projection...") log.debug("Creating average projection...")
proj = ZProjector.run(imp, "avg") proj = ZProjector.run(imp, "avg")
return proj return proj
...@@ -37,6 +41,10 @@ def maximum(imp): ...@@ -37,6 +41,10 @@ def maximum(imp):
ij.ImagePlus ij.ImagePlus
The result of the projection. The result of the projection.
""" """
if imp.getDimensions()[3] < 2:
log.warn("ImagePlus is not a z-stack, not creating a projection!")
return imp
log.debug("Creating maximum intensity projection...") log.debug("Creating maximum intensity projection...")
proj = ZProjector.run(imp, "max") proj = ZProjector.run(imp, "max")
return proj return proj
...@@ -59,6 +67,10 @@ def create_and_save(imp, projections, path, filename, export_format): ...@@ -59,6 +67,10 @@ def create_and_save(imp, projections, path, filename, export_format):
export_format : str export_format : str
The suffix to be given to Bio-Formats, determining the storage format. The suffix to be given to Bio-Formats, determining the storage format.
""" """
if imp.getDimensions()[3] < 2:
log.error("ImagePlus is not a z-stack, not creating any projections!")
return
command = { command = {
'Average': 'avg', 'Average': 'avg',
'Maximum': 'max', 'Maximum': 'max',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment