diff --git a/src/batches/setBatchLesionAbnormalitiesDetection.m b/src/batches/setBatchLesionAbnormalitiesDetection.m new file mode 100755 index 00000000..337afe71 --- /dev/null +++ b/src/batches/setBatchLesionAbnormalitiesDetection.m @@ -0,0 +1,14 @@ +%----------------------------------------------------------------------- +% Job saved on 08-Mar-2021 12:47:16 by cfg_util (rev $Rev: 7345 $) +% spm SPM - SPM12 (7771) +% cfg_basicio BasicIO - Unknown +%----------------------------------------------------------------------- +matlabbatch{1}.spm.tools.ali.outliers_detection.step3tissue.step3patients = ''; +matlabbatch{1}.spm.tools.ali.outliers_detection.step3tissue.step3controls = ''; +matlabbatch{1}.spm.tools.ali.outliers_detection.step3tissue.step3Alpha = 0.5; +matlabbatch{1}.spm.tools.ali.outliers_detection.step3tissue.step3Lambda = -4; +spmDir = spm('dir'); +lesionMask = fullfile(spmDir, 'toolbox', 'ALI', 'Mask_image', 'mask_controls_vox2mm.nii'); +matlabbatch{1}.spm.tools.ali.outliers_detection.step3mask_thr = 0; +matlabbatch{1}.spm.tools.ali.outliers_detection.step3binary_thr = 0.3; +matlabbatch{1}.spm.tools.ali.outliers_detection.step3binary_size = 0.8; diff --git a/src/batches/setBatchLesionOverlapMap.m b/src/batches/setBatchLesionOverlapMap.m new file mode 100755 index 00000000..9cde37ad --- /dev/null +++ b/src/batches/setBatchLesionOverlapMap.m @@ -0,0 +1,6 @@ +%----------------------------------------------------------------------- +% Job saved on 08-Mar-2021 12:48:14 by cfg_util (rev $Rev: 7345 $) +% spm SPM - SPM12 (7771) +% cfg_basicio BasicIO - Unknown +%----------------------------------------------------------------------- +matlabbatch{1}.spm.tools.ali.lesion_overlap.lom = ''; diff --git a/src/batches/setBatchLesionSegmentation.m b/src/batches/setBatchLesionSegmentation.m new file mode 100755 index 00000000..2e519e39 --- /dev/null +++ b/src/batches/setBatchLesionSegmentation.m @@ -0,0 +1,39 @@ +% (C) Copyright 2021 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchLesionSegmentation(matlabbatch, BIDS, opt, subID) + % + % Creates a batch to segment the anatomical image for lesion detection + % + % USAGE:: + % + % matlabbatch = setBatchSegmentationDetectLesion(matlabbatch, BIDS, opt, subID) + % + % :param matlabbatch: list of SPM batches + % :type matlabbatch: structure + % + % :returns: - :matlabbatch: (structure) + + printBatchName('Lesion segmentation'); + +% find anatomical file +[anatImage, anatDataDir] = getAnatFilename(BIDS, subID, opt); +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1data = [anatImage, anatDataDir]; + +% define SPM folder +spmDir = spm('dir'); + +% specify Prior EXTRA class (lesion prior map) +lesionPriorMap = fullfile(spmDir, 'toolbox', 'ALI', 'Priors_extraClass', 'wc4prior0.nii'); + +unified_segmentation.step1prior = {lesionPriorMap}; +unified_segmentation.step1niti = 2; % number of iterations +unified_segmentation.step1thr_prob = 0.333333333333333; % threshold probability +unified_segmentation.step1thr_size = 0.8; % threshold size (in cm3) +unified_segmentation.step1coregister = 1; % coregister in MNI space (yes: 1) +unified_segmentation.step1mask = {''}; % specify cost function mask CFM (optional) +unified_segmentation.step1vox = 2; % Voxel sizes (in mm) +unified_segmentation.step1fwhm = [8 8 8]; % Smooth: FWHM + +matlabbatch{end+1}.spm.tools.ali.unified_segmentation = unified_segmentation; + +end \ No newline at end of file diff --git a/src/workflows/bidsLesionSegmentation.m b/src/workflows/bidsLesionSegmentation.m new file mode 100755 index 00000000..91dde56f --- /dev/null +++ b/src/workflows/bidsLesionSegmentation.m @@ -0,0 +1,39 @@ +% (C) Copyright 2021 CPP BIDS SPM-pipeline developers + +function bidsLesionSegmentation(opt) + % + % Performs segmentation to detect lesions of anatomical image. + % + % USAGE:: + % + % bidsLesionSegmentation(opt) + % + % :param opt: structure or json filename containing the options. See + % ``checkOptions()`` and ``loadAndCheckOptions()``. + % :type opt: structure + % + % Segmentation will be performed using the information provided in the BIDS data set. + % + + + if nargin < 1 + opt = []; + end + + [BIDS, opt] = setUpWorkflow(opt, 'lesion segmentation'); + + parfor iSub = 1:numel(opt.subjects) + + subLabel = opt.subjects{iSub}; + + printProcessingSubject(iSub, subLabel); + + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subLabel); + + saveAndRunWorkflow(matlabbatch, 'LesionSegmentation', opt, subLabel); + + end + +end +