Commit d2b79418 authored by Christoph Sommer's avatar Christoph Sommer

checks and output

parent ad13bb99
......@@ -29,11 +29,11 @@ def get_args():
return parser.parse_args()
def convert(in_dir):
assert os.path.exists(in_dir), "Folder does not exist '{}'".format(in_dir)
assert os.path.exists(in_dir), " - Folder does not exist '{}'".format(in_dir)
ome_fns = glob.glob(os.path.join(in_dir, "*.ome.tiff"))
assert len(ome_fns) > 0, "No ome.tiff files found in {}'".format(in_dir)
assert len(ome_fns) > 0, " - No ome.tiff files found in {}'".format(in_dir)
# read first for spatial dims from frist file
tmp = tifffile.imread(ome_fns[0], is_ome=False)
......@@ -59,22 +59,23 @@ def convert(in_dir):
out_hyper = numpy.zeros((len(frame_set), z, len(channel_set), y, x), dtype=dtype)
print("Output shape TZCYX", out_hyper.shape)
print(" - Output shape TZCYX", out_hyper.shape)
for c, channel in enumerate(sorted(channel_set)):
for f, frame in enumerate(sorted(frame_set, key=lambda t: int(t))):
print("Reading", fn_lkp[(channel, frame)], c, f)
print(" - Reading", fn_lkp[(channel, frame)], c, f)
tmp = tifffile.imread(fn_lkp[(channel, frame)], is_ome=False)
out_hyper[f, :, c, :, :] = tmp
out_fn = "Resaved.tif"
print("Resaving to", out_fn)
print(" - Resaving to", out_fn)
tifffile.imsave(os.path.join(in_dir, out_fn), out_hyper, imagej=True)
def main():
args = get_args()
for in_dir in args.input_folders:
print("Converting ome-tiffs in '{}'".format(in_dir))
convert(in_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment