%mavenRepo scijava.public https://maven.scijava.org/content/groups/public
%maven org.scijava:scijava-common:2.97.0
%maven net.imglib2:imglib2:6.2.0
%maven org.janelia.saalfeldlab:n5:3.1.2
%maven org.janelia.saalfeldlab:n5-imglib2:7.0.0
%maven org.janelia.saalfeldlab:n5-universe:1.3.1
In [15]:
In [16]:
import org.janelia.saalfeldlab.n5.*;
import org.janelia.saalfeldlab.n5.universe.*;
In [17]:
// N5Factory can make N5Readers and N5Writers
var factory = new N5Factory();
// trying to open a container does not yet exist will throw an error
// var n5Reader = factory.openReader("my-container.n5");
// creating a writer creates a container at the given location
// if it does not already exist
var n5Writer = factory.openWriter("my-container.n5");
// now we can make a reader
var n5Reader = factory.openReader("my-container.n5");
// test if the container exists
.exists(""); // true n5Reader
true
In [12]:
// "" and "/" both refer to the root of the container
.exists("/"); // true n5Reader
true
In [11]:
.openWriter("my-container.h5").getClass(); // class org.janelia.saalfeldlab.n5.hdf5.N5HDF5Writer
factory.openWriter("my-container.n5").getClass(); // class org.janelia.saalfeldlab.n5.N5FSWriter
factory.openWriter("my-container.zarr").getClass(); // class org.janelia.saalfeldlab.n5.zarr.N5ZarrWriter factory
class org.janelia.saalfeldlab.n5.zarr.N5ZarrWriter
In [1]:
.createGroup("foo");
n5Writer.createGroup("foo/bar");
n5Writer.createGroup("lorum/ipsum/dolor/sit/amet");
n5Writer
.exists("lorum/ipsum"); // true
n5Writer.exists("not/a/real/group"); // false n5Writer
In [2]:
Arrays.toString(n5Writer.list("")); // [lorum, foo]
Arrays.toString(n5Writer.list("foo")); // [bar]
In [3]:
Arrays.toString(n5Writer.deepList(""));
In [4]:
.getAttribute(groupName, attributeName, String.class)
n5Reader
// create a group inside the container (think: "folder")
var groupName = "put-data-in-me";
.createGroup(groupName);
n5Writer
// attributes have names and values
// make an attribute called "date" with a String value
var attributeName = "date";
.setAttribute(groupName, attributeName, "2024-Jan-01");
n5Writer
// get the value of the "date" attribute
.getAttribute(groupName, attributeName, String.class) n5Writer
In [5]:
%%bash
-container.n5 ls my
The line below is causing problems for some reason relating to google cloud dependencies
%maven org.janelia.saalfeldlab:n5-ij:4.0.2