mobie / mobie-viewer-fiji

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

Open Project from GitHub with local source selector #1098

Open martinschorb opened 5 months ago

martinschorb commented 5 months ago

Hi,

when I open a project from Github with the preferred source selector pointing to "local" it tries to open the image data from github.

Error opening https://raw.githubusercontent.com/mobie/....ome.zarr

I don't think there is a scenario where sources (other than tables or points) will reside on GH. Could you switch off the loading of image sources from GH and fall back to S3 instead?

tischi commented 5 months ago

I agree, and I had a look and it seems that there is no specific logic nor implementation for opening image data from github directly (see below). Could you please point me to (i) the project and (ii) the exact location in the corresponding dataset.json where the image data is defined?

    static List< ImageDataFormat > remote = new ArrayList< ImageDataFormat >() {
        {
            add( ImageDataFormat.OmeZarrS3 );
            add( ImageDataFormat.BdvOmeZarrS3 );
            add( ImageDataFormat.BdvN5S3 );
            add( ImageDataFormat.OpenOrganelleS3 );
            add( ImageDataFormat.BioFormatsS3 );
        }
    };

    static List< ImageDataFormat > local = new ArrayList< ImageDataFormat >() {
        {
            add( ImageDataFormat.SpimData );
            add( ImageDataFormat.OmeZarr );
            add( ImageDataFormat.BdvOmeZarr );
            add( ImageDataFormat.BdvN5 );
            add( ImageDataFormat.BdvHDF5 );
            add( ImageDataFormat.Toml );
            add( ImageDataFormat.Tiff );
            add( ImageDataFormat.ImageJ );
            add( ImageDataFormat.BioFormats );
            add( ImageDataFormat.Bdv );
            add( ImageDataFormat.IlastikHDF5 );
        }
    };

Also, if you want to open a project from GitHub and use local sources I guess you would need to use Open MoBIE Project Expert Mode... and specify the image root folder in the Image Data Location. But probably that is what you did?!

martinschorb commented 5 months ago

if you want to open a project from GitHub and use local sources I guess you would need to use Open MoBIE Project Expert Mode... and specify the image root folder in the Image Data Location. But probably that is what you did?!

That would be a way to get there, correct.

However, I don't understand why it should be looking for image data on Github at all.

Could you please point me to (i) the project and (ii) the exact location in the corresponding dataset.json where the image data is defined?

This happens when opening any project from GH with the selector set to local.

One recent example would be https://github.com/mobie/environmental-dinoflagellate-atlas

tischi commented 5 months ago

When you tell it to open from "local" it will use the relativePath:

https://github.com/mobie/environmental-dinoflagellate-atlas/blob/a312d1c1e640d8ef46dabb9b0826d152bfe58382/data/2020_AM/dataset.json#L17

and then prepend the directory where the dataset.json is stored, which is GitHub in this case.

Maybe the proper thing may be for MoBIE to throw an error here?!

Opening image data from a GitHub repository is not supported, please use the Expert mode and specify your local image root directory.

martinschorb commented 5 months ago

Do you ever see a use case where it would open image data from GitHub?

Usually, if MoBIE cannot find the image data in the primary location, it would otherwise start looking for the secondary options (S3 etc.). Why not have it behave this way also for the GH location instead of throwing an error?

It's basically a UX question, if you want to punish users that by mistake open a project from GH without actively selecting S3 as data source.

tischi commented 5 months ago

Yes, interesting, something must have changed. I think we used to have a logic that it would automatically use the remote option when opening from GitHub...

I don't know...the default is Remote, so usually it should be fine:

@Plugin(type = Command.class, menuPath = CommandConstants.MOBIE_PLUGIN_OPEN_PROJECT + "Open MoBIE Project..." )
public class OpenMoBIEProjectCommand implements Command
{
    static { net.imagej.patcher.LegacyInjector.preinit(); }

    @Parameter ( label = "Project Location" )
    public String projectLocation = "https://github.com/mobie/platybrowser-datasets";

    @Parameter ( label = "Preferentially Fetch Data From", choices = {"Remote", "Local"} )
    public String location = "Remote";

However, the SciJava Commands remember the most recent choice, so if in-between a user selected Local it would remember this.

I don't know quickly about the best solution, I would have to think a bit longer...