cdocutils.nodes document q)q}q(U nametypesq}qX1caf api tests: barmarker class and its subclassesqNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhU0caf-api-tests-barmarker-class-and-its-subclassesqsUchildrenq]q(cdocutils.nodes comment q)q}q(U rawsourceqX -*- rest -*-qUparentqhUsourceqcdocutils.nodes reprunicode qX1/home/pmajka/4/doc/sphinx/source/test_markers.rstqq}qbUtagnameqUcommentqU attributesq }q!(U xml:spaceq"Upreserveq#Uidsq$]q%Ubackrefsq&]q'Udupnamesq(]q)Uclassesq*]q+Unamesq,]q-uUlineq.KUdocumentq/hh]q0cdocutils.nodes Text q1X -*- rest -*-q2q3}q4(hUhhubaubh)q5}q6(hXvim:syntax=restq7hhhhhhh }q8(h"h#h$]q9h&]q:h(]q;h*]qh1Xvim:syntax=restq?q@}qA(hUhh5ubaubcdocutils.nodes section qB)qC}qD(hUhhhhhUsectionqEh }qF(h(]qGh*]qHh&]qIh$]qJhah,]qKhauh.Kh/hh]qL(cdocutils.nodes title qM)qN}qO(hX6CAF API tests: ``barMarker`` class and its subclassesqPhhChhhUtitleqQh }qR(h(]qSh*]qTh&]qUh$]qVh,]qWuh.Kh/hh]qX(h1XCAF API tests: qYqZ}q[(hXCAF API tests: q\hhNubcdocutils.nodes literal q])q^}q_(hX ``barMarker``q`h }qa(h(]qbh*]qch&]qdh$]qeh,]qfuhhNh]qgh1X barMarkerqhqi}qj(hUhh^ubahUliteralqkubh1X class and its subclassesqlqm}qn(hX class and its subclassesqohhNubeubcdocutils.nodes paragraph qp)qq}qr(hX0Locating slide in spatial reference system (SRS)qshhChhhU paragraphqth }qu(h(]qvh*]qwh&]qxh$]qyh,]qzuh.Kh/hh]q{h1X0Locating slide in spatial reference system (SRS)q|q}}q~(hhshhqubaubhp)q}q(hXThe last thing to make the CAF slide complete is to locate it in a spatial coordinate system. CAF supports orthogonal, 3-D coordinate systems which seem to cover the majority of SRS used in brain atlases (e.g. Stereotactic coordinate system, the Waxholm Space, Talairach Space). In a CAF dataset infotmation about used SRS and its units of measurements is stored in the CAF index file. Wherever it is possible, link to the INCF DAI SRS is provided offering more precise description of the given SRS.qhhChhhhth }q(h(]qh*]qh&]qh$]qh,]quh.K h/hh]qh1XThe last thing to make the CAF slide complete is to locate it in a spatial coordinate system. CAF supports orthogonal, 3-D coordinate systems which seem to cover the majority of SRS used in brain atlases (e.g. Stereotactic coordinate system, the Waxholm Space, Talairach Space). In a CAF dataset infotmation about used SRS and its units of measurements is stored in the CAF index file. Wherever it is possible, link to the INCF DAI SRS is provided offering more precise description of the given SRS.qq}q(hhhhubaubhp)q}q(hXEach slide contains information about its own location in th SRS. This information is stored within the CAF slide. This information if expressed using two sets of numbers:qhhChhhhth }q(h(]qh*]qh&]qh$]qh,]quh.Kh/hh]qh1XEach slide contains information about its own location in th SRS. This information is stored within the CAF slide. This information if expressed using two sets of numbers:qq}q(hhhhubaubcdocutils.nodes block_quote q)q}q(hUhhChNhU block_quoteqh }q(h(]qh*]qh&]qh$]qh,]quh.Nh/hh]qcdocutils.nodes bullet_list q)q}q(hUh }q(UbulletqX-h$]qh&]qh(]qh*]qh,]quhhh]q(cdocutils.nodes list_item q)q}q(hXwIntra-plane transofrmation allpowith the software to express location of exery point of the slide using SRS coordinatesqh }q(h(]qh*]qh&]qh$]qh,]quhhh]qhp)q}q(hXwIntra-plane transofrmation allpowith the software to express location of exery point of the slide using SRS coordinatesqhhhhhhth }q(h(]qh*]qh&]qh$]qh,]quh.Kh]qh1XwIntra-plane transofrmation allpowith the software to express location of exery point of the slide using SRS coordinatesqąq}q(hhhhubaubahU list_itemqubh)q}q(hX@stack coordinate (coordinate perpendicular to the slide plane). qh }q(h(]qh*]qh&]qh$]qh,]quhhh]qhp)q}q(hX?stack coordinate (coordinate perpendicular to the slide plane).qhhhhhhth }q(h(]qh*]qh&]qh$]qh,]quh.Kh]qh1X?stack coordinate (coordinate perpendicular to the slide plane).q܅q}q(hhhhubaubahhubehU bullet_listqubaubhp)q}q(hXE.g. the first set consists of 4 numbers :math:`(a,b,c,d)` while the second contains only one number (:math:`z`). The formula to convert SVG coordinates into SRS coordinates is following:qhhChhhhth }q(h(]qh*]qh&]qh$]qh,]quh.Kh/hh]q(h1X)E.g. the first set consists of 4 numbers qꅁq}q(hX)E.g. the first set consists of 4 numbers qhhubcsphinx.ext.mathbase math q)q}q(hUh }q(UlatexqX (a,b,c,d)qh$]qh&]qh(]qh*]qh,]quhhh]qhUmathqubh1X, while the second contains only one number (qq}q(hX, while the second contains only one number (qhhubh)q}r(hUh }r(UlatexrXzh$]rh&]rh(]rh*]rh,]ruhhh]rhhubh1XM). The formula to convert SVG coordinates into SRS coordinates is following:r r }r (hXM). The formula to convert SVG coordinates into SRS coordinates is following:r hhubeubcsphinx.ext.mathbase displaymath r )r}r(hUhhChhhU displaymathrh }r(UlatexrX`\left\{\begin{matrix} x' & = & ax + b \\ y' & = & cy + d \\ z' & = & z \\ \end{matrix}\right.rUnowraprh$]rh&]rh(]rh*]rh,]rUdocnamerU test_markersrUlabelrNuh.Kh/hh]rubhp)r}r(hXWWhere (x,y,z) are SVG coordinates while :math:`(x',y',z')` are related SRS coordinates.r hhChhhhth }r!(h(]r"h*]r#h&]r$h$]r%h,]r&uh.K&h/hh]r'(h1X(Where (x,y,z) are SVG coordinates while r(r)}r*(hX(Where (x,y,z) are SVG coordinates while r+hjubh)r,}r-(hUh }r.(Ulatexr/X (x',y',z')r0h$]r1h&]r2h(]r3h*]r4h,]r5uhjh]r6hhubh1X are related SRS coordinates.r7r8}r9(hX are related SRS coordinates.r:hjubeubhp)r;}r<(hXIn the opposite direction:r=hhChhhhth }r>(h(]r?h*]r@h&]rAh$]rBh,]rCuh.K(h/hh]rDh1XIn the opposite direction:rErF}rG(hj=hj;ubaubj )rH}rI(hUhhChhhjh }rJ(jX`\left\{\begin{matrix} x & = & (x' - b)/a \\ y & = & (y' - d)/c \\ z & = & z' \end{matrix}\right.rKjh$]rLh&]rMh(]rNh*]rOh,]rPjjjNuh.K*h/hh]rQubhp)rR}rS(hXEach CAF slide can carry different SVG to SRS coordinates transformation. However, if the purpose of the given dataset is to serve as as source to 3-D model generation this variability is limited and all slides has to carry the same parameters.rThhChhhhth }rU(h(]rVh*]rWh&]rXh$]rYh,]rZuh.K2h/hh]r[h1XEach CAF slide can carry different SVG to SRS coordinates transformation. However, if the purpose of the given dataset is to serve as as source to 3-D model generation this variability is limited and all slides has to carry the same parameters.r\r]}r^(hjThjRubaubhp)r_}r`(hX)Embedding SRS information into CAF slide:rahhChhhhth }rb(h(]rch*]rdh&]reh$]rfh,]rguh.K7h/hh]rhh1X)Embedding SRS information into CAF slide:rirj}rk(hjahj_ubaubhp)rl}rm(hXBMentioned coefficients can be embedded into CAF slide in two ways:rnhhChhhhth }ro(h(]rph*]rqh&]rrh$]rsh,]rtuh.K9h/hh]ruh1XBMentioned coefficients can be embedded into CAF slide in two ways:rvrw}rx(hjnhjlubaubcdocutils.nodes enumerated_list ry)rz}r{(hUhhChhhUenumerated_listr|h }r}(Usuffixr~U.h$]rh&]rh(]rUprefixrUh*]rh,]rUenumtyperUarabicruh.K;h/hh]r(h)r}r(hX&By explicitly defining transformation,rhjzhhhhh }r(h(]rh*]rh&]rh$]rh,]ruh.Nh/hh]rhp)r}r(hjhjhhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.K;h]rh1X&By explicitly defining transformation,rr}r(hjhjubaubaubh)r}r(hXNBy calculating transformation from provided data with the help of ``markers`` rhjzhhhhh }r(h(]rh*]rh&]rh$]rh,]ruh.Nh/hh]rhp)r}r(hXMBy calculating transformation from provided data with the help of ``markers``rhjhhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.K SVG transformation one have to establish three markers. Two in-plane markers and single intra-plane marker.rhhChhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.K>h/hh]rh1XIn order to calculate SRS <=> SVG transformation one have to establish three markers. Two in-plane markers and single intra-plane marker.rr}r(hjhjubaubhp)r}r(hX'Obviously, we need to import bar modulerhhChhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.KBh/hh]rh1X'Obviously, we need to import bar modulerr}r(hjhjubaubcdocutils.nodes literal_block r)r}r(hX>>> import bar >>> m1 = bar.barCoordinateMarker((0,0),(10,10)) >>> m2 = bar.barCoordinateMarker((5,5),(500,500)) >>> bm = bar.barCoronalMarker(6.0, (800, 800))rhhChhhU literal_blockrh }r(U testnodetyperXdoctestrh"h#h$]rh&]rh(]rh*]rh,]rUgroupsr]rUdefaultraUoptionsr}ruh.KDh/hh]rh1X>>> import bar >>> m1 = bar.barCoordinateMarker((0,0),(10,10)) >>> m2 = bar.barCoordinateMarker((5,5),(500,500)) >>> bm = bar.barCoronalMarker(6.0, (800, 800))rr}r(hUhjubaubhp)r}r(hX8Let's display the XML/SVG representation of the markers:rhhChhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.KKh/hh]rh1X8Let's display the XML/SVG representation of the markers:rr}r(hjhjubaubj)r}r(hX>>> print m1 (0.000000,0.000000) >>> print m2 (5.000000,5.000000) >>> print bm Bregma:6.000000rhhChhhjh }r(U testnodetyperXdoctestrh"h#h$]rh&]rh(]rh*]r h,]r Ugroupsr ]r jaj}r uh.KMh/hh]rh1X>>> print m1 (0.000000,0.000000) >>> print m2 (5.000000,5.000000) >>> print bm Bregma:6.000000rr}r(hUhjubaubhp)r}r(hXCreate empty CAF slide and locate it in SRS using created markers. By default, the slide does not contain any infotmation abou its location is spatial coordinate system.rhhChhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.KVh/hh]rh1XCreate empty CAF slide and locate it in SRS using created markers. By default, the slide does not contain any infotmation abou its location is spatial coordinate system.rr}r(hjhjubaubj)r}r (hX3>>> slide = bar.barCafSlide() >>> slide.metadata {}r!hhChhhjh }r"(U testnodetyper#Xdoctestr$h"h#h$]r%h&]r&h(]r'h*]r(h,]r)Ugroupsr*]r+jaj}r,uh.KZh/hh]r-h1X3>>> slide = bar.barCafSlide() >>> slide.metadata {}r.r/}r0(hUhjubaubhp)r1}r2(hXeSVG to SRS transformation can be calucated and put into the slide using methods available in CAF API:r3hhChhhhth }r4(h(]r5h*]r6h&]r7h$]r8h,]r9uh.K`h/hh]r:h1XeSVG to SRS transformation can be calucated and put into the slide using methods available in CAF API:r;r<}r=(hj3hj1ubaubj)r>}r?(hX>>> bar.base.processMarkers(m1,m2,bm) (, )r@hhChhhjh }rA(U testnodetyperBXdoctestrCh"h#h$]rDh&]rEh(]rFh*]rGh,]rHUgroupsrI]rJjaUtestrKX>>> bar.base.processMarkers(m1,m2,bm) #doctest: +ELLIPSIS (, )rLj}rMuh.Kch/hh]rNh1X>>> bar.base.processMarkers(m1,m2,bm) (, )rOrP}rQ(hUhj>ubaubhp)rR}rS(hX'Add indormation about SRS to the slide:rThhChhhhth }rU(h(]rVh*]rWh&]rXh$]rYh,]rZuh.Khh/hh]r[h1X'Add indormation about SRS to the slide:r\r]}r^(hjThjRubaubj)r_}r`(hX;>>> slide.updateMetadata(bar.base.processMarkers(m1,m2,bm))rahhChhhjh }rb(U testnodetypercXdoctestrdh"h#h$]reh&]rfh(]rgh*]rhh,]riUgroupsrj]rkjaj}rluh.Kjh/hh]rmh1X;>>> slide.updateMetadata(bar.base.processMarkers(m1,m2,bm))rnro}rp(hUhj_ubaubhp)rq}rr(hXFrom this moment one can express location on the slide using both, SVG and SRS coordinates. To convert between these coordinates use ``svg2srs((svgx,svgy), ndims = 2)`` method. Where (svgx,svgy) are SVG coordinate system to be converted into spatial coordinates. While ``ndims`` is number of dimensions of returned value (determines if output value will be 2 or 3 dimensional; when ``ndims == 3`` inter-plane coordinate is also included):rshhChhhhth }rt(h(]ruh*]rvh&]rwh$]rxh,]ryuh.Knh/hh]rz(h1XFrom this moment one can express location on the slide using both, SVG and SRS coordinates. To convert between these coordinates use r{r|}r}(hXFrom this moment one can express location on the slide using both, SVG and SRS coordinates. To convert between these coordinates use r~hjqubh])r}r(hX#``svg2srs((svgx,svgy), ndims = 2)``rh }r(h(]rh*]rh&]rh$]rh,]ruhjqh]rh1Xsvg2srs((svgx,svgy), ndims = 2)rr}r(hUhjubahhkubh1Xf method. Where (svgx,svgy) are SVG coordinate system to be converted into spatial coordinates. While rr}r(hXf method. Where (svgx,svgy) are SVG coordinate system to be converted into spatial coordinates. While rhjqubh])r}r(hX ``ndims``rh }r(h(]rh*]rh&]rh$]rh,]ruhjqh]rh1Xndimsrr}r(hUhjubahhkubh1Xh is number of dimensions of returned value (determines if output value will be 2 or 3 dimensional; when rr}r(hXh is number of dimensions of returned value (determines if output value will be 2 or 3 dimensional; when rhjqubh])r}r(hX``ndims == 3``rh }r(h(]rh*]rh&]rh$]rh,]ruhjqh]rh1X ndims == 3rr}r(hUhjubahhkubh1X* inter-plane coordinate is also included):rr}r(hX* inter-plane coordinate is also included):rhjqubeubj)r}r(hX>>> slide.svg2srs((0,0)) (-0.1020408163265306, -0.1020408163265306) >>> slide.svg2srs((30,20), ndims=3) (0.20408163265306117, 0.1020408163265306, 6.0)rhhChhhjh }r(U testnodetyperXdoctestrh"h#h$]rh&]rh(]rh*]rh,]rUgroupsr]rjaj}ruh.Kuh/hh]rh1X>>> slide.svg2srs((0,0)) (-0.1020408163265306, -0.1020408163265306) >>> slide.svg2srs((30,20), ndims=3) (0.20408163265306117, 0.1020408163265306, 6.0)rr}r(hUhjubaubhp)r}r(hXOComposition of ``svg2srs`` and ``srs2svg`` should result in initial coordinate.rhhChhhhth }r(h(]rh*]rh&]rh$]rh,]ruh.K|h/hh]r(h1XComposition of rr}r(hXComposition of rhjubh])r}r(hX ``svg2srs``rh }r(h(]rh*]rh&]rh$]rh,]ruhjh]rh1Xsvg2srsrr}r(hUhjubahhkubh1X and rr}r(hX and rhjubh])r}r(hX ``srs2svg``rh }r(h(]rh*]rh&]rh$]rh,]ruhjh]rh1Xsrs2svgrr}r(hUhjubahhkubh1X% should result in initial coordinate.rr}r(hX% should result in initial coordinate.rhjubeubj)r}r(hX>>> slide.srs2svg(slide.svg2srs((30,20))) (29.999999999999996, 20.0) >>> slide.svg2srs(slide.srs2svg((-1,2))) (-0.99999999999999989, 2.0)rhhChhhjh }r(U testnodetyperXdoctestrh"h#h$]rh&]rh(]rh*]rh,]rUgroupsr]rjaj}ruh.K~h/hh]rh1X>>> slide.srs2svg(slide.svg2srs((30,20))) (29.999999999999996, 20.0) >>> slide.svg2srs(slide.srs2svg((-1,2))) (-0.99999999999999989, 2.0)rr}r(hUhjubaubhp)r}r(hXCFull functionality is preserved after loading and saving the slide:rhhChhhhth }r (h(]r h*]r h&]r h$]r h,]ruh.Kh/hh]rh1XCFull functionality is preserved after loading and saving the slide:rr}r(hjhjubaubj)r}r(hX>>> slide.writeXMLtoFile('test_markers.svg') >>> testSlide = bar.barCafSlide.fromXML('test_markers.svg') >>> testSlide.srs2svg(testSlide.svg2srs((30,20))) (30.0, 20.0) >>> testSlide.svg2srs(testSlide.srs2svg((-1,2))) (-0.99999999999999989, 2.0)rhhChhhjh }r(U testnodetyperXdoctestrh"h#h$]rh&]rh(]rh*]rh,]rUgroupsr]rjaj}r uh.Kh/hh]r!h1X>>> slide.writeXMLtoFile('test_markers.svg') >>> testSlide = bar.barCafSlide.fromXML('test_markers.svg') >>> testSlide.srs2svg(testSlide.svg2srs((30,20))) (30.0, 20.0) >>> testSlide.svg2srs(testSlide.srs2svg((-1,2))) (-0.99999999999999989, 2.0)r"r#}r$(hUhjubaubhp)r%}r&(hX$Just remove all the temporary files.r'hhChhhhth }r((h(]r)h*]r*h&]r+h$]r,h,]r-uh.Kh/hh]r.h1X$Just remove all the temporary files.r/r0}r1(hj'hj%ubaubj)r2}r3(hX/>>> import os >>> os.remove('test_markers.svg')r4hhChhhjh }r5(U testnodetyper6Xdoctestr7h"h#h$]r8h&]r9h(]r:h*]r;h,]r<Ugroupsr=]r>jaj}r?uh.Kh/hh]r@h1X/>>> import os >>> os.remove('test_markers.svg')rArB}rC(hUhj2ubaubeubehUU transformerrDNU footnote_refsrE}rFUrefnamesrG}rHUsymbol_footnotesrI]rJUautofootnote_refsrK]rLUsymbol_footnote_refsrM]rNU citationsrO]rPh/hU current_linerQNUtransform_messagesrR]rSUreporterrTNUid_startrUKU autofootnotesrV]rWU citation_refsrX}rYUindirect_targetsrZ]r[Usettingsr\(cdocutils.frontend Values r]or^}r_(Ufootnote_backlinksr`KUrecord_dependenciesraNU rfc_base_urlrbUhttp://tools.ietf.org/html/rcU tracebackrdUpep_referencesreNUstrip_commentsrfNU toc_backlinksrgUentryrhU language_coderiUenrjU datestamprkNU report_levelrlKU _destinationrmNU halt_levelrnKU strip_classesroNhQNUerror_encoding_error_handlerrpUbackslashreplacerqUdebugrrNUembed_stylesheetrsUoutput_encoding_error_handlerrtUstrictruU sectnum_xformrvKUdump_transformsrwNU docinfo_xformrxKUwarning_streamryNUpep_file_url_templaterzUpep-%04dr{Uexit_status_levelr|KUconfigr}NUstrict_visitorr~NUcloak_email_addressesrUtrim_footnote_reference_spacerUenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformrU source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUANSI_X3.4-1968rU_sourcerU1/home/pmajka/4/doc/sphinx/source/test_markers.rstrUgettext_compactrU generatorrNUdump_internalsrNU pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUshortrUinput_encoding_error_handlerrjuUauto_id_prefixrUidrUdoctitle_xformrUstrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}rhhCsUsubstitution_namesr}rhh/h }r(h(]rh$]rh&]rUsourcerhh*]rh,]ruU footnotesr]rUrefidsr}rub.