mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
29 stars 12 forks source link

cannot serialize org.embl.mobie.lib.bdv.MobieBdvSupplier; #1097

Closed tischi closed 4 months ago

tischi commented 5 months ago

Hi @nicokiaru,

The below error happens during the build and can be resolved with mvn clean compile.

However, while this used to happen sporadically, it now happens almost every 2nd build and is really annoying.

Do you have any idea how to fix this more robustly?

Exception in thread "main" com.google.gson.JsonParseException: cannot serialize org.embl.mobie.lib.bdv.MobieBdvSupplier; did you forget to register a subtype?
    at sc.fiji.persist.RuntimeTypeAdapterFactory$1.write(RuntimeTypeAdapterFactory.java:331)
    at com.google.gson.TypeAdapter$1.write(TypeAdapter.java:196)
    at com.google.gson.Gson.toJson(Gson.java:842)
    at com.google.gson.Gson.toJson(Gson.java:812)
    at com.google.gson.Gson.toJson(Gson.java:759)
    at sc.fiji.bdvpg.scijava.services.SourceAndConverterBdvDisplayService.setDefaultBdvSupplier(SourceAndConverterBdvDisplayService.java:133)
    at org.embl.mobie.lib.bdv.view.SliceViewer.createBdv(SliceViewer.java:215)
    at org.embl.mobie.lib.bdv.view.SliceViewer.getBdvHandle(SliceViewer.java:121)
    at org.embl.mobie.lib.bdv.view.SliceViewer.<init>(SliceViewer.java:94)
    at org.embl.mobie.lib.view.ViewManager.<init>(ViewManager.java:101)
    at org.embl.mobie.MoBIE.buildUI(MoBIE.java:419)
    at org.embl.mobie.MoBIE.initUIandShowView(MoBIE.java:274)
    at org.embl.mobie.MoBIE.openImagesAndLabels(MoBIE.java:223)
    at org.embl.mobie.MoBIE.<init>(MoBIE.java:175)
NicoKiaru commented 5 months ago

Hmmm, maybe you can directly do:

        BdvHandle bdvHandle = new MobieBdvSupplier( sOptions ).getNewBdv();

instead of

https://github.com/mobie/mobie-viewer-fiji/blob/e5959222ee2ceb027ada3cc81917f985f743196b/src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java#L205-L207

tischi commented 5 months ago

Thanks @NicoKiaru, I did something similar and that indeed seems to help!