Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyramidal Image Stitching #167

Open
veyselolgun opened this issue Dec 29, 2022 · 0 comments
Open

Pyramidal Image Stitching #167

veyselolgun opened this issue Dec 29, 2022 · 0 comments

Comments

@veyselolgun
Copy link

veyselolgun commented Dec 29, 2022

Hi, thanks for this big library.

I am trying to stitch below images to create as a pyramidal .ome.tif file.

When I am trying to stitch these images with below code, I am facing with some issue on the overlap areas, I tried with different overlap percent but result is not good. I think I am doing wrong somewhere but I could not find it.

Where I am wrong, is my overlap area to small or different problem or my parameters is incorrect ?

Also elapsed time is too long, maybe I need to change the some parameters, but I am not sure which parameters affect the speed (quantifying alignment error takes much time) ?

I also tried with %15 overlap, but result is distorted like when I choose %20 overlap

from ashlar import fileseries, thumbnail, reg
from ashlar.scripts.ashlar import process_axis_flip
import numpy as np

import time

s= time.perf_counter()
readers = []

for i in range(3):
    readers.append(fileseries.FileSeriesReader(
        r"C:\Users\Veysel\Desktop\stitch",
        pattern='image_{series:1}.jpg',
        overlap=0.20,
        width=4000,
        height=3000,
        layout="snake",
        direction='vertical',)
        )



aligner0 = reg.EdgeAligner(readers[0], channel=0, filter_sigma=1, verbose=True)
aligner0.run()

mosaic_args = {}
mosaic_args['verbose'] = True
aligners = []
aligners.append(aligner0)

mosaics = []
for j in range(1,3):
    aligners.append(
        reg.LayerAligner(readers[j], aligners[0], channel=j, filter_sigma=1, verbose=True)
    )
    aligners[j].run()
    print("aligners[0].mosaic_shape", aligners[0].mosaic_shape, aligners[0])
    mosaic = reg.Mosaic(
        aligners[j], aligners[0].mosaic_shape, None, **mosaic_args
    )
    mosaics.append(mosaic)

writer = reg.PyramidWriter(mosaics, r"C:\Users\Veysel\Desktop\stitch\out.ome.tif")
writer.run()

print("elapsed time: ",time.perf_counter()-s)

Output:

    assembling thumbnail 8/8
    quantifying alignment error 1000/1000
    aligning edge 7/7
    assembling thumbnail 8/8
    estimated cycle offset [y x] = [0. 0.]
    aligning tile 8/8
aligners[0].mosaic_shape (19590, 4000) <ashlar.reg.EdgeAligner object at 0x0000027E238C7340>
        merging tile 8/8
        merging tile 8/8
        merging tile 8/8
elapsed time:  553.6804612000001

image_0
image_1

Below image has distorted pixels (screenshot from overlap area of out.ome.tif)

image_1_overlap

image_2

Below image has distorted pixels (screenshot from overlap area of out.ome.tif)

image_2_overlap
image_3

image_4

Below image has distorted pixels (screenshot from overlap area of out.ome.tif)

image_4_overlap
image_5
image_6
image_7

Below image has distorted pixels (screenshot from overlap area of out.ome.tif)

image_7_overlap
preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant