Modifier and Type | Class and Description |
---|---|
protected class |
Loader.ImageLoadingLock |
Modifier and Type | Field and Description |
---|---|
static int |
AREA_DOWNSAMPLING |
protected boolean |
changes
Keep track of whether there are any unsaved changes.
|
protected Object |
db_lock |
static int |
DEFAULT_MIPMAPS_MODE
Points to
AREA_DOWNSAMPLING . |
static int |
ERROR_PATH_NOT_FOUND |
static int |
GAUSSIAN |
static IndexColorModel |
GRAY_LUT
Whether incremental garbage collection is enabled.
|
protected Set<Displayable> |
hs_unloadable |
protected Cache |
mawts |
protected int |
MAX_RETRIES |
static long |
MIN_FREE_BYTES
The minimal number of memory bytes that should always be free.
|
static Map<Integer,String> |
MIPMAP_MODES |
protected boolean |
mipmaps_regen
If mipmaps regeneration is enabled or not.
|
static BufferedImage |
NOT_FOUND |
protected ij.io.Opener |
opener |
static int |
PREPROCESSED |
static BufferedImage |
REGENERATING |
protected static Runtime |
RUNTIME |
protected static Vector<Loader> |
v_loaders |
Modifier | Constructor and Description |
---|---|
protected |
Loader() |
Modifier and Type | Method and Description |
---|---|
void |
addCrossLink(long project_id,
long id1,
long id2) |
void |
addedPatchFrom(String path,
Patch patch)
Subclasses can override this method to register the URL of the imported image.
|
void |
addJob(Bureaucrat burro)
Adds a new job to monitor.
|
Patch |
addNewImage(ij.ImagePlus imp) |
Patch |
addNewImage(ij.ImagePlus imp,
double x,
double y)
Mipmaps for this image are generated asynchronously.
|
abstract boolean |
addToDatabase(DBObject ob) |
void |
adjustChannels(Patch p,
int old_channels) |
TemplateThing |
askForXMLTemplate(Project project)
Ask for the user to provide a template XML file to extract a root TemplateThing.
|
void |
cache(Displayable d,
ij.ImagePlus imp)
Add to the cache, or if already there, make it be the last (to be flushed the last).
|
void |
cache(Patch p,
ij.ImagePlus imp) |
void |
cacheAWT(long id,
Image awt) |
void |
cacheImagePlus(long id,
ij.ImagePlus imp)
Cache any ImagePlus, as long as a unique id is assigned to it there won't be problems; use getNextId to obtain a unique id.
|
static boolean |
canReadAndWriteTo(String dir) |
boolean |
checkMipMapFileExists(Patch p,
double magnification)
Does nothing and returns false unless overriden.
|
boolean |
clearIntensityMap(Patch p)
Clear the intensity map coefficients for a patch.
|
void |
commitLargeUpdate() |
static long |
computeDesirableMinFreeBytes()
150 Mb per processor, which is ~2x 67 Mb, the size of a 32-bit 4096x4096 image.
|
protected static long |
countObjects(LayerSet ls) |
<I> ij.ImagePlus |
createFlyThrough(List<? extends Region<I>> regions,
double magnification,
int type,
String dir)
Returns an ImageStack, one slice per region.
|
<I> ij.ImagePlus |
createLazyFlyThrough(List<? extends Region<I>> regions,
double magnification,
int type,
Displayable active)
Each slice is generated on demand, one slice per Region instance.
|
protected InputStream |
createZippedStream(ij.ImagePlus imp)
Returns the ImagePlus as a zipped InputStream of bytes; the InputStream has to be closed by whoever is calling this method.
|
static void |
debug() |
void |
decache(ij.ImagePlus imp)
Throw away all awts that depend on this image, so that they will be recreated next time they are needed.
|
void |
decacheAWT(long id)
Removes from the cache all awt images bond to the given id.
|
void |
decacheImagePlus(long id) |
void |
decacheImagePlus(long[] id) |
boolean |
deleteStaleFiles(boolean coordinate_transforms,
boolean alpha_masks)
Does nothing unless overriden.
|
Object |
deserialize(String path)
Attempts to find a file containing a serialized object.
|
void |
destroy()
Release all memory and unregister itself.
|
static void |
destroyPreloader(ControlWindow master) |
void |
doGUILater(boolean swing,
Runnable fn)
Execute a GUI-related task later, in the event dispatch thread context if @param swing is true.
|
<T> Future<T> |
doLater(Callable<T> fn) |
protected static int[] |
embedAlpha(int[] pix,
byte[] alpha)
Embed the alpha-byte into an int[], changes the int[] in place and returns it
|
protected static int[] |
embedAlpha(int[] pix,
byte[] alpha,
byte[] outside) |
static int[] |
embedAlphaPre(int[] pix,
byte[] alpha,
byte[] outside)
Assumes alpha is never null, but outside may be null.
|
Bureaucrat |
enhanceContrast(Collection<Displayable> patches,
Patch reference)
Homogenize contrast for all patches, optionally using the @param reference Patch (can be null).
|
Bureaucrat |
enhanceContrast(Collection<Layer> layers)
Homogenize contrast layer-wise, for all given layers.
|
protected static boolean |
enoughFreeMemory(long n_bytes)
Measure whether there are at least 'n_bytes' free.
|
long |
estimateImageFileSize(Patch p,
int level) |
protected String |
export(Project project,
File fxml,
XMLOptions options)
Exports the project and its images (optional); if export_images is true, it will be asked for confirmation anyway -beware: for FSLoader, images are not exported since it doesn't own them; only their path.
|
String |
exportImage(Patch patch,
ij.ImagePlus imp,
String path,
boolean overwrite)
Returns the path to the saved image, or null if not saved.
|
String |
exportImage(Patch patch,
String path,
boolean overwrite) |
abstract Area |
fetchArea(long area_list_id,
long layer_id) |
MipMapImage |
fetchAWTImage(Patch p,
int level,
int max_level) |
abstract ArrayList<?> |
fetchBallPoints(long id) |
abstract double[][][] |
fetchBezierArrays(long id) |
MipMapImage |
fetchDataImage(Patch p,
double mag)
Calls fetchImage(p, mag) unless overriden.
|
MipMapImage |
fetchImage(Patch p) |
MipMapImage |
fetchImage(Patch p,
double mag)
Fetch a suitable awt.Image for the given magnification.
|
ij.process.ByteProcessor |
fetchImageMask(Patch p)
Deprecated.
|
abstract ij.ImagePlus |
fetchImagePlus(Patch p) |
ij.ImagePlus |
fetchImagePlus(Stack p) |
ij.process.ImageProcessor |
fetchImageProcessor(Patch p)
Returns null unless overriden.
|
abstract Object[] |
fetchLabel(DLabel label) |
protected MipMapImage |
fetchMipMapAWT(Patch patch,
int level,
long n_bytes)
Does nothing and returns null unless overriden.
|
abstract ij.ImagePlus |
fetchOriginal(Patch patch)
Used for the revert command.
|
abstract ArrayList<?> |
fetchPipePoints(long id) |
static void |
flush(ij.ImagePlus imp)
Workaround for ImageJ's ImagePlus.flush() method which calls the System.gc() unnecessarily.
|
void |
flushMipMaps(boolean forget_dir_mipmaps)
Does nothing unless overriden.
|
void |
flushMipMaps(long id)
Does nothing unless overriden.
|
Bureaucrat |
generateLayerMipMaps(Layer[] la,
int starting_level)
Does nothing unless overriden.
|
Bureaucrat |
generateMipMaps(ArrayList<Displayable> al)
Returns generateMipMaps(al, false).
|
Bureaucrat |
generateMipMaps(ArrayList<Displayable> al,
boolean overwrite)
Does nothing and returns null unless overriden.
|
protected boolean |
generateMipMaps(Patch patch)
Does nothing and returns false unless overriden.
|
String |
getAbsolutePath(Patch patch)
Returns null unless overriden.
|
MipMapImage |
getCached(long id,
int level) |
Image |
getCachedAWT(long id,
int level) |
MipMapImage |
getCachedClosestAboveImage(Patch p,
double mag)
Above or equal in size.
|
MipMapImage |
getCachedClosestBelowImage(Patch p,
double mag)
Below, not equal.
|
ij.ImagePlus |
getCachedImagePlus(long id)
Simply reads from the cache, does no reloading at all.
|
int |
getClosestMipMapLevel(Patch patch,
int level,
int max_level)
Does nothing and returns zero unless overriden.
|
String |
getCoordinateTransformsFolder()
Returns null unless overriden.
|
static long |
getCurrentMemory() |
Dimension |
getDimensions(Patch p) |
static Dimension |
getDimensions(String path)
Read out the width,height of an image using LOCI BioFormats.
|
String |
getFileName(Patch p)
Equivalent to File.getName(), but subtracts the slice info from it if any.
|
Image |
getFlatAWTImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ,
boolean quality,
Color background) |
Image |
getFlatAWTImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ,
boolean quality,
Color background,
Displayable active) |
ij.ImagePlus |
getFlatImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
boolean quality) |
ij.ImagePlus |
getFlatImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ) |
ij.ImagePlus |
getFlatImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ,
boolean quality) |
ij.ImagePlus |
getFlatImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ,
boolean quality,
Color background)
Returns a screenshot of the given layer for the given magnification and srcRect.
|
ij.ImagePlus |
getFlatImage(Layer layer,
Rectangle srcRect_,
double scale,
int c_alphas,
int type,
Class<?> clazz,
List<? extends Displayable> al_displ,
boolean quality,
Color background,
Displayable active) |
ij.ImagePlus |
getFlatImage(Selection selection,
double scale,
int c_alphas,
int type,
boolean quality,
Color background) |
static int |
getHighestMipMapLevel(double size) |
static int |
getHighestMipMapLevel(Patch p)
Returns the highest mipmap level for which a mipmap image may have been generated given the dimensions of the Patch.
|
String |
getImageFilePath(Patch p)
Returns null unless overriden.
|
String |
getImageStorageFolder() |
protected String |
getInternalFileName(Patch p)
Equivalent to File.getName(), does not subtract the slice info from it.
|
JPopupMenu |
getJobsPopup(Display display) |
String |
getMasksFolder()
Returns null unless override.
|
int |
getMipMapFormat()
Does nothing unless overriden.
|
static int |
getMipMapLevel(double mag,
double size)
Transform mag to nearest scale level that delivers an equally sized or larger image.
|
static int |
getMipMapModeIndex(String mode)
Returns the default (
DEFAULT_MIPMAPS_MODE ) if the mode is not recognized. |
static String |
getMipMapModeName(int mode)
Returns the default if
mode is not recognized. |
String |
getMipMapsFolder()
Returns null unless overriden.
|
boolean |
getMipMapsRegenerationEnabled()
Returns the value of mipmaps_regen; to query whether this loader is using mipmaps
or not, call instead
isMipMapsRegenerationEnabled() . |
long |
getNextBlobId()
Returns 0 unless overriden.
|
abstract long |
getNextId()
Retrieve next id from a sequence for a new DBObject to be added.
|
long |
getNextTempId()
Retrieve next id from a sequence for a temporary Object to be added.
|
protected Loader.ImageLoadingLock |
getOrMakeImageLoadingLock(long id,
int level) |
protected Loader.ImageLoadingLock |
getOrMakeImageLoadingLock(String key) |
String |
getParentFolder()
Does nothing unless overriden.
|
String |
getPath(Patch patch)
Returns null unless overriden.
|
protected Map<Long,String> |
getPathsCopy() |
String |
getPreprocessorScriptPath(Patch p) |
String |
getStorageFolder()
Returns the user's home folder unless overriden.
|
String |
getUNUId()
Get the Universal Near-Unique Id for the project hosted by this loader.
|
String |
getUNUIdFolder() |
protected void |
handleCacheError(Throwable t)
Must be called within the context of the db_lock.
|
String |
handlePathlessImage(ij.ImagePlus imp) |
boolean |
hasChanges()
Whether any changes need to be saved.
|
Bureaucrat |
importGrid(Layer layer) |
Bureaucrat |
importGrid(Layer layer,
String dir)
Import a grid of images and put them in the layer.
|
Bureaucrat |
importImage(Layer layer,
double x,
double y,
String path,
boolean synch_mipmap_generation)
Import an image into the given layer, in a separate task thread.
|
Patch |
importImage(Project project,
double x,
double y) |
Patch |
importImage(Project project,
double x,
double y,
String path,
boolean synch_mipmap_generation)
Import a new image at the given coordinates; does not puts it into any layer, unless it's a stack -in which case importStack is called with the current front layer of the given project as target.
|
Bureaucrat |
importImages(Layer ref_layer) |
Bureaucrat |
importImages(Layer ref_layer,
String abs_text_file_path_,
String column_separator_,
double layer_thickness_,
double calibration_,
boolean homogenize_contrast_,
float scale_,
int border_width_)
Import images from the given text file, which is expected to contain 4 columns or optionally 9 columns:
|
Bureaucrat |
importLabelsAsAreaLists(Layer layer) |
Bureaucrat |
importLabelsAsAreaLists(Layer first_layer,
String path_,
double base_x_,
double base_y_,
float alpha_,
boolean add_background_)
If base_x or base_y are Double.MAX_VALUE, then those values are asked for in a GenericDialog.
|
Patch |
importNextImage(Project project,
double x,
double y) |
Bureaucrat |
importSequenceAsGrid(Layer layer) |
Bureaucrat |
importSequenceAsGrid(Layer layer,
String dir) |
Bureaucrat |
importSequenceAsGrid(Layer first_layer,
String dir,
String[] image_file_names)
Import a sequence of images as a grid, and put them in the layer.
|
Bureaucrat |
importStack(Layer first_layer,
double x,
double y,
ij.ImagePlus imp_stack_,
boolean ask_for_data,
String filepath_,
boolean one_patch_per_layer_)
Imports an image stack from a multitiff file and places each slice in the proper layer, creating new layers as it goes.
|
Bureaucrat |
importStack(Layer first_layer,
ij.ImagePlus imp_stack_,
boolean ask_for_data) |
Bureaucrat |
importStack(Layer first_layer,
ij.ImagePlus imp_stack_,
boolean ask_for_data,
String filepath_) |
protected abstract Patch |
importStackAsPatches(Project project,
Layer first_layer,
double x,
double y,
ij.ImagePlus stack,
boolean as_copy,
String filepath) |
protected Patch |
importStackAsPatches(Project project,
Layer first_layer,
ij.ImagePlus stack,
boolean as_copy,
String filepath) |
void |
insertXMLOptions(StringBuilder sb_body,
String indent) |
boolean |
isAsynchronous()
Test whether this Loader needs recurrent calls to a "save" of some sort, such as for the FSLoader.
|
boolean |
isCached(Patch p,
double mag)
Returns true if there is a cached awt image for the given mag and Patch id.
|
boolean |
isImagePlusCached(Patch p) |
boolean |
isMipMapsRegenerationEnabled()
Whether mipmaps should be generated.
|
static boolean |
isSignalImage(Image awt)
Returns true if the awt is a signaling image like NOT_FOUND or REGENERATING.
|
boolean |
isSnapPaintable(long id)
Check if an awt exists to paint as a snap.
|
boolean |
isUnloadable(Displayable p) |
protected void |
makeAllPathsRelativeTo(String xml_path,
Project project) |
Bureaucrat |
makeFlatImage(Layer[] layer,
Rectangle srcRect,
double scale,
int c_alphas,
int type,
boolean force_to_file,
boolean quality) |
Bureaucrat |
makeFlatImage(Layer[] layer,
Rectangle srcRect,
double scale,
int c_alphas,
int type,
boolean force_to_file,
boolean quality,
Color background) |
Bureaucrat |
makeFlatImage(Layer[] layer,
Rectangle srcRect,
double scale,
int c_alphas,
int type,
boolean force_to_file,
String format,
boolean quality,
Color background)
If the srcRect is null, makes a flat 8-bit or RGB image of the entire layer.
|
static IndexColorModel |
makeGrayLut() |
protected String |
makePatchesDir(File fxml) |
Bureaucrat |
makePrescaledTiles(Layer[] layers,
Class<?> clazz,
Rectangle srcRect,
int c_alphas,
int type,
String target_dir,
int strategy,
Saver saver,
int tileSide,
int directory_structure_type,
boolean skip_empty_tiles,
boolean use_layer_indices,
int n_threads) |
String |
makeProjectName() |
String |
makeRelativePath(String path)
Returns @param path unless overriden.
|
protected boolean |
mapIntensities(Patch p,
ij.ImagePlus imp) |
boolean |
markStaleFileForDeletionUponSaving(String path)
Add a file path for removal when the XML is successfully saved.
|
Bureaucrat |
maskBorders(Collection<Displayable> patches,
int left,
int top,
int right,
int bottom)
Make the border have an alpha of zero.
|
ArrayList<Future<?>> |
maskBorders(int left,
int top,
int right,
int bottom,
Collection<Displayable> patches)
Make the border have an alpha of zero.
|
Bureaucrat |
maskBordersLayerWise(Collection<Layer> layers,
int left,
int top,
int right,
int bottom)
Make the border have an alpha of zero.
|
static double |
maxDim(Displayable d) |
static long |
measureSize(ij.ImagePlus imp) |
protected ij.ImagePlus |
openImage(String path)
Fixes paths before presenting them to the file system, in an OS-dependent manner.
|
ij.ImagePlus |
openImagePlus(String path)
Tries up to MAX_RETRIES to open an ImagePlus at path if there is an OutOfMemoryError.
|
ij.ImagePlus |
openStack()
A dialog to open a stack, making sure there is enough memory for it.
|
static void |
preload(Collection<Patch> patches,
double mag,
boolean repaint)
Disabled when on low memory condition, or when num_preloader_threads is smaller than 1.
|
static FutureTask<MipMapImage> |
preload(Patch p,
double mag,
boolean repaint)
Returns null when on low memory condition.
|
protected ij.ImagePlus |
preProcess(Patch p,
ij.ImagePlus imp,
long image_n_bytes) |
void |
printCache() |
static void |
printCaches() |
static void |
printCacheStatus() |
static void |
printMemState() |
void |
queueForMipmapRemoval(Patch p,
boolean yes)
Does nothing unless overriden.
|
void |
quitJob(String name)
Names as generated for popup menu items in the getJobsPopup method.
|
void |
recoverOOME()
Recover from an OutOfMemoryError: release 1/2 of all memory AND execute the garbage collector.
|
void |
recreateBuckets(Collection<Layer> col) |
void |
recreateBuckets(Layer[] la)
Recreate buckets for each Layer, one thread per layer, in as many threads as CPUs.
|
Bureaucrat |
regenerateMipMaps(Collection<? extends Displayable> patches)
Does nothing and returns null unless overriden.
|
Future<Boolean> |
regenerateMipMaps(Patch patch)
Does nothing and returns null unless overriden.
|
void |
releaseAll()
Empties the caches.
|
static void |
releaseAllCaches() |
long |
releaseMemory(long min_free_bytes)
Free up to @param min_free_bytes.
|
protected long |
releaseMemory2()
Deprecated.
|
boolean |
releaseToFit(int width,
int height,
int type,
float factor)
Ensure there is at least width * height * factor * type{8-bit: 1; 16-bit: 3; 32-bit or RGB: 4}
|
boolean |
releaseToFit(long n_bytes)
Release enough memory so that as many bytes as passed as argument can be loaded.
|
boolean |
removeAlphaMask(Patch p)
Deprecated.
|
void |
removeCached(long id)
All levels of the Patch.
|
void |
removeCached(long id,
int level)
Only the indicated level for the given Patch id.
|
boolean |
removeCrossLink(long id1,
long id2)
Remove a link between two objects.
|
abstract boolean |
removeFromDatabase(DBObject ob) |
void |
removeFromUnloadable(Displayable p) |
protected void |
removeImageLoadingLock(Loader.ImageLoadingLock pl) |
void |
removeJob(Bureaucrat burro) |
Future<Boolean> |
removeMipMaps(Patch patch)
Does nothing unless overriden.
|
protected void |
restorePaths(Map<Long,String> copy,
String mipmaps_folder,
String storage_folder) |
void |
rollback() |
String |
save(Project project,
XMLOptions options)
Calls saveAs() unless overriden.
|
String |
saveAs(Project project,
String xmlpath,
XMLOptions options)
Exports to an XML file chosen by the user in a dialog if @param xmlpath is null.
|
String |
saveAs(Project project,
XMLOptions options)
Save the project under a different name by choosing from a dialog, and exporting all images (will popup a YesNoCancelDialog to confirm exporting images.)
|
String |
saveAs(String path,
XMLOptions options)
Meant to be overriden -- as is, will set
options .XMLOptions.export_images to this.getClass() != FSLoader.class. |
Bureaucrat |
saveTask(Project project,
String command)
Run save or saveAs in a Bureaucract that blocks user input to the project being saved.
|
static ij.process.ImageProcessor |
scaleImage(ij.ImagePlus imp,
double mag,
boolean quality) |
static ij.process.ImageProcessor |
scaleImage(ij.ImagePlus imp,
int level,
boolean quality) |
boolean |
serialize(Object ob,
String path)
Serializes the given object into the path.
|
void |
setChanged(boolean changed) |
static void |
setDesirableMinFreeBytes(long n_bytes)
If the number of minimally free memory bytes (100 Mb times the number of CPU cores) is too low for your (giant) images, set it to a larger value here.
|
static void |
setHeapFraction(float fraction) |
String |
setImageFile(Patch p,
ij.ImagePlus imp)
Does nothing and returns null unless overridden.
|
Bureaucrat |
setMinAndMax(Collection<? extends Displayable> patches,
double min,
double max) |
boolean |
setMipMapFormat(int format)
Does nothing unless overriden.
|
void |
setMipMapsRegeneration(boolean b) |
void |
setPreprocessorScriptPath(Patch p,
String path)
Set a preprocessor script that will be executed on the ImagePlus of the Patch when loading it, before TrakEM2 sees it at all.
|
void |
setPreprocessorScriptPathSilently(Patch p,
String path)
Set a preprocessor script that will be executed on the ImagePlus of the Patch when loading it, before TrakEM2 sees it at all.
|
void |
setupMenuItems(JMenu menu,
Project project)
Does nothing unless overriden.
|
static void |
setupPreloader(ControlWindow master)
Uses maximum 4 concurrent threads: higher thread number does not improve performance.
|
static void |
setupPreloaderThreads(int count)
Set to zero to disable; maximum recommended is 4 if you have more than 4 CPUs.
|
void |
startLargeUpdate() |
void |
storeAlphaMask(Patch p,
ij.process.ByteProcessor fp)
Deprecated.
|
void |
tagForMipmapRemoval(Patch p,
boolean yes)
Does nothing unless overriden.
|
protected ij.ImagePlus |
unzipTiff(InputStream i_stream,
String title)
Retrieves a zipped ImagePlus from the given InputStream.
|
abstract boolean |
updateInDatabase(DBObject ob,
Set<String> keys) |
abstract boolean |
updateInDatabase(DBObject ob,
String key) |
Bureaucrat |
updateMipMapsFormat(int old_format,
int new_format)
Does nothing unless overriden.
|
boolean |
usesMipMapsFolder()
Does nothing and returns false unless overriden.
|
void |
writeXMLTo(Project project,
Writer writer,
XMLOptions options)
Write the project as XML.
|
protected final Object db_lock
protected ij.io.Opener opener
protected final int MAX_RETRIES
protected boolean changes
public static final int ERROR_PATH_NOT_FOUND
public static final IndexColorModel GRAY_LUT
protected final Set<Displayable> hs_unloadable
public static final BufferedImage NOT_FOUND
public static final BufferedImage REGENERATING
protected final transient Cache mawts
protected static final Runtime RUNTIME
public static long MIN_FREE_BYTES
public static final int PREPROCESSED
protected boolean mipmaps_regen
public static final int GAUSSIAN
public static final int AREA_DOWNSAMPLING
public static final int DEFAULT_MIPMAPS_MODE
AREA_DOWNSAMPLING
.public static final IndexColorModel makeGrayLut()
public static boolean isSignalImage(Image awt)
public static final void setHeapFraction(float fraction)
public static void debug()
public void destroy()
public abstract long getNextId()
public long getNextTempId()
public TemplateThing askForXMLTemplate(Project project)
public void startLargeUpdate()
public void commitLargeUpdate()
public void rollback()
public abstract double[][][] fetchBezierArrays(long id)
public abstract ArrayList<?> fetchPipePoints(long id)
public abstract ArrayList<?> fetchBallPoints(long id)
public abstract Area fetchArea(long area_list_id, long layer_id)
public abstract boolean addToDatabase(DBObject ob)
public abstract boolean removeFromDatabase(DBObject ob)
public void addCrossLink(long project_id, long id1, long id2)
public boolean removeCrossLink(long id1, long id2)
public void cache(Displayable d, ij.ImagePlus imp)
public void cache(Patch p, ij.ImagePlus imp)
public void cacheImagePlus(long id, ij.ImagePlus imp)
public void decacheImagePlus(long id)
public void decacheImagePlus(long[] id)
protected ij.ImagePlus unzipTiff(InputStream i_stream, String title)
public static final long getCurrentMemory()
protected static final boolean enoughFreeMemory(long n_bytes)
public final boolean releaseToFit(int width, int height, int type, float factor)
public final boolean releaseToFit(long n_bytes)
public static void printCacheStatus()
public void printCache()
public static void printCaches()
public static long computeDesirableMinFreeBytes()
public static void setDesirableMinFreeBytes(long n_bytes)
public static final long measureSize(ij.ImagePlus imp)
public final long releaseMemory(long min_free_bytes)
@Deprecated protected final long releaseMemory2()
public static void releaseAllCaches()
public void releaseAll()
public void decacheAWT(long id)
public Image getCachedAWT(long id, int level)
public void cacheAWT(long id, Image awt)
public static final int getMipMapLevel(double mag, double size)
Requires 0 < mag <= 1.0
Returns -1 if the magnification is NaN or negative or zero.
As explanation:
mag = 1 / Math.pow(2, level)
so that 100% is 0, 50% is 1, 25% is 2, and so on, but represented in values between 0 and 1.
public static final double maxDim(Displayable d)
public boolean isImagePlusCached(Patch p)
public boolean isCached(Patch p, double mag)
public MipMapImage getCached(long id, int level)
public void removeCached(long id, int level)
public void removeCached(long id)
public MipMapImage getCachedClosestAboveImage(Patch p, double mag)
public MipMapImage getCachedClosestBelowImage(Patch p, double mag)
protected final Loader.ImageLoadingLock getOrMakeImageLoadingLock(long id, int level)
protected final Loader.ImageLoadingLock getOrMakeImageLoadingLock(String key)
protected final void removeImageLoadingLock(Loader.ImageLoadingLock pl)
public MipMapImage fetchDataImage(Patch p, double mag)
public MipMapImage fetchImage(Patch p)
public MipMapImage fetchImage(Patch p, double mag)
public final MipMapImage fetchAWTImage(Patch p, int level, int max_level)
@Deprecated public ij.process.ByteProcessor fetchImageMask(Patch p)
Patch.getAlphaMask()
@Deprecated public void storeAlphaMask(Patch p, ij.process.ByteProcessor fp)
Patch.setAlphaMask(ByteProcessor)
@Deprecated public boolean removeAlphaMask(Patch p)
Patch.setAlphaMask(ByteProcessor)
public ij.ImagePlus getCachedImagePlus(long id)
public abstract ij.ImagePlus fetchImagePlus(Patch p)
public ij.process.ImageProcessor fetchImageProcessor(Patch p)
public ij.ImagePlus fetchImagePlus(Stack p)
protected InputStream createZippedStream(ij.ImagePlus imp) throws Exception
Exception
public ij.ImagePlus openStack()
public Bureaucrat importSequenceAsGrid(Layer layer)
public Bureaucrat importSequenceAsGrid(Layer layer, String dir)
public Bureaucrat importSequenceAsGrid(Layer first_layer, String dir, String[] image_file_names)
public Bureaucrat importGrid(Layer layer)
public Bureaucrat importGrid(Layer layer, String dir)
public Bureaucrat importImages(Layer ref_layer)
public Bureaucrat importImages(Layer ref_layer, String abs_text_file_path_, String column_separator_, double layer_thickness_, double calibration_, boolean homogenize_contrast_, float scale_, int border_width_)
Import images from the given text file, which is expected to contain 4 columns or optionally 9 columns:
optional columns, if a property is not known, it can be set to "-" which makes TrakEM2 open the file and find out by itself
This function implements the "Import from text file" command.
Layers will be automatically created as needed inside the LayerSet to which the given ref_layer belongs.
The text file can contain comments that start with the # sign.
Images will be imported in parallel, using as many cores as your machine has.
calibration_
- transforms the read coordinates into pixel coordinates, including x,y,z, and layer thickness.scale_
- Between 0 and 1. When lower than 1, a preprocessor script is created for the imported images, to scale them down.public Bureaucrat importLabelsAsAreaLists(Layer layer)
public Bureaucrat importLabelsAsAreaLists(Layer first_layer, String path_, double base_x_, double base_y_, float alpha_, boolean add_background_)
public void recreateBuckets(Collection<Layer> col)
public void recreateBuckets(Layer[] la)
public abstract ij.ImagePlus fetchOriginal(Patch patch)
public Bureaucrat makeFlatImage(Layer[] layer, Rectangle srcRect, double scale, int c_alphas, int type, boolean force_to_file, boolean quality)
public Bureaucrat makeFlatImage(Layer[] layer, Rectangle srcRect, double scale, int c_alphas, int type, boolean force_to_file, boolean quality, Color background)
public Bureaucrat makeFlatImage(Layer[] layer, Rectangle srcRect, double scale, int c_alphas, int type, boolean force_to_file, String format, boolean quality, Color background)
public ij.ImagePlus getFlatImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, boolean quality)
public ij.ImagePlus getFlatImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ)
public ij.ImagePlus getFlatImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ, boolean quality)
public ij.ImagePlus getFlatImage(Selection selection, double scale, int c_alphas, int type, boolean quality, Color background)
public ij.ImagePlus getFlatImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ, boolean quality, Color background)
al_displ
- The Displayable objects to paint. If null, all those matching Class clazz are included.
If the 'quality' flag is given, then the flat image is created at a scale of 1.0 (if no mipmaps, 2xscale if mipmaps), and later scaled down using the Image.getScaledInstance method with the SCALE_AREA_AVERAGING flag.public ij.ImagePlus getFlatImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ, boolean quality, Color background, Displayable active)
public Image getFlatAWTImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ, boolean quality, Color background)
public Image getFlatAWTImage(Layer layer, Rectangle srcRect_, double scale, int c_alphas, int type, Class<?> clazz, List<? extends Displayable> al_displ, boolean quality, Color background, Displayable active)
layer
- The layer from which to collect visible Displayable instances that intersect the srcRect.srcRect_
- Rectangle in World coordinates representing the field of view to paint into the image, and defines the width and height of the image together with the scale.scale
- Value between 0 and 1.c_alphas
- Which color channels to include when painting Patch instances that hold an RGB image.type
- Either ImagePlus.GRAY8 or ImagePlus.COLOR_RGBclazz
- Include only Displayable instances of this class; use Displayable.class for all.al_displ
- List of Displayable instances to include. Use null to include all visible intersected by srcRect.quality
- Whether to attempt to create a larger image and then scale it down with area averaging for best quality.background
- The color of the areas of the image where no Displayable paints.active
- Whether to paint a particular Displayable instance in an active state (as if it was selected in the UI).public Bureaucrat makePrescaledTiles(Layer[] layers, Class<?> clazz, Rectangle srcRect, int c_alphas, int type, String target_dir, int strategy, Saver saver, int tileSide, int directory_structure_type, boolean skip_empty_tiles, boolean use_layer_indices, int n_threads)
public void addedPatchFrom(String path, Patch patch)
public Bureaucrat importImage(Layer layer, double x, double y, String path, boolean synch_mipmap_generation)
public Patch importImage(Project project, double x, double y, String path, boolean synch_mipmap_generation)
public Bureaucrat importStack(Layer first_layer, ij.ImagePlus imp_stack_, boolean ask_for_data)
public Bureaucrat importStack(Layer first_layer, ij.ImagePlus imp_stack_, boolean ask_for_data, String filepath_)
public Bureaucrat importStack(Layer first_layer, double x, double y, ij.ImagePlus imp_stack_, boolean ask_for_data, String filepath_, boolean one_patch_per_layer_)
public String handlePathlessImage(ij.ImagePlus imp)
protected Patch importStackAsPatches(Project project, Layer first_layer, ij.ImagePlus stack, boolean as_copy, String filepath)
protected abstract Patch importStackAsPatches(Project project, Layer first_layer, double x, double y, ij.ImagePlus stack, boolean as_copy, String filepath)
public final boolean markStaleFileForDeletionUponSaving(String path)
path
- The path to the stale file.protected String export(Project project, File fxml, XMLOptions options)
public void writeXMLTo(Project project, Writer writer, XMLOptions options) throws Exception
project
- writer
- options
- Exception
protected static long countObjects(LayerSet ls)
public String save(Project project, XMLOptions options)
options
- TODOpublic String saveAs(Project project, XMLOptions options)
public String saveAs(Project project, String xmlpath, XMLOptions options)
protected void restorePaths(Map<Long,String> copy, String mipmaps_folder, String storage_folder)
public String saveAs(String path, XMLOptions options)
options
.XMLOptions.export_images
to this.getClass() != FSLoader.class.public String exportImage(Patch patch, ij.ImagePlus imp, String path, boolean overwrite)
public boolean hasChanges()
public void setChanged(boolean changed)
public String getPath(Patch patch)
public String getAbsolutePath(Patch patch)
public String getImageFilePath(Patch p)
public void setupMenuItems(JMenu menu, Project project)
public Bureaucrat saveTask(Project project, String command)
public boolean isAsynchronous()
public void decache(ij.ImagePlus imp)
protected boolean mapIntensities(Patch p, ij.ImagePlus imp)
public boolean clearIntensityMap(Patch p)
p
- protected final ij.ImagePlus preProcess(Patch p, ij.ImagePlus imp, long image_n_bytes)
public void addJob(Bureaucrat burro)
public void removeJob(Bureaucrat burro)
public JPopupMenu getJobsPopup(Display display)
public void quitJob(String name)
public static final void printMemState()
protected final ij.ImagePlus openImage(String path)
public final ij.ImagePlus openImagePlus(String path)
protected final String getInternalFileName(Patch p)
public final String getFileName(Patch p)
public boolean isSnapPaintable(long id)
public void setMipMapsRegeneration(boolean b)
public boolean isMipMapsRegenerationEnabled()
public boolean getMipMapsRegenerationEnabled()
isMipMapsRegenerationEnabled()
.public void flushMipMaps(boolean forget_dir_mipmaps)
public void flushMipMaps(long id)
protected boolean generateMipMaps(Patch patch)
public Bureaucrat generateMipMaps(ArrayList<Displayable> al)
public Bureaucrat generateMipMaps(ArrayList<Displayable> al, boolean overwrite)
public boolean usesMipMapsFolder()
public int getClosestMipMapLevel(Patch patch, int level, int max_level)
protected MipMapImage fetchMipMapAWT(Patch patch, int level, long n_bytes)
public boolean checkMipMapFileExists(Patch p, double magnification)
public void adjustChannels(Patch p, int old_channels)
protected final void handleCacheError(Throwable t)
public static ij.process.ImageProcessor scaleImage(ij.ImagePlus imp, double mag, boolean quality)
public static ij.process.ImageProcessor scaleImage(ij.ImagePlus imp, int level, boolean quality)
public boolean serialize(Object ob, String path)
public Object deserialize(String path)
public void insertXMLOptions(StringBuilder sb_body, String indent)
public Bureaucrat enhanceContrast(Collection<Layer> layers)
public Bureaucrat enhanceContrast(Collection<Displayable> patches, Patch reference)
public Bureaucrat setMinAndMax(Collection<? extends Displayable> patches, double min, double max)
public long estimateImageFileSize(Patch p, int level)
public static final void flush(ij.ImagePlus imp)
A null pointer as argument is accepted.
public String getStorageFolder()
public String getImageStorageFolder()
public String getMipMapsFolder()
public Patch addNewImage(ij.ImagePlus imp)
public Patch addNewImage(ij.ImagePlus imp, double x, double y)
public String makeProjectName()
public static void setupPreloaderThreads(int count)
public static final void setupPreloader(ControlWindow master)
public static final void destroyPreloader(ControlWindow master)
public static void preload(Collection<Patch> patches, double mag, boolean repaint)
public static final FutureTask<MipMapImage> preload(Patch p, double mag, boolean repaint)
public static final int getHighestMipMapLevel(Patch p)
public static final int getHighestMipMapLevel(double size)
public static final String getMipMapModeName(int mode)
mode
is not recognized.public static final int getMipMapModeIndex(String mode)
DEFAULT_MIPMAPS_MODE
) if the mode
is not recognized.public Bureaucrat generateLayerMipMaps(Layer[] la, int starting_level)
public void recoverOOME()
public static boolean canReadAndWriteTo(String dir)
public String setImageFile(Patch p, ij.ImagePlus imp)
public boolean isUnloadable(Displayable p)
public void removeFromUnloadable(Displayable p)
protected static final int[] embedAlpha(int[] pix, byte[] alpha)
protected static final int[] embedAlpha(int[] pix, byte[] alpha, byte[] outside)
public static final int[] embedAlphaPre(int[] pix, byte[] alpha, byte[] outside)
public void queueForMipmapRemoval(Patch p, boolean yes)
public void tagForMipmapRemoval(Patch p, boolean yes)
public String getUNUId()
public String getUNUIdFolder()
public Future<Boolean> regenerateMipMaps(Patch patch)
public Bureaucrat regenerateMipMaps(Collection<? extends Displayable> patches)
public static Dimension getDimensions(String path)
public void setPreprocessorScriptPath(Patch p, String path)
public void setPreprocessorScriptPathSilently(Patch p, String path)
public String getParentFolder()
public void doGUILater(boolean swing, Runnable fn)
public Bureaucrat maskBordersLayerWise(Collection<Layer> layers, int left, int top, int right, int bottom)
public Bureaucrat maskBorders(Collection<Displayable> patches, int left, int top, int right, int bottom)
public ArrayList<Future<?>> maskBorders(int left, int top, int right, int bottom, Collection<Displayable> patches)
public <I> ij.ImagePlus createFlyThrough(List<? extends Region<I>> regions, double magnification, int type, String dir)
public <I> ij.ImagePlus createLazyFlyThrough(List<? extends Region<I>> regions, double magnification, int type, Displayable active)
public boolean setMipMapFormat(int format)
public int getMipMapFormat()
public Bureaucrat updateMipMapsFormat(int old_format, int new_format)
public boolean deleteStaleFiles(boolean coordinate_transforms, boolean alpha_masks)
public String getCoordinateTransformsFolder()
public String getMasksFolder()
public long getNextBlobId()
Copyright © 2015–2021 Fiji. All rights reserved.