Skip to content
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

Extend virtual stack implementation also for the XY plane #120

Closed
oeway opened this issue May 31, 2021 · 11 comments
Closed

Extend virtual stack implementation also for the XY plane #120

oeway opened this issue May 31, 2021 · 11 comments

Comments

@oeway
Copy link

oeway commented May 31, 2021

Currently the virtual stack implementation only support lazy loading along the z/t dimension, not XY plane. This make it not feasible to load large images (e.g. histopathology image). And the problem becomes more severe when we try to load remote data, e.g. zarr arrays. We came across this issue when we work with the NGFF/zarr lazy loading support in ImageJ.JS (demo: https://ij.imjoy.io/?open=https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/6001240.zarr)

I just had a discussion with @tischi and we think it would nice if this can be implemented directly in ImageJ-1, it should not be too hard and could serve as a light-weight alternative to the BigDataViewer in ImageJ-2. This will be very beneficial to enable support for large images and multi-resolution pyramid, make it possible to bridge with the ongoing efforts on developing scalable image file format (i.e. NGFF).

I am not super familiar with the code base, but it would be great if someone can look into this, and we would be really appreciate it! @rasband

@rasband
Copy link
Member

rasband commented May 31, 2021

Is there some reason why you can't create a plugin that extends VirtualStack and supports lazy loading of XY planes?

@tischi
Copy link

tischi commented May 31, 2021

@rasband

Sure, extending VirtualStack would be the thing to do.

Could you help us a bit?

Which method is called when the viewer moves to a new plane?
Is it getPixels() or is it getProcessor()?

And how could we notify the viewer (i.e. trigger a repaint) when the slice data (the content of the current processor) changed, due to loading of an additional tile?

@rasband
Copy link
Member

rasband commented May 31, 2021

The getProcessor() method is called when the viewer moves to a new plane. You can trigger a repaint by calling ImagePlus.setProcessor(ImageProcessor).

@tischi
Copy link

tischi commented May 31, 2021

OK, but a VirtualStack does not hold a reference to its ImagePlus, does it?

I had a brief look into VirtualStack and it seems one has to obtain it like this: ImagePlus img = WindowManager.getCurrentImage();
Could this be a bit risky in case there are several images open and the user clicked on another image?

Maybe we could create a VirtualStack that contains a method setImagePlus( ImagePlus imp ) to be sure we are updating the correct ImagePlus?

But anyway, this seems like minor issues, so I guess in principle it should be doable without too much effort, indeed.

@rasband
Copy link
Member

rasband commented May 31, 2021

The extended VirtualStack can hold a reference to the ImagePlus and have a setImagePlus() method.

@tischi
Copy link

tischi commented Jun 1, 2021

@rasband I have another question: In case the image planes become really big (>46340^2) we will run into the 32 bit Java indexing limit for arrays. Is there anything we can do given the current architecture of the ImageProcessor?

@rasband
Copy link
Member

rasband commented Jun 1, 2021

The ImageProcessors created by the extended VirtualStack are for display purposes so they will not be very big.

@ctrueden
Copy link
Member

Since it sounds like there is a solution, I'm closing this issue. But @oeway and @tischi please reopen if you still feel there is some work that needs to be done for this in the ImageJ core.

@oeway
Copy link
Author

oeway commented Dec 10, 2021

@tischi Do you have a chance to look into this? I am coming back to this issue and think it would be really nice to have imagej as an annotation tool for large zarr images hosted remotely. I am also wondering in that case would the ROI also work with the extended virtualstack.

@tischi
Copy link

tischi commented Dec 18, 2021

Hi @oeway Realistically, I won't be able to work on this. Could you maybe find a student with some Java knowledge to work on this? I could help a bit with the supervision.

@dprodanov
Copy link

dprodanov commented Dec 18, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants