public class MTBPortHashAccess
extends de.unihalle.informatik.Alida.operator.ALDPortHashAccess
This class implements an interface to access the history database. It yields the only possibility to access the database, direct access is blocked to guarantee database consistency.
Compared to the superclass a special treatment of MiToBo images takes place to ensure proper association of MiToBo images and underlying ImageJ ImagePlus data. Objects are usually registered by their references in the port database, however, in case of MiToBo images and underlying ImagePlus data different object references, i.e. the MTBImage and the ImagePlus, essentially represent the same data in the system. Hence, for history database validity explicit associations need to be established between ImagePlus and MTBImage data.
Database consistency is ensured by introducing a specialized data type
which is the MTBHistoryImageBox
. If a MTBImage is fed into an
operator as parameter the first time, a corresponding image box is created
and registered in the local hash.
Lateron, when the ImagePlus object linked to the MTBImage is directly
used as parameter, the MiToBo images within all boxes are searched to find
the corresponding MTBImage. Then the history port associated with the
box is updated, ensuring history consistency and at the same time
proper association of the ImagePlus with the formerly known MTBImage.
In case of using an ImagePlus as parameter that has not been seen before, the same mechanism is applied. First an image box is initialized for the new ImagePlus. When at a later point in time the MTBImage is used as parameter which is associated to the formerly seen ImagePlus, the association is explicitly established by linking the MTBImage to the box and updating the history port of the box accordingly.
Modifier and Type | Class and Description |
---|---|
private static class |
MTBPortHashAccess.MTBHistoryImageBox
Database object boxing ImagePlus and MTBImage.
|
Modifier and Type | Field and Description |
---|---|
private static WeakHashMap<ij.ImagePlus,MTBPortHashAccess.MTBHistoryImageBox> |
boxLinksImagePlus
Associative list for links between ImagePlus and associated image boxes.
|
private static WeakHashMap<MTBImage,MTBPortHashAccess.MTBHistoryImageBox> |
boxLinksMTBImage
Associative list for links between MTBImages and associated image boxes.
|
static String |
MPH_EXTENSION
Default extension of MiToBo processing history file.
|
private static boolean |
verbose
If true, verbose outputs are written to standard output.
|
Modifier | Constructor and Description |
---|---|
protected |
MTBPortHashAccess()
Constructor without function.
|
Modifier and Type | Method and Description |
---|---|
protected de.unihalle.informatik.Alida.operator.ALDPort |
getHistoryLink(Object obj)
Gets the port to which the object is currently linked in history.
|
private static MTBPortHashAccess.MTBHistoryImageBox |
getImageBox(Object obj)
Gets the image container associated with the given image object.
|
protected boolean |
isRegistered(Object obj)
Checks if an object is registered in the database.
|
private static boolean |
isRegisteredImageBox(Object obj)
Checks if the given image object is already registered.
|
protected void |
register(Object obj)
Registers the object to the database.
|
private void |
registerImageBox(Object obj)
Registers the given (image) object.
|
protected void |
setHistoryLink(Object obj,
de.unihalle.informatik.Alida.operator.ALDPort port)
Sets the port to which the object is to be linked in history.
|
private static boolean verbose
public static final String MPH_EXTENSION
private static WeakHashMap<MTBImage,MTBPortHashAccess.MTBHistoryImageBox> boxLinksMTBImage
The hash provides fast access to stored image boxes by keeping track of all included MiToBo images as keys in the map.
private static WeakHashMap<ij.ImagePlus,MTBPortHashAccess.MTBHistoryImageBox> boxLinksImagePlus
The hash provides fast access to stored image boxes by keeoing track of all included ImagePlus images as keys in the map.
protected MTBPortHashAccess()
Note that there will be only one processing history per session and not many different objects of this type.
protected boolean isRegistered(Object obj)
isRegistered
in class de.unihalle.informatik.Alida.operator.ALDPortHashAccess
obj
- Object to check.protected void register(Object obj)
register
in class de.unihalle.informatik.Alida.operator.ALDPortHashAccess
obj
- Object to register.protected de.unihalle.informatik.Alida.operator.ALDPort getHistoryLink(Object obj)
getHistoryLink
in class de.unihalle.informatik.Alida.operator.ALDPortHashAccess
protected void setHistoryLink(Object obj, de.unihalle.informatik.Alida.operator.ALDPort port)
setHistoryLink
in class de.unihalle.informatik.Alida.operator.ALDPortHashAccess
port
- New port the data object is to be linked to.private static boolean isRegisteredImageBox(Object obj)
An image is registered if a corresponding image container exists.
obj
- Image object in question.private void registerImageBox(Object obj)
Image objects are treated in a special way as different physical objects may relate to the same logical object. In particular, images are boxed in containers where each container keeps track of a pair of MTBImage/ImagePlus objects.
obj
- Object to register.private static MTBPortHashAccess.MTBHistoryImageBox getImageBox(Object obj)
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.