Coordinate System API
ScanImage® keeps every spatially meaningful quantity - ROIs, scanfields, stage positions,
tiles, photostimulation points, camera images - in an explicit coordinate system, and
converts between coordinate systems through a single tree of transformations.
The classes that implement that tree live in the scanimage.mroi.coordinates package,
and the tree itself is owned by the scanimage.components.CoordinateSystems component,
reachable as hSI.hCoordinateSystems.
Note
For the conceptual background - what Scanner, Reference and Sample space mean optically - read ScanImage® Coordinate Systems first. This section documents the programming interface.
The three pieces of the API are:
a coordinate system (a node in the tree) that knows how to transform points to and from its parent,
a ``Points`` object that bundles a numeric array of coordinates together with the coordinate system it is expressed in, and
the coordinate system instances that ScanImage creates at startup, which is what you will actually name in a script.
% where is the stage, expressed in sample-relative microns?
hPt = hSI.hMotors.getPosition(hSI.hCoordinateSystems.hCSSampleRelative);
disp(hPt.points);
% ... and the same position in reference space (optical degrees / microns)
hPtRef = hPt.transform(hSI.hCoordinateSystems.hCSReference);
% show the whole tree
hSI.hCoordinateSystems.plot();