Repository: nilearn/nilearn

Issue:
Harvard-Oxford label spelling inconsistency
<!--

Hi! 
If you have: 
 -1 Questions about how to use Nilearn or 
 -2 Need analysis suggestions & recommendations?

A bunch of fMRI researchers hang out at Neurostars (http://neurostars.org/). 
Post those questions there. 
Add the tag `nilearn` (we get an email from Neurostars if you do).

Posting them here makes life more complicated for the Nilearn developers.  
-->

<!--

For the Bug Report, 
Include this information:
-------------------------
The labels of 'sub-maxprob-thr25-1mm' in the Harvard oxford atlas contains 2 spellings of Ventricle.
'Left Lateral Ventrical' and  'Right Lateral Ventricle'. I would suggest spelling both as R/L Lateral Ventricle.

What version of Nilearn are you using?
I am using version nilearn 0.6.2 (obtained by looking at pip list)

What were you trying to do?
Make a mask of ventricles and white matter.

What did you expect will happen?
Obtain both left and right ventricle labels.

What actually happened?
I only got one because I asked for substrings with 'Ventricle'

List the steps you performed that revealed the bug to you.
Include any code samples. Enclose them in triple back-ticks (```)
Like this:

```
from nilearn import image,datasets,masking

HO_sub=datasets.fetch_atlas_harvard_oxford(atlas_name='sub-maxprob-thr25-1mm')
keep= [ r for r in HO_sub.labels if 'White' in r or 'Ventricle' in r or 'Ventrical' in r]

display(keep)
display(HO_sub.labels)
``` 
-->



Discussion:
This should be an easy fix but wanted to make sure it got noted.
Could you elaborate a little bit ? Thx.
Hi @jbdenniso !
Any update on this?
I took a look and I noticed a couple of minor possible typos:

- "Left Lateral Ventrical" (should be ventricle)
- "Frontal Operculum Cortex", "Parietal Operculum Cortex", and "Central _Opercular_ Cortex"
    - All three should probably be opercular, not operculum.
- "Right Cerebral Cortex " and "Left Cerebral Cortex " (trailing whitespace)
Sorry for missing these comments I must have notifications off. Tsalo correctly identified what I had seen misspelling ventricle and the trailing whitespace in right & left Cerebral Cortex. I had not noticed the difference between the opercular labels.
Adding a good first issue label, though this may need some pointers on where in the code base one should start digging into.

Resolving patch:
diff --git a/nilearn/datasets/atlas.py b/nilearn/datasets/atlas.py
--- a/nilearn/datasets/atlas.py
+++ b/nilearn/datasets/atlas.py
@@ -716,7 +716,14 @@ def _get_atlas_data_and_labels(
                 f"Duplicate index {new_idx} for labels "
                 f"'{names[new_idx]}', and '{label.text}'"
             )
-        names[new_idx] = label.text
+
+        # fix typos in Harvard Oxford labels
+        if atlas_source == "HarvardOxford":
+            label.text = label.text.replace("Ventrical", "Ventricle")
+            label.text = label.text.replace("Operculum", "Opercular")
+
+        names[new_idx] = label.text.strip()
+
     # The label indices should range from 0 to nlabel + 1
     assert list(names.keys()) == list(range(n + 2))
     names = [item[1] for item in sorted(names.items())]


Test patch:
diff --git a/nilearn/datasets/tests/test_atlas.py b/nilearn/datasets/tests/test_atlas.py
--- a/nilearn/datasets/tests/test_atlas.py
+++ b/nilearn/datasets/tests/test_atlas.py
@@ -221,6 +221,11 @@ def test_fetch_atlas_fsl(
         is_symm=is_symm or split,
     )
 
+    # check for typo in label names
+    for label in atlas_instance.labels:
+        # no extra whitespace
+        assert label.strip() == label
+
 
 def test_fetch_atlas_craddock_2012(tmp_path, request_mocker):
     local_archive = (