Convert neurovault to dataset in NiMARE

Hello world!
I’m new in python and its package NiMARE, but I’m trying to use it in order to do a meta-analysis using both neurovault and neurosynth databases.
Unfortunately, when I run the function convert_neurovault_to_dataset from the interpreter encounters a key error coming from line 353 of the io script as it does not find the key named “results” in images[].

Runing the function on the example (here) goes well, but I can’t run it on my own IDs.
Here’s my reprex, hoping it’ll help:
import nimare
from import convert_neurovault_to_dataset

#My IDs
collection_ids = (109015, 53586, 53587)

#My contrasts
contrasts = {
“language”: (
“GroupICA LANG|”
“phon diff fwe|”
“sem diff fwe”

#The default conversion
map_type_conversion = {“Z map”: “z”, “T map”: “t”}

#And here’s the holy grail’s function
dset = convert_neurovault_to_dataset(
img_dir=“D:/My Path”,

Thanks a lot.

Thank you for including the code you used. Can you also post the full error traceback? It will help us debug.

I’ll also tag @jdkent, who added the convert_neurovault_to_dataset function to NiMARE.

Thanks for this very rapid reply.
I ran this on spyder 5.0 and I guess the traceback isn’t full, but here is what I had :
runfile(‘D:\My Path\my’, wdir=‘D:\My Path’)
Traceback (most recent call last):

File “D:\My Path\my”, line 23, in
dset = convert_neurovault_to_dataset(

File “D:\Programmes\Anaconda3\envs\Nouveau\lib\site-packages\nimare\”, line 353, in convert_neurovault_to_dataset
for img_dict in images[“results”]:

KeyError: ‘results’

I’ll edit this post as soon as I can when I’ll run it with jupyter for its tracebacks.
EDIT: Here’s the traceback coming from Jupyter’s notebook

KeyError Traceback (most recent call last)
—> 21 dset = convert_neurovault_to_dataset(
22 collection_ids,
23 contrasts,

D:\Programmes\Anaconda3\envs\JupytNiMARE\lib\site-packages\nimare\ in convert_neurovault_to_dataset(collection_ids, contrasts, img_dir, map_type_conversion, **dset_kwargs)
352 sample_sizes = []
→ 353 for img_dict in images[“results”]:
354 if not (
355 re.match(contrast_regex, img_dict[“name”])

KeyError: ‘results’

Thanks! I was able to reproduce the issue, and the reason was that the collections were not accessible through the URLs that NiMARE generates to get them. I went through each one to check the URLs, and it looks like they couldn’t be found.

Here are the URLs where I’d expect to see the collections:

Is it possible that the three collections are private? If not, could you share the links to the collections here?

In any case, it seems like NiMARE could do with more informative error messages when collections aren’t found. I will open an issue in the repository.

EDIT: I’ve opened the following issue: Produce more informative error messages when NeuroVault collections aren't found · Issue #492 · neurostuff/NiMARE · GitHub

1 Like

Oh god, how did I miss it that much?
You really helped me with the URLs where you expected to find the collections: Python was in fact searching for URLs that do not exist because the IDs were the images IDs in the neurovault, not the collections IDs… My fault.

Here are the links to the collections I used:

I guess it might mean a great amount of job, but do you expect to make nimare works with the images IDs as well?
In any case: thanks a lot for your job, that’s really great!! And thanks for this very rapid help.

You really helped me with the URLs where you expected to find the collections

Glad to help!

I guess it might mean a great amount of job, but do you expect to make nimare works with the images IDs as well?

I’m not sure, but I can bring it up with the NiMARE devs who work with Neurovault. It might be easy to support images, but I can’t be sure.