Binarize ICA component

Dear AFNI experts,

I have tried to binarize an ICA component derived from MELODIC FSL without success. I have used the following function because it worked with probabilistic masks:
3dROIMaker -inset Component_ICA.nii’[13]’ -thresh 3.5 -prefix prueba_3.5

Could you suggest me another alternative to do this.
Thank a lot


Hi, Karel-

Could you please be a bit more specific? For example, are you wanting to:

  • use an output of FSL’s Melodic (so, a 4D dataset of Z-score values)
  • and output a binarized map wherever Z>3.5? Or do you want the binarized map to be where |Z|> 3.5?

3dROIMaker will threshold your volume and, each separate “island” of that survives above thresholding will be populated by voxels with distinct integers. Thus, each island is identifiable.

If you don’t want, that, but just want a binary mask of 1/0, then you could do this for only having values >3.5:

3dcalc -a Component_ICA.nii'[13]' -expr "step(a-3.5)" -prefix OUTPUT_mask_vals_greater_than_3.5

… or this for values whos abs value is >3.5 (i.e., >3.5 or <-3.5):

3dcalc -a Component_ICA.nii'[13]' -expr "not(within(a,-3.5,3.5))" -prefix OUTPUT_mask_vals_magn_greater_than_3.5


Hi Taylor,

Thank you so much for the quick response. Examples 1 and 2 were exactly what I wanted to do.