Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegionalizedModel not working as expected? #6

Closed
LudovicoColetta opened this issue Jun 21, 2018 · 2 comments
Closed

RegionalizedModel not working as expected? #6

LudovicoColetta opened this issue Jun 21, 2018 · 2 comments

Comments

@LudovicoColetta
Copy link

Dear Joseph,

first of all thanks for the great work.

We are trying to build a regionalized version of the connectome with brain regions that are not necessarily part of the summary structures. I tried the following

from mcmodels.core import VoxelModelCache
from mcmodels.models.voxel import RegionalizedModel
import numpy as np

cache = VoxelModelCache(manifest_file='connectivity/voxel_model_manifest.json')

model, right_hem_mask, whole_brain_mask= cache.get_voxel_connectivity_array()

source_key = right_hem_mask.get_key(structure_ids=[31,864]) # ACA, DORsm
target_key = whole_brain_mask.get_key(structure_ids=[31,864]) # ACA, DORsm

regional_model = RegionalizedModel.from_voxel_array(model, source_key, target_key)

ncd=regional_model.normalized_connection_density 

and according to these examples (here and bottom of here) I was expecting a 2x4 numpy array as a result, instead I got a 2x2

I then tried to include the hemisphere_id for the target key variable, and it seemed to work

target_key_right_hem = whole_brain_mask.get_key(structure_ids=[31,864],hemisphere_id=2) # ACA, DORsm for right hem
target_key_left_hem = whole_brain_mask.get_key(structure_ids=[31,864],hemisphere_id=1) # ACA, DORsm for left hem

regional_model_right_hem = RegionalizedModel.from_voxel_array(model, source_key, target_key_right_hem)
regional_model_left_hem = RegionalizedModel.from_voxel_array(model, source_key, target_key_left_hem)

ncd_right=regional_model_right_hem.normalized_connection_density
ncd_left=regional_model_left_hem.normalized_connection_density

new_ncd=np.concatenate((ncd_right,ncd_left),axis=1)

Is the second piece of code the right way to obtain what we want or the first one should output a 2x4 matrix?

Thanks for your time
Ludovico

@jknox13
Copy link
Contributor

jknox13 commented Jun 21, 2018

Hi Ludovico,

Yes, the second piece of code is currently the only way to get a regional connecitivty matrix both ipsilateral and contralateral connection weights.

Regionalizing the voxel-level connectivity using a Mask object with hemisphere==3 will produce a regional connectivity matrix with weights equal to the integral of the voxel-scale weights between regions both ipsilaterally and contralatteraly.

I admit this does not make much sense in terms of regional connectivity, but has been implemented in this way for other purposes.

@LudovicoColetta
Copy link
Author

Great, thanks for the quick answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants