You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for different file formats to spec #49
Given that the ome.zarr format is progressing (ome/ngff#46) and that we may eventually want to support OpenOrganelle data (cc @bogovicj), I think we should add support for data formats that don't have a bdv.xml representation to the spec.
Currently, we store the data location in the spec like this:
Here, we assume that the values are (relative) file paths that point to a bdv.xml file that in turn contains either the path to a local n5/hdf5 file or the address for the s3 storage.
However, for ome.zarr we don't need an xml file, because all relevant metadata is stored in the zarr attributes. In addition, for data that is stored on s3 (or some other object store), we also don't need to have any corresponding file in the project, but instead need to store the address.
So I would propose to add a new field fileFormat to support this. Initially we would support bdv.xml and we can probably add ome.zarr very soon.
i.e. imageData is a map with different names that map to the storage description for that name.
The question is a bit how we deal with these names then. I think we should not restrict them, but then we somehow need to list the available storage options in MoBIE. So do we need another field in "project.json" for this, so that you know this when initialising the viewer without going through all sources?
final String relativeImagePath = source.imageDataLocations.get( settings.values.getImageDataStorageModality().toString() );
Which, I think we discussed before, could be make more general:
final String relativeImagePath = source.imageData.get( settings.values.getImageDataStore() ).relativePath;
Where source.imageData is the Map that you propose and settings.values.getImageDataStore() is the key to be used for opening the specific instance (getImageDataStorageModality() used to be an enum with only two options: fileSystem and s3).
The question now is where does the user specify which of the image data stores (keys) they want to use.
I don't know if we have to add this to the project.json, because one can figure out all the options also when parsing the specific dataset.json.
Frankly, I don't know exactly, maybe we need to discuss in person.
The question now is where does the user specify which of the image data stores (keys) they want to use.
I don't know if we have to add this to the project.json, because one can figure out all the options also when parsing the specific dataset.json.
Frankly, I don't know exactly, maybe we need to discuss in person
I proposed to put it in the project.json, because it is the first entry point for the MoBIE viewer. But if you would rather have it in the dataset.json that's also fine with me.
But I see that this changes the logic of opening MoBIE projects a bit, because now we don't know a priori which data sources are available, but need to parse some meta-data for it, so the user cannot select this anymore without loading some metadata.
Maybe we can find 5 minutes in the meeting later to discuss this.
I proposed to put it in the project.json, because it is the first entry point for the MoBIE viewer. But if you would rather have it in the dataset.json that's also fine with me.
It's good to have it in the projection.json, but then we have to maintain the same information in two places, which is not ideal...
Alternatively, we could also keep the current logic of using "storage" as key and only allowing a fixed set of keys (currently "fileSystem" and "s3Store"). Then the only change would be that this maps to a map with the format and the source (= either relative path or address, we can still discuss how to actually encode this):
Then we don't need to duplicate the information and know beforehand what options are available (for now "fileSystem" or "s3Store").
The downside is that we don't allow for providing the data via different s3 stores, which would be possible in the other approach.
This means: for "fileSystem" and "gitHub", the "source" is relative to the project directory / repository (which is derived from the entrypoint that the user provides, i.e. either the github repo or the path on the filesystem). For "s3Store", the "source" points to the s3 address. Note that the key only specifies where the 'image entry point' is located, which is different from the actual image data in the case of bdv.xml (it will be the same for ome.zarr though).
For example: {"gitHub":{ "format": "bdv.n5.s3", "source": "images/my_image_gh.xml"}} means that the xml is read from github and the xml contains the information to load the actual image data from s3.
For now, we support the formats "bdv.hdf5", "bdv.n5", "bdv.n5.s3". (Support for open organelle and ome zarr formats should come soon.)
The case for tables is very similar and for now we support the format "tsv". In the future, we may support other formats like databases, see #23. For the current format, "source" always provides the location of the top directory that contains all the table files.
@tischi I will create a branch with an example for this and let you know once it's there.
Somehow I am still confused as to whether we are getting it right...
Also for s3 one could in fact imagine to copy the whole project to a different bucket / institute, and then it would be nice if one would not have to change the JSONs. Thus I wonder whether also the S3 could be relative?
Given above point, everything could be relative and then, currently for the tables, the entries all would identical, blowing up the dataset.json maybe unnecessarily.
n5 and zarr in principle don't care whether they are on a file system or in an object store, that's why maybe we do not need to specify this in the dataset.json in terms of a different "format". The reader could figure out automatically whether it needs to read from S3.
It is confusing now that one can "read an image from gitHub"
Maybe we could rethink this again, forgetting for now that we currently need two different xml, assuming that images are stored as ZARR. And then, maybe just in the java code do something special to navigate to the correct xml, but not explicitly specify both locations in the dataset.json?!
And then, maybe just in the java code do something special to navigate to the correct xml, but not explicitly specify both locations in the dataset.json?!
We could have just two xml next to each other, one ending on .s3.xml. Or we keep the subfolders as we have them, but do not mention them in the dataset.json, but add the subfolder in the Java code, as needed. It would be nice to rename the subfolders to "fileSystem" and "s3" (but I see that this is too much work for the data in object stores).
1. Also for s3 one could in fact imagine to copy the whole project to a different bucket / institute, and then it would be nice if one would not have to change the JSONs. Thus I wonder whether also the S3 could be relative?
This will not work for the following case: read project data from github and access the image data on s3:
In that case we need absolute paths, because the image data locations are not relative to the project root.
3\. n5 and zarr in principle don't care whether they are on a file system or in an object store, that's why maybe we do not need to specify this in the dataset.json in terms of a different "format". The reader could figure out automatically whether it needs to read from S3.
I don't really mind either way, but I like right now that the file format names are the same as used in the bdv xml file,
where we have both bdv.n5 and bdv.n5.s3. For the ome.zarr use case we don't need to introduce it, becuase having the image data on github there also doesn't make sense.
4\. It is confusing now that one can "read an image from gitHub"
But this is the most consistent solution. It specifies where the image data entry point is located.
I don't think it matters so much that it's a bit confusing on the surface. For a normal user this is never visible and for advanced users we can properly document this.
We could have just two xml next to each other, one ending on .s3.xml. Or we keep the subfolders as we have them, but do not mention them in the dataset.json, but add the subfolder in the Java code, as needed. It would be nice to rename the subfolders to "fileSystem" and "s3" (but I see that this is too much work for the data in object stores).
I don't like introducing implicit assumption on the folder structure in the spec again.
Loading images from github requires providing an image data root path.
Depending on the root path the ImageLoader or the S3ImageLoader will be used, from the xml on github
Right?
If we stick to this logic, we could in fact switch to ZARR without needing the voxel size, because we could make an xml with a ZARR image loader, containing the voxel size.
If we now decide to read the xml from GitHub, in terms of Java code, it would be easier for me and stay consistent with the current logic of how the xml work, to, as also proposed at some point, have two xml next to each other (one ending on .s3.xml).
I am thinking now we could in fact also more or less leave it as it was, maybe just cleaning up the xmls, in a sense that we do not have two folders "local" and "remote", but just save them next to each other, with different endings. And then also keep the paths in the s3.xml absolute as we had them, which fixes all sorts of issues.
And the Java code would just pick the correct xml, based on some user choice.
And if we, for now, also use xml to open the ome.zarr we don't need anything, is it? In fact, I just saw that I seem to have the code for opening ome.zarr via xml already, which as mentioned above would also fix the voxel size issue.
And, since we do not urgently need it, we postpone supporting relative s3 paths to a later edition?
Cool, dann koennen wir auch bvd.ome.zarr (with xml) und ome.zarr (without xml) haben 🥳 , which allows us to use the xml for the voxel size as a temporary solution in a relatively clean way.
@tischi overall looks good, but the if is missing two formats: BdvOmeZarrS3 and OpenOrganelleS3.
The else is missing BdvOmeZarr and BdvHdf5 (we still support hdf5 for local files, at least in the spec; if you want we could also remove it).
@tischi
I would suggest this small cosmetic change: mobie/mobie-viewer-fiji#367.
Also, could you make a new MoBIE-beta release with these changes so that I can test the new data formats in the release?
Activity
tischi commentedon Jun 1, 2021
Sounds good!
To be more flexible what about something like this?
constantinpape commentedon Jun 1, 2021
Makes sense, I will update the spec later and create an example project with it.
constantinpape commentedon Jun 1, 2021
@tischi I had another look at your proposal and it's not valid json.
I would suggest the following now:
i.e.
imageDatais a map with different names that map to the storage description for that name.The question is a bit how we deal with these names then. I think we should not restrict them, but then we somehow need to list the available storage options in MoBIE. So do we need another field in "project.json" for this, so that you know this when initialising the viewer without going through all sources?
tischi commentedon Jun 2, 2021
Good question...
In the code it looks like this:
Which, I think we discussed before, could be make more general:
Where
source.imageDatais the Map that you propose andsettings.values.getImageDataStore()is the key to be used for opening the specific instance (getImageDataStorageModality()used to be an enum with only two options: fileSystem and s3).The question now is where does the user specify which of the image data stores (keys) they want to use.
I don't know if we have to add this to the project.json, because one can figure out all the options also when parsing the specific dataset.json.
Frankly, I don't know exactly, maybe we need to discuss in person.
constantinpape commentedon Jun 2, 2021
I proposed to put it in the project.json, because it is the first entry point for the MoBIE viewer. But if you would rather have it in the dataset.json that's also fine with me.
But I see that this changes the logic of opening MoBIE projects a bit, because now we don't know a priori which data sources are available, but need to parse some meta-data for it, so the user cannot select this anymore without loading some metadata.
Maybe we can find 5 minutes in the meeting later to discuss this.
tischi commentedon Jun 2, 2021
It's good to have it in the projection.json, but then we have to maintain the same information in two places, which is not ideal...
constantinpape commentedon Jun 2, 2021
Alternatively, we could also keep the current logic of using "storage" as key and only allowing a fixed set of keys (currently "fileSystem" and "s3Store"). Then the only change would be that this maps to a map with the format and the source (= either relative path or address, we can still discuss how to actually encode this):
Then we don't need to duplicate the information and know beforehand what options are available (for now "fileSystem" or "s3Store").
The downside is that we don't allow for providing the data via different s3 stores, which would be possible in the other approach.
tischi commentedon Jun 2, 2021
I still find the whole logic a bit suboptimal:
Maybe we should also unify what we do for images and tables in terms of specifying the storage location and filetype.
constantinpape commentedon Jun 2, 2021
New idea:
constantinpape commentedon Jun 2, 2021
Ok, to summarise the changes discussed with @tischi:
This means: for "fileSystem" and "gitHub", the "source" is relative to the project directory / repository (which is derived from the entrypoint that the user provides, i.e. either the github repo or the path on the filesystem). For "s3Store", the "source" points to the s3 address. Note that the key only specifies where the 'image entry point' is located, which is different from the actual image data in the case of bdv.xml (it will be the same for ome.zarr though).
For example:
{"gitHub":{ "format": "bdv.n5.s3", "source": "images/my_image_gh.xml"}}means that the xml is read from github and the xml contains the information to load the actual image data from s3.For now, we support the formats "bdv.hdf5", "bdv.n5", "bdv.n5.s3". (Support for open organelle and ome zarr formats should come soon.)
The case for tables is very similar and for now we support the format "tsv". In the future, we may support other formats like databases, see #23. For the current format, "source" always provides the location of the top directory that contains all the table files.
@tischi I will create a branch with an example for this and let you know once it's there.
Edit: changed "github" to "gitHub".
tischi commentedon Jun 2, 2021
I think it should be
gitHub.constantinpape commentedon Jun 2, 2021
@tischi I added an example for the updated spec here:
https://github.com/mobie/arabidopsis-root-lm-datasets/tree/new-data-spec
tischi commentedon Jun 3, 2021
Thanks!
Copying here a part of it.
Somehow I am still confused as to whether we are getting it right...
Maybe we could rethink this again, forgetting for now that we currently need two different xml, assuming that images are stored as ZARR. And then, maybe just in the java code do something special to navigate to the correct xml, but not explicitly specify both locations in the dataset.json?!
tischi commentedon Jun 3, 2021
We could have just two xml next to each other, one ending on
.s3.xml. Or we keep the subfolders as we have them, but do not mention them in the dataset.json, but add the subfolder in the Java code, as needed. It would be nice to rename the subfolders to "fileSystem" and "s3" (but I see that this is too much work for the data in object stores).constantinpape commentedon Jun 4, 2021
This will not work for the following case: read project data from github and access the image data on s3:
In that case we need absolute paths, because the image data locations are not relative to the project root.
I don't really mind either way, but I like right now that the file format names are the same as used in the bdv xml file,
where we have both
bdv.n5andbdv.n5.s3. For the ome.zarr use case we don't need to introduce it, becuase having the image data on github there also doesn't make sense.But this is the most consistent solution. It specifies where the image data entry point is located.
I don't think it matters so much that it's a bit confusing on the surface. For a normal user this is never visible and for advanced users we can properly document this.
I don't like introducing implicit assumption on the folder structure in the spec again.
25 remaining items
tischi commentedon Jun 7, 2021
I think your current proposal would work.
I understand like this:
Right?
If we stick to this logic, we could in fact switch to ZARR without needing the voxel size, because we could make an xml with a ZARR image loader, containing the voxel size.
If we now decide to read the xml from GitHub, in terms of Java code, it would be easier for me and stay consistent with the current logic of how the xml work, to, as also proposed at some point, have two xml next to each other (one ending on .s3.xml).
tischi commentedon Jun 7, 2021
I am thinking now we could in fact also more or less leave it as it was, maybe just cleaning up the xmls, in a sense that we do not have two folders "local" and "remote", but just save them next to each other, with different endings. And then also keep the paths in the s3.xml absolute as we had them, which fixes all sorts of issues.
And the Java code would just pick the correct xml, based on some user choice.
And if we, for now, also use xml to open the ome.zarr we don't need anything, is it? In fact, I just saw that I seem to have the code for opening ome.zarr via xml already, which as mentioned above would also fix the voxel size issue.
And, since we do not urgently need it, we postpone supporting relative s3 paths to a later edition?
constantinpape commentedon Jun 7, 2021
constantinpape commentedon Jun 7, 2021
constantinpape commentedon Jun 7, 2021
tischi commentedon Jun 7, 2021
Cool, dann koennen wir auch
bvd.ome.zarr(with xml) undome.zarr(without xml) haben 🥳 , which allows us to use thexmlfor the voxel size as a temporary solution in a relatively clean way.constantinpape commentedon Jun 7, 2021
@tischi project with new data spec is there:
github: https://github.com/mobie/arabidopsis-root-lm-datasets/tree/new-data-spec3
filesystem:
/g/kreshuk/pape/Work/mobie/arabidopsis-root-lm-datasetsconstantinpape commentedon Jun 8, 2021
I converted a couple more projects, we now have:
/g/emcf/pape/plankton-fibsem-project(the data is not on s3 set, so currently can only load from filesystem)constantinpape commentedon Jun 9, 2021
I have updated these repos now to have the new data spec on the
spec-v2branches:tischi commentedon Jul 21, 2021
I could not find the other issue, so I am posting here.
Does that look good for the auto-detection of the storage?
constantinpape commentedon Jul 21, 2021
@tischi overall looks good, but the
ifis missing two formats:BdvOmeZarrS3andOpenOrganelleS3.The
elseis missingBdvOmeZarrandBdvHdf5(we still support hdf5 for local files, at least in the spec; if you want we could also remove it).tischi commentedon Jul 22, 2021
Thanks! Done via mobie/mobie-viewer-fiji@7abaf3b
constantinpape commentedon Jul 22, 2021
@tischi
I would suggest this small cosmetic change: mobie/mobie-viewer-fiji#367.
Also, could you make a new MoBIE-beta release with these changes so that I can test the new data formats in the release?
tischi commentedon Jul 22, 2021
done
done