Closed YSanchezAraujo closed 7 years ago
It's a little hard to say without being able to run your script, but I think the problem is here:
vtx_lh = left_df.val.values[lh_labels]
The medial wall vertices are -1
in the lh_labels
array, so the vtx_lh
array is going to put the final value (i.e. the value in the -1
positional index) in the medial wall. Does that make sense?
@mwaskom thanks for the info. So I don't think I understand - I guess I have the wrong idea here but if I do:
lh_labels, lh_ctab, lh_names = nb.freesurfer.read_annot(lh_aparc_file)
rh_labels, rh_ctab, rh_names = nb.freesurfer.read_annot(rh_aparc_file)
zip(lh_labels, lh_names)
then -1
in lh_lables
shows up like this:
(-1, 'G_and_S_cingul-Mid-Post')
(-1, 'G_temp_sup-Plan_tempo')
(-1, 'G_temporal_middle')
and Medial_wall
in lh_names
is (46, 'Medial_wall')
or should I not expect the order of the values in those two lists to correspond to one another?
zip(lh_labels, lh_names)
These don't positionally correspond. Look at the lengths. The labels
array has as many entries as there are vertices, the names
list has one fewer entries than there are unique labels in the labels
array, because the undefined (-1
) vertices don't have a name.
I think I see what you're saying. Then my question becomes how do I order lh_names
so the index representations in lh_labels
map to the correct index in lh_names
? I ordered my data based on the order nibabel returns the names list since I was going off https://pysurfer.github.io/examples/plot_parc_values.html
I think all you need to do is account separately for the vertices that are undefined in the parcellation. I.e.
vtx_lh[lh_labels == -1] = 0
Then the medial wall will be white in your colormap. Or you can set it to some negative number and do thresh=0
and it will be gray.
In the parcellation example, the Yeo atlas uses a label for the medial vertices (rather than leaving them undefined) so this problem doesn't arise.
Oh ok that works. Thank you!
In the picture below, I think the large area in the middle of the medial views is usually greyed out in images and in this use case (I think it should just be white)I'm not sure why values are being mapped onto it.
That result is gotten using:
If I look at
left_df
for values equal to or less than 70 I get:I thought maybe something was happening with "Unknown" and it doesn't seem to be in the map from the names to the labels:
Any ideas on what's happening?