Region of interest
- src.roi.createRoi(varargin)
Returns a mask to be used as a ROI by
spm_summarize. Can also save the ROI as binary image.USAGE:
mask = createROI(type, ... specification, ... volumeDefiningImage = '', ... outputDir = pwd, ... saveImg = false); mask = createROI('mask', roiImage); mask = createROI('sphere', sphere); mask = createROI('intersection', specification); mask = createROI('expand', specification);
See the
demos/roito see examples on how to use it.- Parameters:
type (
string) –'mask','sphere','intersection','expand'volumeDefiningImage (
string) – fullpath of the image that will define the space (resolution, …) if the ROI is to be saved.saveImg (
boolean) – Will save the resulting image as binary mask if set totruespecification –
depending on the chosen
typethis can be:- roiImage:
- string:
fullpath of the roi image for
'mask'
- sphere:
- structure:
defines the characteristic for
'sphere'
sphere.location: X Y Z coordinates in millimetersspehere.radius: radius in millimeters
- specification:
- structure:
defines the characteristic for
'intersection'and'expand'
sphere.location: X Y Z coordinates in millimeterssphere.radius: radius in millimeters
- Returns:
- mask:
- structure:
the volume of interest adapted from
spm_ROI
mask.def: VOI definition [sphere, mask]mask.rej: cell array of disabled VOI definition optionsmask.xyz: centre of VOI {mm} (for sphere)mask.spec: VOI definition parameters (radius for sphere)mask.str: description of the VOImask.descripmask.labelmask.roimask.roi.size: number of voxel in ROImask.roi.XYZ: voxel coordinatesmask.roi.XYZmm: voxel world coordinates
mask.globalmask.global.hdr: header of the “search space” where the roi is definedmask.global.imgmask.global.XYZmask.global.XYZmm
- src.roi.getPeakCoordinates(varargin)
This function gets the coordinates of a peak within a specified region of interest.
USAGE:
[worldCoord, voxelCoord, maxVal] = getPeakCoordinates(dataImage, roiImage, threshold)
- Parameters:
dataImage (
path) – data image (beta / t / Z map) to find the maximum inroiImage (
path) – binary mask limiting the volume where to find the peakthreshold (
numerical) – threshold above which peak must be found
- src.roi.keepHemisphere(inputImage, hemisphere, paddingValue)
Only keep the values from one hemisphere. Sets the other half to NaN. Writes an image with an extra entity
_hemi-[R|L]USAGE:
keepHemisphere(image, hemisphere)
- Parameters:
image (
string) –hemisphere (
string) –'L'or'R'
- src.roi.plotDataInRoi(varargin)
Creates a figure showing a histogram of the content of a set of ROIs used on a set of data files.
ROI label is extracted from the label entity in the BIDS filename.
USAGE:
figHandle = plotDataInRoi(dataImages, roiImages, ... 'scaleFactor', 1, ... 'roiAs', 'rows', ... 'dataLabel', {})
- Parameters:
dataImages (
path or cellstr of paths) –roiImages (
path or cellstr of paths) –scaleFactor (
numerical) – value to scale the factor by. Default to 1.roiAs (
'rows' or 'cols') – Determine if the ROI are supposed to be organized by rows or columns. Default to ‘rows’.dataLabel (
cellstr) – strings to use to label the data rows or columns.maxVox (
positive integer) – max of scale for nb of voxels. Default to [].nbBins (
positive integer) – use the same number of bins for all graphs. By default based on the number of unique values across all the datasets.
EXAMPLE:
mask1 = fullfile(pwd, 'label-V1_mask.nii') mask2 = fullfile(pwd, 'label-V2_mask.nii') data1 = fullfile(pwd, 'label-0001_beta.nii') data2 = fullfile(pwd, 'label-0002_beta.nii') mask = cellstr(cat(1, mask1, mask2)); data = cellstr(cat(1, data1, data2)); plotDataInRoi(data, mask);
- src.roi.thresholdToMask(varargin)
Returns a binary mask for an image after applying voxel wise threshold and an optional cluster size threshold
USAGE:
outputImage = thresholdToMask(inputImage, peakThreshold, clusterSize)
- Parameters:
inputImage (
path) –peakThreshold (
float) –clusterSize (
integer >= 0 (Default)) –
- Returns:
- outputImage:
(string)
- src.roi.renameNeuroSynth(inputImage)
rename a neurosynth map a name that is more bids friendly
USAGE:
outputImage = renameNeuroSynth(inputImage)
EXAMPLE:
inputImage = fullfile(pwd, 'motion_association-test_z_FDR_0.01.nii.gz'); outputImage = renameNeuroSynth(inputImage); outputImage >> fullfile(pwd, 'space-MNI_label-neurosynthMotion_probseg.nii.gz');
- src.roi.resliceRoiImages(referenceImage, imagesToCheck, dryRun)
Check if images are in the same orientation and reslice if necessarrry.
USAGE:
reslicedImages = resliceRoiImages(referenceImage, imagesToCheck, dryRun)
- Parameters:
referenceImage (
path) –imagesToCheck (
path or cellstr) –dryRun (
logical) – Returns the matlabbatch without running it.