CANDELbio / mantis-viewer

Electron-based multiplexed imaging viewer
Apache License 2.0
22 stars 7 forks source link

Loading image stacks #16

Closed zinagood closed 4 years ago

zinagood commented 4 years ago

Dear Lacie and Team,

CODEX data often comes in an image stack form (.tif) that contains all channels in one file. Would it be possible to support importing the stacks / montages?

Thanks! Zina

rj3d commented 4 years ago

Yeah, that should be possible! Would you mind sharing an example of one of these images with us? If you don't want to post it publicly, you can email it to me at rschiemann@parkerici.org.

rj3d commented 4 years ago

After some analysis, adding this directly to Mantis right now would require a significant overhaul of how Mantis opens images. The problems are twofold. First, the images are too large for Javascript. All of the tiff libraries I've found for Javascript read the full tiff file into a buffer before processing it, and because Javascript has a maximum buffer size of ~ 2GB this fails. The second problem is that these images are what are called hyperstacks. From what I've been able to gather, hyperstacks can only be generated by ImageJ (and a few other programs that make use of the underlying imaging library). There are a couple of libraries that claim to support opening hyperstacks, but depending on the specifics of how the hyperstack was generated some hyperstacks can only be opened with ImageJ or the underlying imaging library. Long term we are planning to switch the image processing backend from javascript to Clojure/Java. When we do, we are planning to use the same library that ImageJ uses, which will add support for image stacks and larger images without downsampling when we do. In the interim, we're releasing a command line utility that we're calling image-utils that can be used to split tiff stacks into individual tiffs that Mantis is able to open.