glichtner / pystackreg

A python extension for the automatic alignment of a source image or a stack (movie) to a target image/reference frame.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

negative pixel values after alignment

JohannaRahm opened this issue · comments

Hi,

thanks for creating this very useful tool! I want to apply pystackreg to register two microscopy images. The reference image has a high and the second image has a low SNR. However, after alignment, negative pixel values appear. I followed the suggestions in issue #8, but could not get rid of the negative values. Therefore, I would be very grateful for your input on how to fix this!! Attached is my code and two example images.

As the images differ drastically in their pixel value range (high SNR:0-340, low SNR:0-34), I found it to be useful to stretch the pixel values across the entire bit depth (0-65535), learn the registration based on the stretched images, and apply the registration on the non-streched 2nd image. This reduces the number of negative pixel values slightly. Atm, I am clipping negative values to zero, but would prefer if negative values could be avoided in the first place. Without the stretching approach, the registration is unstable and applies an incorrect large shift to the 2nd image.

register_images_negative_values.zip

pystackreg version: 0.2.7

Best,
Johanna

The Solution for this Problem can be found in an older version of the documentation:

https://pystackreg.readthedocs.io/en/latest/tutorial.html#clipping-of-negative-values