unravel.voxel_stats.z_score_cwd module#

Use vstats_z_score_cwd (zsc) from UNRAVEL to z-score .nii.gz images in the current directory.

Prereqs:
  • vstats_prep

Outputs:
  • <path/input_img>_z.nii.gz (float32) saved in the same directory as the input image.

Note

  • z-score = (img.nii.gz - mean pixel intensity in brain)/standard deviation of intensity in brain

  • Voxels outside the mask are set to zero.

Next commands for voxel-wise stats:
  • Aggregate atlas space IF images with utils_agg_files.

  • If analyzing whole brains, consider using vstats_whole_to_avg to average left and right hemispheres.

  • If using side-specific z-scoring, use vstats_hemi_to_avg to average the images.

  • Prepend condition names with utils_prepend.

  • Check images in FSLeyes (e.g., with vstats_check_fsleyes) and run vstats to perform voxel-wise stats.

Usage:#

vstats_z_score_cwd -i ‘<asterisk>.nii.gz’ [-mas path/mask1.nii.gz path/mask2.nii.gz] [-s z] [-v]

unravel.voxel_stats.z_score_cwd.parse_args()[source]#
unravel.voxel_stats.z_score_cwd.z_score_img(img, mask_img)[source]#

Z-score an ndarray using a mask.

Parameters:
  • img (-) – the ndarray to be z-scored.

  • mask_img (-) – the brain mask ndarray

Returns:

the z-scored ndarray

Return type:

  • img_z (np.ndarray)

unravel.voxel_stats.z_score_cwd.main()[source]#