-
Notifications
You must be signed in to change notification settings - Fork 5
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
New background correction option and improved junge calculation #314
Conversation
Silcam.py updated for bayer_rg8 images
Bayer conversion function name changed from brg8 to bayer_rgb8. Pyopia version (__init__) changed to 2.5.0.
format_load is now updated in SilCamLoad Class
Updated bayer conversion code to check the intensity range of converted rgb image. It raises an error if it exceeds 0-255, and if the max and min values change.
Final check was added for input image dimension (similar to mono).
The docstring of SilCamLoad class has been updated.
Checked by Flake8.
The "modify_config" has been modified to handle the pixel_size some other minor modifications of "modify_value"
Version has changed
The "get_j" function is now modified to handle zero values in number_distribution[ind]
… imbg SINTEF#315 A new function added to divide the raw images by bg images. Zero_value pixels handled by changing them to 1/255
This is a good addition. The new background correction method should also be possible to set from the config file. We should consider adding the required logic in this pull request, and updating the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I suggest also updating the background notebook in the docs/ folder with a simple example of how to use this new functionality, and perhaps compare the result of division and subtraction approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest this is version 2.6.0, since it introduces a new functionality
Hei @emlynjdavies, Would you please add couple of empty images (images with zero particles) into oil.zip [pyopia.exampledata.get_file_from_pysilcam_blob('oil.zip')] for background correction? In this case we can show the differences between subtraction and division in a nicer way in the background notebook in the docs/ folder. The current notebook contains white-color circles in the corrected image!!! |
The oil directory is intended to just contain oil images. You can use a few (e.g. 10) of the oil images to create the background (doesn't need to be clean images, just as long as you have enough moving droplets that they average out ok) |
background.py and background.ipynb modified and updated
Hei all, I made some changes in correct_im_accurate()/background.py. I realized that if the background is not clean enough, the division mode would produce a corrected image out of the (0,1) range-a dark image!!!. So, I used couple of extra lines to handle the problem (clipping and shifting negative values to zero for division mode). The background notebook is now modified to show the two different methods of subtraction and division, however, for some reasons, it does not pass the pipeline_holo_test(). I had the same problem when I passed the divide_bg = True as the default value, and changed it to False. I also had to change the version in init.py from '2.6.2' to '2.6.3' to pass the version check. |
Excellent. I think it is best that @nepstad take a final review on this one ;) |
I think it looks good now! |
The version should be changed to 2.7.0, since the main branch is on 2.6.2 now. |
The 'get_j' function is now modified to handle zero_value RuntimeWarning encountered in np.log(number_distribution[ind])