Closed sgasilov closed 1 year ago
Could you please git checkout -t origin/append-to-files
, install it and check if it's doing what you need?
Example usage: ufo-launch -q read path=foobar.tif number=10 ! write filename=appended-rewritten.tif tiff-bigtiff=True append-file=True
Tomas, hello
It does put all images into one file, however, for whatever reason not always to the end? That is, if I open results of: for i in ; do ufo-launch read path=$i/sli-nlmdn/ start=4 number=216 ! write filename=../head-neck.tif append=True; done and scroll, I see z02 - z00 - z01, not z00 - z01 - z02. Is it my bash or something in libtif? If I run that: (ufoenv) head>for i in ; do echo $i; done I get the correct sequence: z00 z01 z02
I don't see this behavior, could you try in python:
ones = np.ones((n, n), dtype=np.float32)
fmt = '{}/image-{:>04}.tif'
for i in range(8):
for j in range(256):
out_dir = f'{i:>02}' # you need to make sure this dir exists
tifffile.imwrite(fmt.format(out_dir, j), ones * (256 * i + j))
then in bash:
for i in */; do ufo-launch -q read path=$i ! write filename=appended.tif tiff-bigtiff=True append-file=True; done
and then again in python:
reader = TiffSequenceReader('appended.tif')
x = [reader.read(i)[0, 0] for i in range(reader.num_images)]
assert np.all(np.gradient(x) == 1)
Did that and have no assertion errors
OK, so I leave this open and when you check it on real data write me please and we will merge this.
Everything works correctly, thank you very much!
Hello,
there is "append" flag in "write" sink which is presently not doing much. Could you program it in such a way that when True, one can add pages to an existing bigtiff file? For instance:
for i in *; do ufo-launch read path=$i/sli-nlmdn/ start=4 number=216 ! write filename=../head-neck.tif append=True; done
will take certain slices from a bunch of directories and pack them together in one container.Cheers, Sergei.