focus-stack icon indicating copy to clipboard operation
focus-stack copied to clipboard

Iterations do not converge

Open scholzri opened this issue 1 year ago • 1 comments

Hi, first of all, thank you for this great piece of software! It works good for most of my fluorescence microscopy images, but in some cases it fails to align the images of my z-stack properly. For example:

dataset: https://we.tl/t-q8NR38KeS1

command: focus-stack image*.tif --output=projection.tif --no-whitebalance --no-contrast --denoise=0 --consistency=0 --batchsize=8 --align-keep-size --full-resolution-align

error:

Task Align image1.tif to image10.tif on thread 23 failed with exception:
OpenCV(4.2.0) ../modules/video/src/ecc.cpp:572: error: (-7:Iterations do not converge) The algorithm stopped before its convergence. The correlation is going to be minimized. Images may be uncorrelated or non-overlapped in function 'findTransformECC'

Do you have an idea what the cause of the problem could be?

Thanks!

scholzri avatar May 22 '23 10:05 scholzri

It appears that the files are stored as 16-bit TIFF, but the values in the files are only 8-bit. This causes the files to appear almost completely black when opened in e.g. GIMP.

Focus-stack doesn't currently support 16-bit processing (issue #34), so it converts the files to 8-bit mapping 65535->255, which causes black images. The processing then fails because there is no information in the images.

PetteriAimonen avatar May 22 '23 11:05 PetteriAimonen