Skip to content, Skip to search


ImgLib2 Examples

150 bytes added, 14:36, 5 December 2013
Updated example 1b to clarify Img type use
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.real.FloatType;
ImgOpener imgOpener = new ImgOpener();
// open with ImgOpener . The type (e.g. ArrayImg, PlanarImg, CellImg) is // automatically determined. For a small image that fits in memory, this // should open as an ArrayImg.
Img< T > image = imgOpener.openImg( path );
ImgOptions imgOptions = new ImgOptions();
// ImgOpener will use its own heuristic for determining If we know what type of Img type to // usewe want, but we can encourage specific types their use through our ImgOptions. // an ImgOptions instance. CellImgs dynamically load image regions and are // useful when an image // won't fit in memory
imgOptions.setImgModes( ImgMode.CELL );
// open with ImgOpener as a CellImg
Img< FloatType T > imageCell = imgOpener.openImg( path, imgOptions );
// display it via ImgLib using ImageJ. The Img type only affects how the // underlying data is accessed, so these images should look identical. imageCell );
Bureaucrat, emailconfirmed, incoming, administrator, uploaders