CANDELbio / mantis-viewer

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

How is max image size determined? #24

Closed ngreenwald closed 4 years ago

ngreenwald commented 4 years ago

How is the maximum size before downsampling applies set? I'm currently trying to look at 7 different channels, each of which are 5-15 MBs.

However, they are getting downsampled. It seems like these could all pretty comfortably fit into memory. Is there a way to increase the amount of available memory? Alternatively, what is the current max? That way I can split the file into pieces that are as large as can fit.

rj3d commented 4 years ago

Right now, downsampling kicks in whenever the width or height of an image is at or over 10k pixels, and then it gets downsampled to 8k pixels on the largest dimension. The problem that I was running into is that even if the image is small on disk, it ends up getting decompressed into a byte array, which can be too large to fit into memory. Unfortunately the limitation is a part of Javascript as it currently exists. It's a 32-bit language, so the largest chunk of memory that it can reserve is 2 GB.

I can add a feature to configure the max image size in this next release so that you can play around with it with your images. You might be able to push it a little higher!

ngreenwald commented 4 years ago

Okay that make sense. Do you think you could change to 10.3k pixels? Our images are 1024 x1024, so a row of 10 is 10240 pixels.

On Mon, Apr 13, 2020 at 6:04 PM Robert Schiemann notifications@github.com wrote:

Right now, downsampling kicks in whenever the width or height of an image is at or over 10k pixels, and then it gets downsampled to 8k pixels on the largest dimension. The problem that I was running into is that even if the image is small on disk, it ends up getting decompressed into a byte array, which can be too large to fit into memory. Unfortunately the limitation is a part of Javascript as it currently exists. It's a 32-bit language, so the largest chunk of memory that it can reserve is 2 GB.

I can add a feature to configure the max image size in this next release so that you can play around with it with your images. You might be able to push it a little higher!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParkerICI/mantis-viewer/issues/24#issuecomment-613170180, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJB47M6L4ZQFEM3GIBHEA3RMOZCLANCNFSM4MDHZ6OQ .

rj3d commented 4 years ago

Yup, can do! I'll make a pre-release with the bumped downsampling threshold tomorrow. Long term, I think I have an idea that might do away with downsampling altogether that I'm going to try to fit into this release.

ngreenwald commented 4 years ago

Awesome! I think 100 images will cover our bases for the foreseeable future, but for stitched images with a set shape we may have less flexibility for how it needs to be displayed.

On Tue, Apr 14, 2020 at 7:40 PM Robert Schiemann notifications@github.com wrote:

Yup, can do! I'll make a pre-release with the bumped downsampling threshold tomorrow. Long term, I think I have an idea that might do away with downsampling altogether that I'm going to try to fit into this release.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParkerICI/mantis-viewer/issues/24#issuecomment-613782265, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJB47L3XJF6BDLCHZWK74TRMUNDPANCNFSM4MDHZ6OQ .

rj3d commented 4 years ago

@ngreenwald just published a pre-release that has the threshold set to 10.3k!

https://github.com/ParkerICI/mantis-viewer/releases/tag/v1.1.0-alpha.1

ngreenwald commented 4 years ago

Hey Rob, thanks for the lightning fast turnaround!

Did the file format specifications change? I can't seem to load an image set. If I try the attached (unstitched) folder that I've used in the past, nothing happens after selecting it. Is it expecting some metadata now? 16_31773_4_8.zip

rj3d commented 4 years ago

Nope! Good catch, I introduced a bug that broke loading individual image sets (but not projects). Just pushed a new build that fixes that.

https://github.com/ParkerICI/mantis-viewer/releases/tag/v1.1.0-alpha.2

Thanks for the example dataset! It helped!

ngreenwald commented 4 years ago

I told you we were going to cause problems

rj3d commented 4 years ago

Haha they're fun problems to have!