Home | Trees | Indices | Help |
---|
|
The module provides functions necessary to rescale and align slides to given reference coordinate system by modyfying transformation matrix for topmost g element.
Required input:
Workflow:
Output:
SVG drawing with reference scaling and offsets. Please note that scaling can be either positive and negative. When scaling is positive it means that stereotaxic axis has the same direction as image axis. When scaling is negative stereotaxic and image axes are oriented in opposite directions. Be very careful in sych case.
Import Graph |
|
|||
|
|||
|
|||
|
|||
str
|
|
||
|
|
|||
__package__ =
|
|||
api_version = 1013
|
|||
argv =
|
|||
builtin_module_names =
|
|||
byteorder =
|
|||
copyright =
|
|||
dont_write_bytecode = False
|
|||
exc_type = None hash(x) |
|||
exec_prefix =
|
|||
executable =
|
|||
flags = sys.flags(debug=0, py3k_warning=0, division_warning=0,
|
|||
float_info = sys.floatinfo(max=1.7976931348623157e+308, max_ex
|
|||
hexversion = 33949168
|
|||
maxint = 9223372036854775807
|
|||
maxsize = 9223372036854775807
|
|||
maxunicode = 1114111
|
|||
meta_path =
|
|||
modules =
|
|||
path =
|
|||
path_hooks =
|
|||
path_importer_cache =
|
|||
platform =
|
|||
prefix =
|
|||
py3kwarning = False
|
|||
pydebug = False
|
|||
stderr = <epydoc.docintrospecter._DevNull instance at 0x2685f38>
|
|||
stdin = <epydoc.docintrospecter._DevNull instance at 0x2685f38>
|
|||
stdout = <epydoc.docintrospecter._DevNull instance at 0x2685f38>
|
|||
subversion =
|
|||
version =
|
|||
version_info =
|
|||
warnoptions =
|
|
Function that manages aligning process. Should be invoked from outside
the class with SVG document as an argument. Modifies
|
Extracts stereotaxic coordinate matrix from given SVG drawing
metadata. It is assumed that in whole file there is only one tag named
\mathbf{M}_c= \begin{pmatrix} s_x & 0 & t_x \\ 0 & s_y & t_y \\ 0 & 0 & 1 \end{pmatrix} http://latex.codecogs.com/gif.latex?M=\begin{pmatrix}&space;s_x&space;&&space;0&space;&&space;t_x&space;\\&space;0&space;&&space;s_y&space;&&space;t_y&space;\\&space;0&space;&&space;0&space;&&space;1&space;\end{pmatrix}
|
Calculates corretions for SVG drawing. Correction includes both: scaling and translation:
And few remarks (just to remain clear): Multiplication vector x by matrix M means going from image coordinate system to stereotaxic coordinate system. Multiplication stereotaxic vector y by M^{-1} means switching from stereotaxic coordiante system to image coortdiante system. Calcucating -1.(Mcorr.M) means:
We use multiplication by inverted M because image is still in untransformed coordinate system. Corrections are calculated in following way: \begin{matrix} c_x & = & t_x - t_{x_{ref}} \\ c_y & = & t_y - t_{y_{ref}} \\ c_{s_x} & = & \frac{s_{x_{ref}}}{s_x}\\ c_{s_y} & = & \frac{s_{y_{ref}}}{s_y}\\ \end{matrix}\right. And then \mathbf{M}_c= \begin{pmatrix} \frac{s_{x_{ref}}}{s_x} & 0 & t_x - t_{x_{ref}} \\ 0 & \frac{s_{y_{ref}}}{s_y} & t_y - t_{y_{ref}} \\ 0 & 0 & 1 \end{pmatrix} The final correction is calculated using following formula: \begin{pmatrix} \frac{s_{x_{ref}}}{s_x} & 0 & \frac{s_{x_{ref}} t_x - s_x t_{x_{ref}}}{{s_x}^{2}} \\ 0 & \frac{s_{y_{ref}}}{s_y} & \frac{s_{y_{ref}}t_y - s_y t_{y_{ref}}}{{s_y}^{2}}\\ 0 & 0 & 1 \end{pmatrix}
|
Applies alignmetnt calculated by calculateAlignmentMatrix function and updates SVG 3dBAR metedata element:
|
|
builtin_module_names
|
copyright
|
flags
|
float_info
|
modules
|
path
|
path_importer_cache
|
version
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Mar 20 14:31:34 2013 | http://epydoc.sourceforge.net |