Issues with Multipage TIFF Datastore
The script below - that should acquire 3 images, and put them in different positions in the datastore - results in the images being saved on disk, but not being retrievable: Only the last image (position) can be found. This is most dramatically illustrated in the viewer: it displays each new image as it is snapped, but at the end, only the last image is present. Setting the intended dimensions in the SUmmary Metadat does not make a difference. I do not understand why/how normal MDA acquisitions work. This problem does not exist in the RAMDatastore (did not test single page TIFF yet). A similar issue exists for channels, time pints and z-positions seem to be handled correctly.
//targetStore = mm.data().createRAMDatastore();
nrPos = 3;
cb = Coordinates.builder().t(0).c(0).p(nrPos + 1).z(0);
c = cb.build();
targetStore.setSummaryMetadata(targetStore.getSummaryMetadata().
copyBuilder().intendedDimensions(c).build());
mm.displays().createDisplay(targetStore);
for (int i = 0; i < nrPos; i++) {
imgs = mm.live().snap(true);
cb.c(0).t(0).z(0).p(i);
img = imgs.get(0).copyAtCoords(cb.build());
targetStore.putImage(img);
Thread.sleep(1000);
}
targetStore.freeze();
mm.scripter().message("Done");
Changing the first line to:
targetStore = mm.data().createMultipageTIFFDatastore("C:\tmp\test", false, false);
makes it work correctly.
Setting the last parameter (split by position) to true, results in only a single position being saved. Setting only the first parameter to true, works correctly.
This is a problem, but regretfully not the problem I was trying to address;)
More elaborate version of the test script:
dirName = "C:\\tmp\\test5";
targetStore = mm.data().createMultipageTIFFDatastore(dirName, false, false);
//targetStore = mm.data().createRAMDatastore();
nrPos = 2;
nrC = 4;
nrT = 2;
nrZ = 1;
cb = Coordinates.builder();
for (int p = 0; p < nrPos; p++) {
for (int c = 0; c < nrC; c++) {
for (int t = 0; t < nrT; t++) {
for (int z = 0; z < nrZ; z++) {
imgs = mm.live().snap(true);
cb.c(c).t(t).z(z).p(p);
img = imgs.get(0).copyAtCoords(cb.build());
targetStore.putImage(img);
}
}
}
Thread.sleep(1000);
}
targetStore.close();
mm.scripter().message("Done");