€cdocutils.nodes document q)q}q(U nametypesq}q(Xbasics of caf datasetsqNXcreating empty caf slideqNX adding labelsqNXautomatic label generationq NXpath id conventionq NXbasics of caf slideq NX2adding information about spatial coordinate systemq NXputting pieces togeaterq NX&creating delineations of brain regionsqNXcusomizing pathsqNXadditional propertiesqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUbasics-of-caf-datasetsqhUcreating-empty-caf-slideqhU adding-labelsqh Uautomatic-label-generationqh Upath-id-conventionqh Ubasics-of-caf-slideqh U2adding-information-about-spatial-coordinate-systemq h Uputting-pieces-togeaterq!hU&creating-delineations-of-brain-regionsq"hUcusomizing-pathsq#hUadditional-propertiesq$uUchildrenq%]q&cdocutils.nodes section q')q(}q)(U rawsourceq*UUparentq+hUsourceq,cdocutils.nodes reprunicode q-X//home/pmajka/4/doc/sphinx/source/caf_basics.rstq.…q/}q0bUtagnameq1Usectionq2U attributesq3}q4(Udupnamesq5]q6Uclassesq7]q8Ubackrefsq9]q:Uidsq;]qhauUlineq?KUdocumentq@hh%]qA(cdocutils.nodes title qB)qC}qD(h*XBasics of CAF datasetsqEh+h(h,h/h1UtitleqFh3}qG(h5]qHh7]qIh9]qJh;]qKh=]qLuh?Kh@hh%]qMcdocutils.nodes Text qNXBasics of CAF datasetsqO…qP}qQ(h*hEh+hCubaubh')qR}qS(h*Uh+h(h,h/h1h2h3}qT(h5]qUh7]qVh9]qWh;]qXhah=]qYh auh?Kh@hh%]qZ(hB)q[}q\(h*XBasics of CAF slideq]h+hRh,h/h1hFh3}q^(h5]q_h7]q`h9]qah;]qbh=]qcuh?Kh@hh%]qdhNXBasics of CAF slideqe…qf}qg(h*h]h+h[ubaubcdocutils.nodes paragraph qh)qi}qj(h*XHow to create *CAF slide*?qkh+hRh,h/h1U paragraphqlh3}qm(h5]qnh7]qoh9]qph;]qqh=]qruh?Kh@hh%]qs(hNXHow to create qt…qu}qv(h*XHow to create qwh+hiubcdocutils.nodes emphasis qx)qy}qz(h*X *CAF slide*q{h3}q|(h5]q}h7]q~h9]qh;]q€h=]quh+hih%]q‚hNX CAF slideqƒ…q„}q…(h*Uh+hyubah1Uemphasisq†ubhNX?…q‡}qˆ(h*X?h+hiubeubhh)q‰}qŠ(h*X:In order to use CAF API you need to import ``bar`` module:q‹h+hRh,h/h1hlh3}qŒ(h5]qh7]qŽh9]qh;]qh=]q‘uh?K h@hh%]q’(hNX+In order to use CAF API you need to import q“…q”}q•(h*X+In order to use CAF API you need to import q–h+h‰ubcdocutils.nodes literal q—)q˜}q™(h*X``bar``qšh3}q›(h5]qœh7]qh9]qžh;]qŸh=]q uh+h‰h%]q¡hNXbarq¢…q£}q¤(h*Uh+h˜ubah1Uliteralq¥ubhNX module:q¦…q§}q¨(h*X module:q©h+h‰ubeubcdocutils.nodes literal_block qª)q«}q¬(h*X>>> import barq­h+hRh,h/h1U literal_blockq®h3}q¯(U testnodetypeq°Xdoctestq±U xml:spaceq²Upreserveq³h;]q´h9]qµh5]q¶h7]q·h=]q¸Ugroupsq¹]qºUdefaultq»aUoptionsq¼}q½uh?K h@hh%]q¾hNX>>> import barq¿…qÀ}qÁ(h*Uh+h«ubaubh')qÂ}qÃ(h*Uh+hRh,h/h1h2h3}qÄ(h5]qÅh7]qÆh9]qÇh;]qÈhah=]qÉhauh?Kh@hh%]qÊ(hB)qË}qÌ(h*XCreating empty CAF slideqÍh+hÂh,h/h1hFh3}qÎ(h5]qÏh7]qÐh9]qÑh;]qÒh=]qÓuh?Kh@hh%]qÔhNXCreating empty CAF slideqÕ…qÖ}q×(h*hÍh+hËubaubhª)qØ}qÙ(h*X*>>> slide=bar.barCafSlide(slideNumber=0) qÚh+hÂh,h/h1h®h3}qÛ(U testnodetypeqÜXdoctestqÝh²h³h;]qÞh9]qßh5]qàh7]qáh=]qâUgroupsqã]qäh»aUtestqåX=>>> slide=bar.barCafSlide(slideNumber=0) #doctest: +ELLIPSISqæh¼}qçuh?Kh@hh%]qèhNX*>>> slide=bar.barCafSlide(slideNumber=0) qé…qê}që(h*Uh+hØubaubeubh')qì}qí(h*Uh+hRh,h/h1h2h3}qî(h5]qïh7]qðh9]qñh;]qòh"ah=]qóhauh?Kh@hh%]qô(hB)qõ}qö(h*X&Creating delineations of brain regionsq÷h+hìh,h/h1hFh3}qø(h5]qùh7]qúh9]qûh;]qüh=]qýuh?Kh@hh%]qþhNX&Creating delineations of brain regionsqÿ…r}r(h*h÷h+hõubaubhh)r}r(h*X?Note that, by definition, SVG paths representing brain regions are closed paths in sense of `SVG closepath` command and they should be expressed using SVG absolute coordinates. By default API believes that provided paths are valid and does not check their syntax thus following invalid path definition will be accepted:rh+hìh,h/h1hlh3}r(h5]rh7]rh9]rh;]r h=]r uh?Kh@hh%]r (hNX\Note that, by definition, SVG paths representing brain regions are closed paths in sense of r …r }r(h*X\Note that, by definition, SVG paths representing brain regions are closed paths in sense of rh+jubcdocutils.nodes title_reference r)r}r(h*X`SVG closepath`rh3}r(h5]rh7]rh9]rh;]rh=]ruh+jh%]rhNX SVG closepathr…r}r(h*Uh+jubah1Utitle_referencerubhNXÔ command and they should be expressed using SVG absolute coordinates. By default API believes that provided paths are valid and does not check their syntax thus following invalid path definition will be accepted:r…r }r!(h*XÔ command and they should be expressed using SVG absolute coordinates. By default API believes that provided paths are valid and does not check their syntax thus following invalid path definition will be accepted:r"h+jubeubhª)r#}r$(h*XR>>> path=bar.barPath("structure_s1_AA","M 100,100 l 100 200 L 200 200", "#ff0000")r%h+hìh,h/h1h®h3}r&(U testnodetyper'Xdoctestr(h²h³h;]r)h9]r*h5]r+h7]r,h=]r-Ugroupsr.]r/h»ah¼}r0uh?K h@hh%]r1hNXR>>> path=bar.barPath("structure_s1_AA","M 100,100 l 100 200 L 200 200", "#ff0000")r2…r3}r4(h*Uh+j#ubaubhh)r5}r6(h*XŠIn order to force path validation of path definition set ``clearPathDef`` to ``True``. If invalid path is provided an exception is raised.r7h+hìh,h/h1hlh3}r8(h5]r9h7]r:h9]r;h;]r<h=]r=uh?K$h@hh%]r>(hNX9In order to force path validation of path definition set r?…r@}rA(h*X9In order to force path validation of path definition set rBh+j5ubh—)rC}rD(h*X``clearPathDef``rEh3}rF(h5]rGh7]rHh9]rIh;]rJh=]rKuh+j5h%]rLhNX clearPathDefrM…rN}rO(h*Uh+jCubah1h¥ubhNX to rP…rQ}rR(h*X to rSh+j5ubh—)rT}rU(h*X``True``rVh3}rW(h5]rXh7]rYh9]rZh;]r[h=]r\uh+j5h%]r]hNXTruer^…r_}r`(h*Uh+jTubah1h¥ubhNX5. If invalid path is provided an exception is raised.ra…rb}rc(h*X5. If invalid path is provided an exception is raised.rdh+j5ubeubhª)re}rf(h*Xµ>>> path=bar.barPath("structure_s1_AA","M 100,100 L 100 200 L 200 200", "#ff0000", clearPathDef=True) Traceback (most recent call last): ValueError: Invalid path definition providedrgh+hìh,h/h1h®h3}rh(U testnodetyperiXdoctestrjh²h³h;]rkh9]rlh5]rmh7]rnh=]roUgroupsrp]rqh»ah¼}rruh?K'h@hh%]rshNXµ>>> path=bar.barPath("structure_s1_AA","M 100,100 L 100 200 L 200 200", "#ff0000", clearPathDef=True) Traceback (most recent call last): ValueError: Invalid path definition providedrt…ru}rv(h*Uh+jeubaubcdocutils.nodes important rw)rx}ry(h*XzProviding invalid path definitions will surely lead to errors in further steps. If you are not sure about path definition - validate it. >>> path=bar.barPath("structure_s1_AA","M 100,100 L 100 200 L 200 200 Z", "#ff0000", clearPathDef=True) >>> print path rzh+hìh,h/h1U importantr{h3}r|(h5]r}h7]r~h9]rh;]r€h=]ruh?Nh@hh%]r‚(hh)rƒ}r„(h*XˆProviding invalid path definitions will surely lead to errors in further steps. If you are not sure about path definition - validate it.r…h+jxh,h/h1hlh3}r†(h5]r‡h7]rˆh9]r‰h;]rŠh=]r‹uh?K-h%]rŒhNXˆProviding invalid path definitions will surely lead to errors in further steps. If you are not sure about path definition - validate it.r…rŽ}r(h*j…h+jƒubaubcdocutils.nodes doctest_block r)r‘}r’(h*Xð>>> path=bar.barPath("structure_s1_AA","M 100,100 L 100 200 L 200 200 Z", "#ff0000", clearPathDef=True) >>> print path r“h3}r”(h²h³h;]r•h9]r–h5]r—h7]r˜h=]r™uh+jxh%]ršhNXð>>> path=bar.barPath("structure_s1_AA","M 100,100 L 100 200 L 200 200 Z", "#ff0000", clearPathDef=True) >>> print path r›…rœ}r(h*Uh+j‘ubah1U doctest_blockržubeubh')rŸ}r (h*Uh+hìh,h/h1h2h3}r¡(h5]r¢h7]r£h9]r¤h;]r¥hah=]r¦h auh?K5h@hh%]r§hB)r¨}r©(h*XPath id conventionrªh+jŸh,h/h1hFh3}r«(h5]r¬h7]r­h9]r®h;]r¯h=]r°uh?K5h@hh%]r±hNXPath id conventionr²…r³}r´(h*jªh+j¨ubaubaubh')rµ}r¶(h*Uh+hìh,h/h1h2h3}r·(h5]r¸h7]r¹h9]rºh;]r»h$ah=]r¼hauh?K8h@hh%]r½hB)r¾}r¿(h*XAdditional propertiesrÀh+jµh,h/h1hFh3}rÁ(h5]rÂh7]rÃh9]rÄh;]rÅh=]rÆuh?K8h@hh%]rÇhNXAdditional propertiesrÈ…rÉ}rÊ(h*jÀh+j¾ubaubaubh')rË}rÌ(h*Uh+hìh,h/h1h2h3}rÍ(h5]rÎh7]rÏh9]rÐh;]rÑh#ah=]rÒhauh?K;h@hh%]rÓhB)rÔ}rÕ(h*XCusomizing pathsrÖh+jËh,h/h1hFh3}r×(h5]rØh7]rÙh9]rÚh;]rÛh=]rÜuh?K;h@hh%]rÝhNXCusomizing pathsrÞ…rß}rà(h*jÖh+jÔubaubaubeubh')rá}râ(h*Uh+hRh,h/h1h2h3}rã(h5]räh7]råh9]ræh;]rçhah=]rèhauh?K?h@hh%]ré(hB)rê}rë(h*X Adding labelsrìh+jáh,h/h1hFh3}rí(h5]rîh7]rïh9]rðh;]rñh=]ròuh?K?h@hh%]róhNX Adding labelsrô…rõ}rö(h*jìh+jêubaubh')r÷}rø(h*Uh+jáh,h/h1h2h3}rù(h5]rúh7]rûh9]rüh;]rýhah=]rþh auh?KBh@hh%]rÿ(hB)r}r(h*XAutomatic label generationrh+j÷h,h/h1hFh3}r(h5]rh7]rh9]rh;]rh=]ruh?KBh@hh%]r hNXAutomatic label generationr …r }r (h*jh+jubaubhª)r }r(h*XN>>> slide.generateLabels() rh+j÷h,h/h1h®h3}r(U testnodetyperXdoctestrh²h³h;]rh9]rh5]rh7]rh=]rUgroupsr]rh»ahåXa>>> slide.generateLabels() #doctest: +ELLIPSIS rh¼}ruh?KDh@hh%]rhNXN>>> slide.generateLabels() r…r}r(h*Uh+j ubaubeubeubh')r }r!(h*Uh+hRh,h/h1h2h3}r"(h5]r#h7]r$h9]r%h;]r&h ah=]r'h auh?KJh@hh%]r(hB)r)}r*(h*X2Adding information about spatial coordinate systemr+h+j h,h/h1hFh3}r,(h5]r-h7]r.h9]r/h;]r0h=]r1uh?KJh@hh%]r2hNX2Adding information about spatial coordinate systemr3…r4}r5(h*j+h+j)ubaubaubh')r6}r7(h*Uh+hRh,h/h1h2h3}r8(h5]r9h7]r:h9]r;h;]r<h!ah=]r=h auh?KNh@hh%]r>(hB)r?}r@(h*XPutting pieces togeaterrAh+j6h,h/h1hFh3}rB(h5]rCh7]rDh9]rEh;]rFh=]rGuh?KNh@hh%]rHhNXPutting pieces togeaterrI…rJ}rK(h*jAh+j?ubaubhª)rL}rM(h*XŽ>>> import bar >>> import datetime >>> from random import gauss >>> slideRange = range(50) >>> coronalCoords = map(lambda x: 50 - x - gauss(1, 0.25), slideRange) >>> slides = [] >>> indexer = bar.barIndexer() >>> for i in slideRange: ... pathId = "structure_s%02d_AA" % i ... pathDef = "M %d,100 L %d,500 L 500,500 Z" % (100+2*i, 100+2*i) ... path=bar.barPath(pathId, pathDef ,"#ff0000", clearPathDef=True) ... structure = bar.barGenericStructure("AA", "#ff0000", [path]) ... slide=bar.barCafSlide(slideNumber=i) ... slide.addStructures(structure) ... slide.updateMetadata(\ ... [bar.barTransfMatrixMetadataElement((1.0,0,1.0,0)), ... bar.barBregmaMetadataElement(coronalCoords[i])]) ... slide.writeXMLtoFile("%02d_traced_v0.svg" % i) ... indexer.indexSingleSlide(slide, i) >>> indexerProperties = {\ ... 'ReferenceWidth' : str(slide._rendererConf['imageSize'][0]),\ ... 'ReferenceHeight' : str(slide._rendererConf['imageSize'][1]),\ ... 'FilenameTemplate' : '%02d_traced_v%d.svg',\ ... 'RefCords' : "0,0,1.0,1.0",\ ... 'CAFName' : "caf_test",\ ... 'CAFFullName' : 'caf_test_fullname',\ ... 'CAFComment': 'Exemplary CAF dataset',\ ... 'CAFCreator': 'Put your fullname here',\ ... 'CAFCreatorEmail': 'your.email@here.org',\ ... 'CAFCompilationTime': datetime.datetime.utcnow().strftime("%F %T"),\ ... 'CAFAxesOrientation':'RAS',\ ... 'CAFSlideUnits':'mm'} # Set indexer properties >>> indexer.updateProperties(indexerProperties) >>> indexer.createFlatHierarchy() >>> indexer.fullNameMapping = {} >>> indexer.colorMapping = {} >>> indexer.writeXMLtoFile('index.xml')rNh+j6h,h/h1h®h3}rO(U testnodetyperPXdoctestrQh²h³h;]rRh9]rSh5]rTh7]rUh=]rVUgroupsrW]rXh»ah¼}rYuh?KPh@hh%]rZhNXŽ>>> import bar >>> import datetime >>> from random import gauss >>> slideRange = range(50) >>> coronalCoords = map(lambda x: 50 - x - gauss(1, 0.25), slideRange) >>> slides = [] >>> indexer = bar.barIndexer() >>> for i in slideRange: ... pathId = "structure_s%02d_AA" % i ... pathDef = "M %d,100 L %d,500 L 500,500 Z" % (100+2*i, 100+2*i) ... path=bar.barPath(pathId, pathDef ,"#ff0000", clearPathDef=True) ... structure = bar.barGenericStructure("AA", "#ff0000", [path]) ... slide=bar.barCafSlide(slideNumber=i) ... slide.addStructures(structure) ... slide.updateMetadata(\ ... [bar.barTransfMatrixMetadataElement((1.0,0,1.0,0)), ... bar.barBregmaMetadataElement(coronalCoords[i])]) ... slide.writeXMLtoFile("%02d_traced_v0.svg" % i) ... indexer.indexSingleSlide(slide, i) >>> indexerProperties = {\ ... 'ReferenceWidth' : str(slide._rendererConf['imageSize'][0]),\ ... 'ReferenceHeight' : str(slide._rendererConf['imageSize'][1]),\ ... 'FilenameTemplate' : '%02d_traced_v%d.svg',\ ... 'RefCords' : "0,0,1.0,1.0",\ ... 'CAFName' : "caf_test",\ ... 'CAFFullName' : 'caf_test_fullname',\ ... 'CAFComment': 'Exemplary CAF dataset',\ ... 'CAFCreator': 'Put your fullname here',\ ... 'CAFCreatorEmail': 'your.email@here.org',\ ... 'CAFCompilationTime': datetime.datetime.utcnow().strftime("%F %T"),\ ... 'CAFAxesOrientation':'RAS',\ ... 'CAFSlideUnits':'mm'} # Set indexer properties >>> indexer.updateProperties(indexerProperties) >>> indexer.createFlatHierarchy() >>> indexer.fullNameMapping = {} >>> indexer.colorMapping = {} >>> indexer.writeXMLtoFile('index.xml')r[…r\}r](h*Uh+jLubaubhh)r^}r_(h*X5Just remove the temporary file containing test slide.r`h+j6h,h/h1hlh3}ra(h5]rbh7]rch9]rdh;]reh=]rfuh?Kh@hh%]rghNX5Just remove the temporary file containing test slide.rh…ri}rj(h*j`h+j^ubaubhª)rk}rl(h*X3>>> import os >>> os.system("rm -f *.svg *.xml") 0rmh+j6h,h/h1h®h3}rn(U testnodetyperoXdoctestrph²h³h;]rqh9]rrh5]rsh7]rth=]ruUgroupsrv]rwh»ah¼}rxuh?Kh@hh%]ryhNX3>>> import os >>> os.system("rm -f *.svg *.xml") 0rz…r{}r|(h*Uh+jkubaubeubeubeubah*UU transformerr}NU footnote_refsr~}rUrefnamesr€}rUsymbol_footnotesr‚]rƒUautofootnote_refsr„]r…Usymbol_footnote_refsr†]r‡U citationsrˆ]r‰h@hU current_linerŠNUtransform_messagesr‹]rŒUreporterrNUid_startrŽKU autofootnotesr]rU citation_refsr‘}r’Uindirect_targetsr“]r”Usettingsr•(cdocutils.frontend Values r–or—}r˜(Ufootnote_backlinksr™KUrecord_dependenciesršNU rfc_base_urlr›Uhttp://tools.ietf.org/html/rœU tracebackrˆUpep_referencesržNUstrip_commentsrŸNU toc_backlinksr Uentryr¡U language_coder¢Uenr£U datestampr¤NU report_levelr¥KU _destinationr¦NU halt_levelr§KU strip_classesr¨NhFNUerror_encoding_error_handlerr©UbackslashreplacerªUdebugr«NUembed_stylesheetr¬‰Uoutput_encoding_error_handlerr­Ustrictr®U sectnum_xformr¯KUdump_transformsr°NU docinfo_xformr±KUwarning_streamr²NUpep_file_url_templater³Upep-%04dr´Uexit_status_levelrµKUconfigr¶NUstrict_visitorr·NUcloak_email_addressesr¸ˆUtrim_footnote_reference_spacer¹‰UenvrºNUdump_pseudo_xmlr»NUexpose_internalsr¼NUsectsubtitle_xformr½‰U source_linkr¾NUrfc_referencesr¿NUoutput_encodingrÀUutf-8rÁU source_urlrÂNUinput_encodingrÃU utf-8-sigrÄU_disable_configrÅNU id_prefixrÆUU tab_widthrÇKUerror_encodingrÈUANSI_X3.4-1968rÉU_sourcerÊU//home/pmajka/4/doc/sphinx/source/caf_basics.rstrËUgettext_compactr̈U generatorrÍNUdump_internalsrÎNU pep_base_urlrÏUhttp://www.python.org/dev/peps/rÐUsyntax_highlightrÑUshortrÒUinput_encoding_error_handlerrÓj®Uauto_id_prefixrÔUidrÕUdoctitle_xformrÖ‰Ustrip_elements_with_classesr×NU _config_filesrØ]rÙUfile_insertion_enabledrÚKU raw_enabledrÛKU dump_settingsrÜNubUsymbol_footnote_startrÝKUidsrÞ}rß(hj÷h$jµhhÂhh(hjŸhjáh!j6h j h#jËh"hìhhRuUsubstitution_namesrà}ráh1h@h3}râ(h5]rãh;]räh9]råUsourceræh/h7]rçh=]rèuU footnotesré]rêUrefidsrë}rìub.