Combine two single-channel TIFF stacks to a single multi-channel stack

ⅰ亾dé卋堺 提交于 2019-12-13 12:40:14

问题


I've got two tiff stacks with time-lapse data corresponding to different channels acquired in a microscopy experiment. I'd like to merge them into a single stack with two channels. Both stacks are 16-bit greyscale.

When I use:

convert stack1.tiff stack2.tiff stack_merged.tiff

I get a single but concatenated file with two stacks one after another.

Links to file 1 and file 2.


回答1:


I think you need something like this:

#!/bin/bash

# Get index of last frame in TIFF image
last=$(convert stack1.tif -print "%[fx:n-1]" null:)

# Combine all frames
for i in `seq 0 $last`; do
   convert stack1.tif[$i] stack2.tif[$i] -combine miff:-
done | convert miff:- -compress lzw result.tif


来源:https://stackoverflow.com/questions/40636814/combine-two-single-channel-tiff-stacks-to-a-single-multi-channel-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!