public class LegacyImageMap extends AbstractContextual
ImagePlus
objects and modern
ImageJ ImageDisplay
s. Because every ImagePlus
has a
corresponding ImageWindow
and vice versa, it works out best to
associate each ImagePlus
with a ImageDisplay
rather than with
a Dataset
.
Any Overlay
s present in the ImageDisplay
are translated to a
Roi
attached to the ImagePlus
, and vice versa.
In the case of one Dataset
belonging to multiple ImageDisplay
s, there is a separate ImagePlus
for each ImageDisplay
, with
pixels by reference.
In the case of multiple Dataset
s in a single ImageDisplay
,
only the first Dataset
is translated to the ImagePlus
.
Modifier and Type | Field and Description |
---|---|
static String |
IMP_KEY
Key for storing
ImagePlus instances in a Dataset 's map. |
Constructor and Description |
---|
LegacyImageMap(LegacyService legacyService) |
Modifier and Type | Method and Description |
---|---|
Collection<ImageDisplay> |
getImageDisplays()
Gets a list of
ImageDisplay instances known to this legacy service. |
Collection<ij.ImagePlus> |
getImagePlusInstances()
Gets a list of
ImagePlus instances known to this legacy service. |
ImageDisplay |
lookupDisplay(ij.ImagePlus imp)
Gets the
ImageDisplay corresponding to the given ImagePlus ,
or null if there is no existing table entry. |
ij.ImagePlus |
lookupImagePlus(ImageDisplay display)
Gets the
ImagePlus corresponding to the given ImageDisplay ,
or null if there is no existing table entry. |
ij.ImagePlus |
registerDataset(Dataset ds)
This method takes a provided
Dataset , converts it to an
ImagePlus , stores the new ImagePlus in the Dataset
's properties uner IMP_KEY and finally creates an
ImageDisplay using the provided Dataset . |
ij.ImagePlus |
registerDisplay(ImageDisplay display)
Ensures that the given
ImageDisplay has a corresponding legacy
image. |
ij.ImagePlus |
registerDisplay(ImageDisplay display,
boolean createLegacyMappings)
As
registerDisplay(ImageDisplay) but mappings will go in legacy
maps if createLegacyMappings is true. |
ImageDisplay |
registerLegacyImage(ij.ImagePlus imp)
Ensures that the given legacy image has a corresponding
ImageDisplay . |
void |
toggleLegacyMode(boolean enteringLegacyMode) |
void |
unregisterDisplay(ImageDisplay display)
Removes the mapping associated with the given
ImageDisplay . |
void |
unregisterDisplay(ImageDisplay display,
boolean deleteImp)
As
unregisterDisplay(ImageDisplay) , with an optional toggle to
delete the associated ImagePlus . |
void |
unregisterLegacyImage(ij.ImagePlus imp)
Removes the mapping associated with the given
ImagePlus . |
void |
unregisterLegacyImage(ij.ImagePlus imp,
boolean deleteImp)
As
unregisterLegacyImage(ImagePlus) , with an optional toggle to
delete the given ImagePlus . |
context, getContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setContext
public static final String IMP_KEY
ImagePlus
instances in a Dataset
's map.public LegacyImageMap(LegacyService legacyService)
public ImageDisplay lookupDisplay(ij.ImagePlus imp)
ImageDisplay
corresponding to the given ImagePlus
,
or null if there is no existing table entry.public ij.ImagePlus lookupImagePlus(ImageDisplay display)
ImagePlus
corresponding to the given ImageDisplay
,
or null if there is no existing table entry.public ij.ImagePlus registerDataset(Dataset ds)
Dataset
, converts it to an
ImagePlus
, stores the new ImagePlus
in the Dataset
's properties uner IMP_KEY
and finally creates an
ImageDisplay
using the provided Dataset
. This display will
not be rendered due to the IMP_KEY
mapping. The resulting
ImagePlus
and ImageDisplay
will then be mapped to each
other.
Use this method to create an ImagePlus
to Display
mapping
without rendering the display.
ImagePlus
object shadowing the given Dataset
.public ij.ImagePlus registerDisplay(ImageDisplay display)
ImageDisplay
has a corresponding legacy
image.ImagePlus
object shadowing the given
ImageDisplay
, creating it if necessary using the
ImageTranslator
.public ij.ImagePlus registerDisplay(ImageDisplay display, boolean createLegacyMappings)
registerDisplay(ImageDisplay)
but mappings will go in legacy
maps if createLegacyMappings
is true.public ImageDisplay registerLegacyImage(ij.ImagePlus imp)
ImageDisplay
.ImageDisplay
object shadowing the given
ImagePlus
, creating it if necessary using the
ImageTranslator
.public void toggleLegacyMode(boolean enteringLegacyMode)
public void unregisterDisplay(ImageDisplay display)
ImageDisplay
.public void unregisterLegacyImage(ij.ImagePlus imp)
ImagePlus
.public void unregisterDisplay(ImageDisplay display, boolean deleteImp)
unregisterDisplay(ImageDisplay)
, with an optional toggle to
delete the associated ImagePlus
.public void unregisterLegacyImage(ij.ImagePlus imp, boolean deleteImp)
unregisterLegacyImage(ImagePlus)
, with an optional toggle to
delete the given ImagePlus
.public Collection<ImageDisplay> getImageDisplays()
ImageDisplay
instances known to this legacy service.ImageDisplay
instances linked to legacy
ImagePlus
instances.public Collection<ij.ImagePlus> getImagePlusInstances()
ImagePlus
instances known to this legacy service.ImagePlus
instances linked to
ImageDisplay
instances.Copyright © 2014–2022 ImageJ. All rights reserved.