Submodules of the Population Module
This function removes as many files as possible.
xASL_adm_GzipAllFiles(ROOT, bFolder, bUseLinux, pathExternal)
This function zips NIfTI files or folders recursively and deletes the original file/folder after zipping.
[x] = xASL_im_CreateAnalysisMask(x, Threshold)
This function takes the mean population-based probability maps of masks, thresholds and combines them:
A. Creation GM, WM & WholeBrain masks by p>0.5 B. Create, combine & save vascular, susceptibity & FoV masks: - MaskVascular - MaskSusceptibility = MaskSusceptibility & MaskFoV C. Create & save VBA mask - MaskAnalysis = MaskVascular & MaskSusceptibility - x.S.VBAmask = MaskAnalysis & GMmask D. Visualization: Creates a figure with columns being following maps/masks overlaid over mean population T1w: 1. FoV probability 0-50% missing voxels 2. Vascular 0-7.5% missing voxels 3. Susceptibility 0-50% missing voxels 4. Analysis mask
xASL_qc_SortBySpatialCoV(x, Threshold1, Threshold2)
This function organizes the ASL QC images in //analysis/Population/ASLCheck into CBF, vascular and artifactual contrast per the spatial CoV thresholds defined above, in folders: //analysis/Population/ASLCheck/1_CBFContrast //analysis/Population/ASLCheck/2_VascularContrast //analysis/Population/ASLCheck/3_ArtifactualContrast Invalid spatial CoV numbers (e.g. NaN) will go to: //analysis/Population/ASLCheck/4_Unknown_sCoV Note: these outputs need to be visually checked; but pre-sorting them by spatial CoV puts them already in categories that are quick to skim through and manually correct by moving the images
The idea is then that only category 1 images are used for perfusion (CBF) analyses, both categories 1 & 2 for the vascular (sCoV) analyses, and the category 3 images excluded from analysis.
PM: this code does not include multiple sessions per subject yet! NB: this code uses the //analysis/Population/Stats/CoV_qCBF*TotalGM*.csv file, make sure that this file isn't edited!
Calculates the within and between-subject coefficient of variance (wsCV and bsCV respectively), to estimate the power to detect effects.
This requires 4D images that have been split.
[x] = xASL_stat_GetAcquisitionTime(x)
This functions collects the DICOM field AcquisitionTime from each json sidecar (& parms.mat for backward compatibility) and saves them in the participants.tsv. Additionally, it creates a AcquisitionTime histogram of the full study, which can be useful to check time of scanning -> can influence physiological CBF variability.
- Collect times
- Save times
- Create time histogram
xASL_stat_GetDICOMStatistics(x, ScanType, HasSessions)
This functions prints DICOM metadata (e.g. parameters used for quantification) and collects them in a single tsv (per BIDS). Summarizes this for the total population. Can be useful to detect software upgrades, where only slight parameter changes can hint on quantification changes. This function carries out the following steps:
- Load & save individual parameter files
- Print summary
- Write TSV file
This functions collects motion stats, with the following steps:
- Collect motion data
- If no data, skip this function
- Print motion vs exclusion overview
- Add motion data to participants.tsv
Loads the data from the study given in the QC_collection*.json files. Goes through all subjects and sessions and prints the Tanimoto coefficients that define the quality of the registrations. Steps:
- Load & extract parameters from individual parameter files
- Write TSV file
This functions collects motion stats, with the following. Steps:
- Collect structural volume data
- Collect WMH data
- Add stats in participants.tsv
This function creates a smooth biasfield as intensity map to normalize intensities between different sequences/scanner/sites within a single study. This is a simple pragmatic approach and is not validated, but is the best we can do.
First acquires average additive & multiplicative factors for total GM, then does a smooth voxel-wise rescaling. This doesn't make an assumption whether site or sequence differences are additive or multiplicative, but rather fits them both. Global scaling it performed to GM CBF == 60 mL/100g/min
NB: make sure that sequence resolution differences have been taken in account before creating these biasfields PM: add normalization of between-subjects SD as well. PM: are there other things we can normalize?
xASL_wrp_CreatePopulationTemplates(x[, bSaveUnmasked, Compute4Sets, SpecificScantype, bSkipWhenMissingScans, bRemoveOutliers, FunctionsAre])
This function creates simple parametric images, a.k.a. templates, for different image/scan types, on population level, as well as for different sets (e.g. sites/scanners/cohorts, etc) if specified. By default these images are masked, and transformed into a single column, for quick computations with low memory usage. The default parametric images that are created are the mean, between-subject SD, and the maximal intensity projection (MIP). The latter can e.g. identify intra-vascular signal that is similar between different subjects. Other parametric maps can be decommented (now commented out for speed).
Any new addition to participants.tsv will be recognized and loaded, for the generation of new parametric maps for groups specifically (needs to be set in input argument bCompute4Sets)
If a set only includes a combination of the following SetOptions: left, right, l, r, n/a, NaN (irrespective of capitals) each image with option right/r, will be flipped in the left-right direction, and left/right will not be treated as separate groups. This function performs the following steps:
- Define images/scantypes (if they are not defined by input argument SpecificScantype)
- Iterate over scan types & sessions
- Check availability images
- Load images
- Remove outliers
- Compute templates for all subjects together (only for bilateral images)
- Compute templates for individual sets
This wrapper organizes the computation of statistics for different ROIs in a [1.5 1.5 1.5] mm MNI space:
- Load the atlas: xASL_stat_AtlasForStats
- Organize TSV output name: using x.S.output_ID
- Obtain the ROI statistics: xASL_stat_GetROIstatistics
- Print statistics in TSV files: xASL_stat_PrintStats