nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
751 stars 530 forks source link

combination of masks #3109

Open AndyDodss opened 4 years ago

AndyDodss commented 4 years ago

please .. how can i combine different masks to be one mask and be saved to one image ,i used combine_mask_files() but its return is not one combined image of masks i passed ,cause of mask_index parameter which determine only one mask

effigies commented 4 years ago

Can you describe your problem in more detail?

AndyDodss commented 4 years ago

I'm working on many regions of interest (roi) each of them has different mask but i wanted to apply one integrated mask which i get it using combining these many regions of interest , i used "combine_mask_files()" but i found some error that i have to pass mask_index that determine just one mask to return back , simply i passed list of masks to get their union but i have to set parameter "mask_index" and returned was just the mask of index i pass instead of union masks so we (mina98, AndyDodss) had to edit something in "combine_mask_files" implementation

.......``if isdefined(mask_index) or not isdefined(mask_method): ..........`` if not isdefined(mask_index): ..................``if len(mask_files) == 1: .........................`` mask_index = 0 ..................`` else: .......................`` raise ValueError(('When more than one mask file is provided, .........................``'one of merge_method or mask_index must be '``'set')) ...........``if mask_index < len(mask_files): ...................``mask = nb.load(mask_files[mask_index], mmap=NUMPY_MMAP) ...................``return [mask] .........`` raise ValueError(('mask_index {0} must be less than number of mask ' .................................`` 'files {1}').format(mask_index, len(mask_files)))

effigies commented 4 years ago

Looking at this:

https://github.com/nipy/nipype/blob/1a869991adc024577536689d557fc748c764f15d/nipype/algorithms/confounds.py#L1237-L1250

Depending on what you mean by "integrated mask", it seems you can use the mask_method argument instead of the mask_index argument.