Thanks for the answer! In fact, I was just about to post something concerning exactly the interplay of cellImg, Bdv and caching
Namely the following; tested with this file: T0006.ome.tif.zip (599.5 KB)
public < T extends RealType< T > & NativeType< T > >
void testBDVandSCIFIO(String path)
// Test SCIFIO cellImg with BDV
ImgOpener imgOpener = new ImgOpener();
// Open as ArrayImg
java.util.List<SCIFIOImgPlus<?>> imgs = imgOpener.openImgs( path );
Img<T> img = (Img<T>) imgs.get(0);
BdvSource bdv = BdvFunctions.show(img, "RAM");
// Open as CellImg
SCIFIOConfig config = new SCIFIOConfig();
config.imgOpenerSetImgModes( SCIFIOConfig.ImgMode.CELL );
java.util.List<SCIFIOImgPlus<?>> cellImgs = imgOpener.openImgs( path, config );
Img<T> cellImg = (Img<T>) cellImgs.get(0);
BdvSource bdv2 = BdvFunctions.show(cellImg, "STREAM");
First of all it is awesome that all of that works! Thanks for all the efforts!
1.) First question is of course whether above code is correct or whether I am doing something stupid? It runs, but maybe I still do something sub-optimal?
Anyway, with above code, as probably to be expected, the visualization of the cellImg is much slower. To be honest I was a bit surprised as to how slow it is given that it is only 2.8 MB and was stored on SSD in my case.
I was wondering about a really simple caching strategy for the BDV, in pseudo code:
t = timePointToBeDisplayed
if(cellImg(t) fits in RAM):
arrayImgThisTimePoint = cellImg(t).loadAsArrayImg()
Probably super naive, but I think for a long time-series where each time-point is not too big it could help somewhat?!
2.) I just realized that above pseudo code would make no sense if the cellImg itself could be the cache, i.e. hold some parts of the data in RAM (and for others only know how to load them if needed). Can the cellImg be its own cache or do you need another data structure on top?