<jupyter_start><jupyter_text>The following uses the `bbrc` branch of `pyxnat` (https://github.com/pyxnat/pyxnat/tree/bbrc) to fetch a sample case with FreeSurfer results from the XNAT CENTRAL platform. Results from cortical thickness estimation are returned as a Pandas DataFrame which is then cleaned and restructured as a simple dictionary.Note that this step is optional and that dictionary may be created in any other suitable manner, including manually.<jupyter_code>import pyxnat
x = pyxnat.Interface(config='/home/grg/git/pyxnat/pyxnat/tests/central.cfg')
p = x.select.project('nosetests5')
s = p.subject('rs')
e1 = s.experiment('CENTRAL02_E01603')
r = e1.resource('FREESURFER7')
df = r.aparc().set_index('region')
data = {'%s_%s'%(k, row.side) : float(row.value) 
        for k, row in df.iterrows() if row.side in ['left', 'right']}

list(data.items())[:5]
import ggseg
ggseg.plot_dk(data, background='k', edgecolor='w', cmap='Spectral', 
              bordercolor='gray', ylabel='Cortical thickness (mm)', title='Title of the figure')<jupyter_output><empty_output><jupyter_text>Another example with `aseg` data<jupyter_code>df = r.aseg().set_index('region')
data = {k : float(row.value) for k, row in df.iterrows()}

list((k, v) for k, v in data.items() if 'CC' in k)
ggseg.plot_aseg(data, background='k', edgecolor='w', cmap='Spectral', 
                bordercolor='gray', ylabel='Volume (mm3)', title='Title of the figure')<jupyter_output><empty_output><jupyter_text>Another example with the JHU WM atlas<jupyter_code>data_jhu = {'Anterior thalamic radiation L': 0.3004812598228455,
            'Anterior thalamic radiation R': 0.2909256815910339,
            'Corticospinal tract L': 0.3517134189605713,
            'Corticospinal tract R': 0.3606771230697632,
            'Cingulum (cingulate gyrus) L': 0.3149917721748352,
            'Cingulum (cingulate gyrus) R': 0.3126821517944336,
            'Cingulum (hippocampus) L': 0.2284496426582336,
            'Cingulum (hippocampus) R': 0.2508412301540375,
            'Forceps major': 0.299083411693573,
            'Forceps minor': 0.2521731853485107,
            'Inferior fronto-occipital fasciculus L': 0.2457948923110962,
            'Inferior fronto-occipital fasciculus R': 0.2696700096130371,
            'Inferior longitudinal fasciculus L': 0.2393001765012741,
            'Inferior longitudinal fasciculus R': 0.2447357028722763,
            'Superior longitudinal fasciculus L': 0.2248284667730331,
            'Superior longitudinal fasciculus R': 0.2204412966966629,
            'Uncinate fasciculus L': 0.2281110733747482,
            'Uncinate fasciculus R': 0.2106734961271286,
            'Superior longitudinal fasciculus (temporal part) L': 0.2622972726821899,
            'Superior longitudinal fasciculus (temporal part) R': 0.3504709601402283}
ggseg.plot_jhu(data_jhu, background='k', edgecolor='w', cmap='Spectral', 
               bordercolor='gray', ylabel='Mean Fractional Anisotropy', title='Title of the figure')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.119486504279131, 'fraction_numerical': 0.11586570111915734, 'mean_word_length': 3.981967213114754, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '259105', 'license': 'MIT', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1029, 'n_words': 250, 'path': 'doc/ggseg.ipynb', 'repo_name': 'kcho/python-ggseg', 'size': '3038'}