def filter_ics(comps_img, mask, zscore=2., mode='+-'): """ Generator for masking and thresholding each IC spatial map. Parameters ---------- comps_img: img-like The 'raw' ICC maps image. mask: img-like If not None. Will apply this masks in the end of the process. thr: float The threshold value. zscore: bool If True will calculate the z-score of the ICC before thresholding. mode: str Choices: '+' for positive threshold, '+-' for positive and negative threshold and '-' for negative threshold. Returns ------- icc_filts: list of nibabel.NiftiImage Thresholded and masked ICCs. """ # store the average value of the blob in a list mask = niimg.load_img(mask) for i, icimg in enumerate(iter_img(comps_img)): yield filter_icc(icimg, mask=mask, thr=zscore, zscore=True, mode=mode)
def _filter_ic_imgs(self, ic_file): if self.zscore > 0: do_zscore = True else: do_zscore = False mask = niimg.load_img(self.mask_file) return [filter_icc(icimg, mask=mask, thr=self.zscore, zscore=do_zscore, mode=self.mode) for icimg in iter_img(ic_file)]