public class ProjectTiler extends Object
Constructor and Description |
---|
ProjectTiler() |
Modifier and Type | Method and Description |
---|---|
static Project |
createRetiledSibling(Project srcProject,
String targetDirectory,
int tileWidth,
int tileHeight,
int exportImageType,
boolean onlyVisibleImages,
int nExportThreads,
boolean createMipMaps)
Take a
Project , a size for the image tiles, and a target directory,
and create a new copy of the current project in that folder but with the underlying
images converted to tiles with a translation-only transform (saved as zipped TIFFs,
with extension ".tif.zip"). |
static Iterable<Rectangle> |
tileSequence(Layer srcLayer,
int tileWidth,
int tileHeight,
boolean onlyVisibleImages)
Return a lazy sequence of Rectangle instances, each specifying a tile that contains at least
parts of one Patch.
|
public static final Project createRetiledSibling(Project srcProject, String targetDirectory, int tileWidth, int tileHeight, int exportImageType, boolean onlyVisibleImages, int nExportThreads, boolean createMipMaps) throws Exception
Project
, a size for the image tiles, and a target directory,
and create a new copy of the current project in that folder but with the underlying
images converted to tiles with a translation-only transform (saved as zipped TIFFs,
with extension ".tif.zip").
The new, returned Project
represents the given project but with much
simpler transformations (just translation) for the images and a defined size for
the latter, which helps a lot regarding storage space of the XML (and parsing and
saving time) and performance when browsing layers (keep in mind that, for a 32k x 32k image,
at 100% zoom one would have to load a 32k x 32k image and render just a tiny bit
of it). The copied Project preserves the ID of the Layer
s of the original
Project
, as well as the dimensions; this means the copy is a sibling of
the original, and it is possible to send segmentations from one to the other "as is"
(directly, without having to transform along with the images which would not be possible).
Image files are stored as
The non-image objects of the given project are copied into the new project as well.srcProject
- The project to create a sibling of.targetDirectory
- The directory in which to create all the necessary data and mipmap folders for the new Project.tileWidth
- The width of the tiles to create for the data of the new project.tileHeight
- The height of the tiles.exportImageType
- Any of ImagePlus.GRAY8
, ImagePlus.GRAY16
or ImagePlus.COLOR_RGB
, otherwise an IllegalArgumentException
is thrown.onlyVisibleImages
- Whether to consider visible images only.nExportThreads
- Number of layers to export in parallel. Use a small number when original images are huge (such as larger than 4096 x 4096 pixels).createMipMaps
- Whether to generate the mipmaps when done or not.Exception
- IllegalArgumentException When exportImageType
is not ImagePlus.GRAY16
or ImagePlus.COLOR_RGB
, or when the directory exists and cannot be written to.public static final Iterable<Rectangle> tileSequence(Layer srcLayer, int tileWidth, int tileHeight, boolean onlyVisibleImages)
srcLayer
- tileWidth
- tileHeight
- onlyVisibleImages
- Copyright © 2015–2021 Fiji. All rights reserved.