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

Trying to access dlabel.nii dynamic field #1308

Open
sara-silvaad opened this issue Mar 20, 2024 · 1 comment
Open

Trying to access dlabel.nii dynamic field #1308

sara-silvaad opened this issue Mar 20, 2024 · 1 comment

Comments

@sara-silvaad
Copy link

Hello! I think this may be a bit of a reach but I am having an issue with the {subject}.aparc.32k_fs_LR.dlabel.nii files from HCP, I've looked all over the internet and found nothing. To extract the ROI mapping, this is essentially what I've done:

def load_atlas_aux(path2atlas):

try:
    cifti_file = nib.load(path2atlas)
except Exception as e:
    print("Error loading CIFTI file:", e)
    return None

data = cifti_file.get_fdata()
segmentation_atlas = data.ravel()

return segmentation_atlas

It works well, but it does not provide the same resaults I obtained from my matlab base file, which does something different by accessing a particular mapping like this:

subjlab = ft_read_cifti(path2atlas);
load_atlas_cmd = strcat('subjlab.x',subject,'_aparc');
segmentation_atlas = eval(load_atlas_cmd);

The problem is that cifti in matlab obviously doesn't have the same implementation as nibabel library so I don't know how to access that specific "attribute" of the atlas with this library. Maybe someone has faced something similar before or has any guidance for me, thank you!!

@effigies
Copy link
Member

It's unclear to me what you're trying to do. What do you get out of your MATLAB code? Do you have an example file where you can show the differences in Python and MATLAB?

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