| Title: | Parcel-Based Correlation Between NIfTI Images |
|---|---|
| Description: | Estimate the correlation between two NIfTI images across random parcellations of the images (Fortea et al., under review). This approach overcomes the problems of both voxel-based correlations (neighbor voxels may be spatially dependent) and atlas-based correlations (the correlation may depend on the atlas used). |
| Authors: | Joaquim Radua [aut, cre]
|
| Maintainer: | Joaquim Radua <[email protected]> |
| License: | Artistic License 2.0 |
| Version: | 1.0 |
| Built: | 2026-05-27 10:46:02 UTC |
| Source: | https://github.com/cran/nifti.pbcor |
Calculates the correlation between two NIfTI objects (e.g., brain maps) across random parcels.
nifti.pbcor(nifti1, nifti2, mask_coords, n.parcels = 90, n.parcellations = 50, kmeans.iter.max = 30, kmeans.nstart = 1, kmeans.algorithm = "Hartigan-Wong", kmeans.trace = FALSE, cor.alternative = "two.sided", cor.method = "pearson", cor.exact = NULL, cor.conf.level = 0.95, cor.continuity = FALSE, verbose = TRUE)nifti.pbcor(nifti1, nifti2, mask_coords, n.parcels = 90, n.parcellations = 50, kmeans.iter.max = 30, kmeans.nstart = 1, kmeans.algorithm = "Hartigan-Wong", kmeans.trace = FALSE, cor.alternative = "two.sided", cor.method = "pearson", cor.exact = NULL, cor.conf.level = 0.95, cor.continuity = FALSE, verbose = TRUE)
nifti1 |
an object of class |
nifti2 |
an object of class |
mask_coords |
a mask matrix prepared by nifti.pbcor_mask. |
n.parcels |
the number of parcels to divide the mask into. The default is 90, approximately the minimum number of resels in the meta-analytic maps of gray matter differences between individuals with mental disorders and healthy controls in Fortea et al. (see below). |
n.parcellations |
the number of parcellations, i.e., how many times the mask will be parcellated. |
kmeans.iter.max |
(optional) argument |
kmeans.nstart |
(optional) argument |
kmeans.algorithm |
(optional) argument |
kmeans.trace |
(optional) argument |
cor.alternative |
(optional) argument |
cor.method |
(optional) argument |
cor.exact |
(optional) argument |
cor.conf.level |
(optional) argument |
cor.continuity |
(optional) argument |
verbose |
(optional) logical, whether to print some messages during execution. |
This approach resolves the problems of voxel-based correlations, where contiguous voxels are non-independent, by randomly segmenting the mask (e.g., the brain) into parcels and calculating the Pearson correlation coefficient across these parcels. Additionally, it circumvents the limitations of atlas-based correlations, where estimates depend on the specific atlas used, by repeating the random parcellation and correlation multiple times and selecting the median estimate.
The parcel-based correlation between the two images across parcellations. The attribute "parcellations.cor.test" has the cor.test results obtained in the different random parcellations.
Joaquim Radua
Fortea et al., under review.
library(oro.nifti) # Path of the example files (with large voxels to ensure the example runs quickly) mask_path = system.file("examples", "mask.nii.gz", package = "nifti.pbcor") img1_path = system.file("examples", "img1.nii.gz", package = "nifti.pbcor") img2_path = system.file("examples", "img2.nii.gz", package = "nifti.pbcor") # Prepare the mask mask = nifti.pbcor_mask(readNIfTI(mask_path)) # Conduct the parcel-based correlation nifti.pbcor(readNIfTI(img1_path), readNIfTI(img2_path), mask)library(oro.nifti) # Path of the example files (with large voxels to ensure the example runs quickly) mask_path = system.file("examples", "mask.nii.gz", package = "nifti.pbcor") img1_path = system.file("examples", "img1.nii.gz", package = "nifti.pbcor") img2_path = system.file("examples", "img2.nii.gz", package = "nifti.pbcor") # Prepare the mask mask = nifti.pbcor_mask(readNIfTI(mask_path)) # Conduct the parcel-based correlation nifti.pbcor(readNIfTI(img1_path), readNIfTI(img2_path), mask)
This function creates the mask required to conduct parcel-based correlations with nifti.pbcor.
nifti.pbcor_mask(nifti, verbose = TRUE)nifti.pbcor_mask(nifti, verbose = TRUE)
nifti |
an object of class |
verbose |
(optional) logical, whether to print some messages during execution. |
This function converts a NIfTI mask into the appropriate format for nifti.pbcor.
A matrix with the coordinates of the mask
Joaquim Radua
library(oro.nifti) # Path of the example files (with large voxels to ensure the example runs quickly) mask_path = system.file("examples", "mask.nii.gz", package = "nifti.pbcor") img1_path = system.file("examples", "img1.nii.gz", package = "nifti.pbcor") img2_path = system.file("examples", "img2.nii.gz", package = "nifti.pbcor") # Prepare the mask mask = nifti.pbcor_mask(readNIfTI(mask_path)) # Conduct the parcel-based correlation nifti.pbcor(readNIfTI(img1_path), readNIfTI(img2_path), mask)library(oro.nifti) # Path of the example files (with large voxels to ensure the example runs quickly) mask_path = system.file("examples", "mask.nii.gz", package = "nifti.pbcor") img1_path = system.file("examples", "img1.nii.gz", package = "nifti.pbcor") img2_path = system.file("examples", "img2.nii.gz", package = "nifti.pbcor") # Prepare the mask mask = nifti.pbcor_mask(readNIfTI(mask_path)) # Conduct the parcel-based correlation nifti.pbcor(readNIfTI(img1_path), readNIfTI(img2_path), mask)