Quantcast

Failure to load MM datasets in MATLAB with DefaultDataManager

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Failure to load MM datasets in MATLAB with DefaultDataManager

Kyle Douglass

​Hi everyone,


I would like to load a stack of images that I acquired in MM 2.0 into a Datastore using MATLAB. To do this, I first create an instance of a DefaultDataManager object using MATLAB's javaObject command and then call its loadData() method. Unfortunately, for some image stacks it returns a Java Null Pointer exception:


>> dm = javaObject('org.micromanager.data.internal.DefaultDataManager');
>> dm.loadData('z_stack_test_3', false);
Java exception occurred:
java.lang.NullPointerException
at org.micromanager.data.internal.DefaultSummaryMetadata.legacyFromJSON(DefaultSummaryMetadata.java:622)
at org.micromanager.data.internal.multipagetiff.MultipageTiffReader.<init>(MultipageTiffReader.java:127)
at org.micromanager.data.internal.multipagetiff.StorageMultipageTiff.loadFile(StorageMultipageTiff.java:232)
at org.micromanager.data.internal.multipagetiff.StorageMultipageTiff.openExistingDataSet(StorageMultipageTiff.java:205)
at org.micromanager.data.internal.multipagetiff.StorageMultipageTiff.<init>(StorageMultipageTiff.java:146)
at org.micromanager.data.internal.multipagetiff.StorageMultipageTiff.<init>(StorageMultipageTiff.java:107)
at org.micromanager.data.internal.DefaultDataManager.loadData(DefaultDataManager.java:167)

However, the equivalent steps in Beanshell work without raising any exceptions:

bsh % file = "L:\\Z-Stacks\\z_stack_test_3";
<L:\Z-Stacks\z_stack_test_3>
bsh % ds = mm.data().loadData(file, false);
<org.micromanager.data.internal.DefaultDatastore@6096b38e>

Would anyone happen to know what the problem is? My guess is that the MATLAB approach is failing on image stacks that are somehow missing their SummaryMetadata, but that doesn't explain why it works in Beanshell.

I see this behavior in stacks generated from the 64-bit Windows MM 2.0 nightly builds from both January 30, 2017 and April 25, 2017. The problematic stacks are generated with a custom script whose main parts are:

while (curr_slice < number_slices) {
    mmc.snapImage();
    tmp = mmc.getTaggedImage();

    // Convert to Image and update z-coordinate
    image = mm.data().convertTaggedImage(tmp);
    coords = image.getCoords().copy().z(curr_slice).build();
    image = image.copyAtCoords(coords);

    store.putImage(image);

     // Move to the next z-position
     mmc.setRelativePosition(zStep);

     // Update slice and sleep until next iteration
     curr_slice++;
     mmc.sleep(interval);​
}

store.freeze();
store.save(Datastore.SaveMode.MULTIPAGE_TIFF, savePath);


Thanks!
Kyle


Dr. Kyle M. Douglass
Post-doctoral Researcher
EPFL - The Laboratory of Experimental Biophysics
http://leb.epfl.ch/
http://kmdouglass.github.io

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Loading...