Skip to content, Skip to search


ImgLib2 Examples

37 bytes added, 16:09, 14 February 2014
Example 1b - Opening an ImgLib2 image: adjust to current version on GitHub
<source lang="java">
import ij.ImageJ;
import io.scif.config.SCIFIOConfig;
import io.scif.config.SCIFIOConfig.ImgMode;
import io.scif.img.ImgIOException;
import io.scif.img.ImgOpener;
import io.scif.img.ImgOptions;
import io.scif.img.ImgOptions.ImgMode;
// automatically determined. For a small image that fits in memory, this
// should open as an ArrayImg.
Img< T > image = (Img< T >) imgOpener.openImg( path );
// display it via ImgLib using ImageJ image );
// create the ImgOptionsSCIFIOConfig. This gives us configuration control over how
// the ImgOpener will open its datasets.
ImgOptions imgOptions SCIFIOConfig config = new ImgOptionsSCIFIOConfig();
// If we know what type of Img we want, we can encourage their use through
// an ImgOptions SCIFIOConfig instance. CellImgs dynamically load image regions and are
// useful when an image won't fit in memory
imgOptionsconfig.setImgModesimgOpenerSetImgModes( ImgMode.CELL );
// open with ImgOpener as a CellImg
Img< T > imageCell = (Img< T >) imgOpener.openImg( path, imgOptions config );
// display it via ImgLib using ImageJ. The Img type only affects how the
Bureaucrat, incoming, administrator, uploaders