This is done through the interface of the LELCoordinates class. It is actually an envelope class which holds letter classes which are the actual implementation of the objects which hold the Lattice CoordinateSystems. Lattice objects have a member function called lelCoordinates. This returns a LELCoordinates object. This object contains a pointer (actually a CountedPtr) of type LELLattCoordBase. This is the base class of the letter classes. For Lattices such as ImageInterface, this pointer actually points at the derived letter class LELImageCoord. This class in turn contains a pointer (a CountedPtr) to the actual CoordinateSystem object.
Note that every time the lelCoordinates function is called,
the LELLattCoord
and LELImageCoord
(or whatever the letter class actually being invoked is)
objects are constructed. For example
the internals of ImageInterface::lelCoordinates are
return LELCoordinates (new LELImageCoord (coords_p));
so that the LELCoordinates constructor invokes the LELImageCoord
constructor with the CoordinateSystem as its argument. However,
the internal use of CountedPtrs makes subsequent constructions inexpensive.
Having a LELCoordinates object in hand, the programmer then has access to the CoordinateSystem that it ultimately contains. This is via the LELCoordinates member function coordinates which returns a reference to the letter base class LELLattCoordBase. For example, if the actual letter class object was LELImageCoord, one has to then cast the reference returned by LELCoordinates::coordinates() to an LELImageCoord. This is because the LELImageCoord class functions that actually deal with the CoordinateSystem are not virtual (otherwise LELLattCoordBase needs to know about Coordinates).
PagedImage<Float> im("myimage"); const LELCoordinates* pLatCoord = &(im.lelCoordinates()); const LELImageCoord* pImCoord = dynamic_cast<const LELImageCoord*>(pLatCoord); CoordinateSystem coords = pImCoord->coordinates();
Construct the object from the given letter class. It takes over the pointer and takes care of destructing the LELLattCoordBase object.
Copy constructor (reference semantics).
Assignment (reference semantics).
Is the coordinates a null object?
Does the class have true coordinates? It returns False if this is a null object.
Check how the coordinates of this and that compare.
The return value tells how they compare.
-1: this is subset
0: equal
1: this is superset
9: invalid (mismatch)
Return the underlying letter object. This should in general not be used, but for specific (Image) cases it might be needed.