Describe the bug
Currently, the projections.py code for ophys projections uses imread to process the image paths it receives from LIMS. This is problematic, as the images are were changed to be integer representations for newer experiments are normalized from 0-255. Because the images are png files, imread will automatically cast them to float32 values ranging from 0-1.
To Reproduce
Calling the from_lims() function of the projections.py file of the sdk will cause this problem. The offending code is in line 53:
img = mpimg.imread(filepath)
Expected behavior
The SDK should probably use the Image class from PIL to handle this instead:
img = PILImage.open(filepath)
This will preserve the integer representation of the new projection files, and should still work with the older floating point projection files.
Actual Behavior
The returned image is represented as a 0-1 floating point number.
Environment (please complete the following information):
Python version: 3.6.8
AllenSDK version: Current Master
Additional context
This likely affects newer Ophys projects internally exclusively, as the older ones still rely on projections with a 0-1 floating point representation.
Do you want to work on this issue?
I have no problems working on the issue.
Describe the bug Currently, the projections.py code for ophys projections uses imread to process the image paths it receives from LIMS. This is problematic, as the images are were changed to be integer representations for newer experiments are normalized from 0-255. Because the images are png files, imread will automatically cast them to float32 values ranging from 0-1.
To Reproduce Calling the from_lims() function of the projections.py file of the sdk will cause this problem. The offending code is in line 53:
img = mpimg.imread(filepath)
Expected behavior The SDK should probably use the Image class from PIL to handle this instead:
img = PILImage.open(filepath)
This will preserve the integer representation of the new projection files, and should still work with the older floating point projection files.Actual Behavior The returned image is represented as a 0-1 floating point number.
Environment (please complete the following information):
Additional context This likely affects newer Ophys projects internally exclusively, as the older ones still rely on projections with a 0-1 floating point representation.
Do you want to work on this issue? I have no problems working on the issue.