Issue: Generate modeled activation maps with peaks2maps

Hi there,

I am running the peaks2maps example code.

When I run: imgs = k.transform(dset, return_type="image"). I get the following error message:


TypeError Traceback (most recent call last)
in
1 k = nimare.meta.kernel.Peaks2MapsKernel()
----> 2 imgs = k.transform(dset, return_type=“image”)

~/opt/anaconda3/lib/python3.8/site-packages/nimare/meta/kernel.py in transform(self, dataset, masker, return_type)
404 coordinates_list.append(mm_coords)
405
–> 406 imgs = peaks2maps(coordinates_list, skip_out_of_bounds=True, model_dir=self._model_dir)
407
408 if self.resample_to_mask:

~/opt/anaconda3/lib/python3.8/site-packages/nimare/meta/utils.py in peaks2maps(contrasts_coordinates, skip_out_of_bounds, tf_verbosity_level, model_dir)
256 # download_peaks2maps_model expects None for “auto”
257 model_dir = None if model_dir == “auto” else model_dir
–> 258 model_dir = download_peaks2maps_model(data_dir=model_dir)
259 model = tf.estimator.Estimator(model_fn, model_dir=model_dir)
260

~/opt/anaconda3/lib/python3.8/site-packages/nimare/extract/extract.py in download_peaks2maps_model(data_dir, overwrite, verbose)
388
389 dataset_name = “peaks2maps_model_ohbm2018”
–> 390 if dataset_name not in data_dir: # allow data_dir to include model folder
391 data_dir = temp_data_dir.replace(temp_dataset_name, dataset_name)
392

TypeError: argument of type ‘NoneType’ is not iterable

Any help of how to solve this issue is much appreciated! Thanks.

Hi @Lisa_Marie,

This is, unfortunately, a bug in how we automatically detect the target location for the Peaks2Maps model (see NiMARE#368) . I haven’t figured out how to deal with it yet, but the good news is that you should be able to get around the bug by specifying a location for the model when you initialize the kernel using the model_dir argument.

nimare.meta.kernel.Peaks2MapsKernel(model_dir="/path/to/folder/")

Please let me know if that doesn’t work.

Best,
Taylor