de.unihalle.informatik.MiToBo.core.operator
Class MTBPortHashAccess.MTBHistoryImageBox

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.core.operator.MTBPortHashAccess.MTBHistoryImageBox
Enclosing class:
MTBPortHashAccess

private static class MTBPortHashAccess.MTBHistoryImageBox
extends java.lang.Object

Database object boxing ImagePlus and MTBImage.

In MiToBo the data type MTBImage most of the time acts like a wrapper for an underlying ImagePlus object. In addition, an object of type ImagePlus is required anyway to display the MTBImage to the user. Currently all changes done to either the MTBImage or the corresponding ImagePlus object trigger changes in the associated object as well.

The MiToBo history tracks operations performed on an object during its lifetime assuming a unique identifier for each object. In case of MTBImage this is not true anymore as the image can be accessed either as MTBImage or as ImagePlus. These are physically two different objects, however, should logically be treated the same. Consequently, the history database needs to explicitly link both objects to each other and treat them internally as one single object.

This class implements a container for a pair of associated images of type MTBImage and ImagePlus. Whenever the database is queried for an object of either of both types, the query is redirected to the associated container object. Each container object owns a unique dataport and a history, if available, i.e. may be treated as any other object in the database.

Author:
moeller

Field Summary
private  java.lang.ref.WeakReference<ij.ImagePlus> imgPlusRef
          ImagePlus object in container.
private  java.lang.ref.WeakReference<MTBImage> mtbImageRef
          MTBImage object in container.
 
Constructor Summary
protected MTBPortHashAccess.MTBHistoryImageBox(ij.ImagePlus i)
          Default constructor for an ImagePlus without linked MTBImage.
protected MTBPortHashAccess.MTBHistoryImageBox(MTBImage m)
          Default constructor for an MTBImage without associated ImagePlus.
protected MTBPortHashAccess.MTBHistoryImageBox(MTBImage m, ij.ImagePlus i)
          Default constructor for an image pair.
 
Method Summary
protected  boolean containsImagePlus()
          Checks if the box contains an ImagePlus.
protected  boolean containsMTBImage()
          Checks if the box contains a MTBImage.
protected  ij.ImagePlus getImagePlus()
          Gets the stored ImagePlus.
protected  MTBImage getMTBImage()
          Gets the stored MTBImage.
protected  void setImagePlus(ij.ImagePlus imp)
          Stores given image to the container.
protected  void setMTBImage(MTBImage mimg)
          Stores given image to the container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imgPlusRef

private java.lang.ref.WeakReference<ij.ImagePlus> imgPlusRef
ImagePlus object in container.


mtbImageRef

private java.lang.ref.WeakReference<MTBImage> mtbImageRef
MTBImage object in container.

Constructor Detail

MTBPortHashAccess.MTBHistoryImageBox

protected MTBPortHashAccess.MTBHistoryImageBox(ij.ImagePlus i)
Default constructor for an ImagePlus without linked MTBImage.

Parameters:
m - MTBImage object.

MTBPortHashAccess.MTBHistoryImageBox

protected MTBPortHashAccess.MTBHistoryImageBox(MTBImage m)
Default constructor for an MTBImage without associated ImagePlus.

Parameters:
m - MTBImage object.

MTBPortHashAccess.MTBHistoryImageBox

protected MTBPortHashAccess.MTBHistoryImageBox(MTBImage m,
                                               ij.ImagePlus i)
Default constructor for an image pair.

Parameters:
m - MTBImage object of the pair.
i - ImagePlus object of the pair.
Method Detail

containsImagePlus

protected boolean containsImagePlus()
Checks if the box contains an ImagePlus.

Returns:
True, if the box contains an image of type ImagePlus.

containsMTBImage

protected boolean containsMTBImage()
Checks if the box contains a MTBImage.

Returns:
True, if the box contains an image of type MTBImage.

getImagePlus

protected ij.ImagePlus getImagePlus()
Gets the stored ImagePlus.

Returns:
Stored ImagePlus, maybe null.

getMTBImage

protected MTBImage getMTBImage()
Gets the stored MTBImage.

Returns:
Stored MTBImage, maybe null.

setImagePlus

protected void setImagePlus(ij.ImagePlus imp)
Stores given image to the container.

Parameters:
mimg - ImagePlus to be stored in container.

setMTBImage

protected void setMTBImage(MTBImage mimg)
Stores given image to the container.

Parameters:
mimg - MTBImage to be stored in container.