Teichlab / bin2cell

Join subcellular Visium HD bins into cells
MIT License
62 stars 2 forks source link

loading high resolution images #32

Open beata-malachowska opened 2 days ago

beata-malachowska commented 2 days ago

Hi, thank you for creating this tool, it's great! I managed to run the pipeline, for some samples I have very big original photo, and OpenCV gives me error while trying to run b2c.scaled_he_image. I tried increasing the allowed memory by: cv2.MAX_IMAGE_PIXELS = None, but it doesn't help. Decreasing the size of the image is also not possible as it gets mismatch with original Spaceranger output. Is there a way to load the image with different tool like Pillow in order to properly run scaled_he_image? Or should I rerun spaceranger with downgraded image?

ktpolanski commented 2 days ago

Bin2cell increases the cv2 load limit as part of its code. Last time this happened (#18, at the bottom), I'm pretty sure the user was loading cv2 before loading b2c and that resulted in the config not applying properly. That issue has a different thing going on as well, where a different user was trying to load a non-RGB image and that was sending cv2 into some strange realms where the config wasn't working.

Try loading b2c before loading cv2 (in a restarted session of course). If that fails, identify (from ImageMagick, available from conda) the image. If nothing turns out to be amiss yet you keep having problems, come back with the cv2 error and the identify output. Worst case scenario we can modify the function to just load with PIL.

beata-malachowska commented 2 days ago

Thank you so much for fast response. It worked!

ktpolanski commented 2 days ago

It what, loading b2c before cv2?