Repository: nilearn/nilearn

Issue:
should include full mask in haxby_dataset
the whole-brain mask is included in the haxby_dataset_simple download, but not in the haxby_dataset download.  seems like both of them should include the full mask



Discussion:
> seems like both of them should include the full mask

Seems like an oversight indeed!

The whole-brain mask is shipped with the haxby example. The archive is 100MB, which is a lot to download for a single mask. Plus, we have no guarantee that this mask is suited for the whole dataset. @GaelVaroquaux, do you think we should upload it on NITRC and make it available with the full dataset?

> @GaelVaroquaux, do you think we should upload it on NITRC and make it
> available with the full dataset?

+1

This one is fast. I take care of it while drinking my coffee.


Resolving patch:
diff --git a/nilearn/datasets/func.py b/nilearn/datasets/func.py
--- a/nilearn/datasets/func.py
+++ b/nilearn/datasets/func.py
@@ -103,6 +103,7 @@ def fetch_haxby(data_dir=None, n_subjects=1, fetch_stimuli=False,
         'func': string list. Paths to nifti file with bold data.
         'session_target': string list. Paths to text file containing
         session and target data.
+        'mask': string. Path to fullbrain mask file.
         'mask_vt': string list. Paths to nifti ventral temporal mask file.
         'mask_face': string list. Paths to nifti ventral temporal mask file.
         'mask_house': string list. Paths to nifti ventral temporal mask file.
@@ -140,6 +141,11 @@ def fetch_haxby(data_dir=None, n_subjects=1, fetch_stimuli=False,
     data_dir = _get_dataset_dir(dataset_name, data_dir=data_dir,
                                 verbose=verbose)
 
+    # Get the mask
+    url_mask = 'https://www.nitrc.org/frs/download.php/7868/mask.nii.gz'
+    mask = _fetch_files(data_dir, [('mask.nii.gz', url_mask, {})],
+                        verbose=verbose)[0]
+
     # Dataset files
     if url is None:
         url = 'http://data.pymvpa.org/datasets/haxby2001/'
@@ -191,6 +197,7 @@ def fetch_haxby(data_dir=None, n_subjects=1, fetch_stimuli=False,
             mask_house=files[4::n_files],
             mask_face_little=files[5::n_files],
             mask_house_little=files[6::n_files],
+            mask=mask,
             description=fdescr,
             **kwargs)
 


Test patch:
diff --git a/nilearn/datasets/tests/test_func.py b/nilearn/datasets/tests/test_func.py
--- a/nilearn/datasets/tests/test_func.py
+++ b/nilearn/datasets/tests/test_func.py
@@ -129,11 +129,12 @@ def test_fetch_haxby():
     for i in range(1, 6):
         haxby = func.fetch_haxby(data_dir=tmpdir, n_subjects=i,
                                  verbose=0)
-        # subject_data + md5
-        assert_equal(len(mock_url_request.urls), 1 + (i == 1))
+        # subject_data + (md5 + mask if first subj)
+        assert_equal(len(mock_url_request.urls), 1 + 2 * (i == 1))
         assert_equal(len(haxby.func), i)
         assert_equal(len(haxby.anat), i)
         assert_equal(len(haxby.session_target), i)
+        assert_true(haxby.mask is not None)
         assert_equal(len(haxby.mask_vt), i)
         assert_equal(len(haxby.mask_face), i)
         assert_equal(len(haxby.mask_house), i)