From daee136c8bc8adf3083311e4c17f230e5bbd4bf2 Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 8 Mar 2021 11:57:03 -0500 Subject: [PATCH 1/8] add DetectLesion batch --- src/batches/setBatchDetectLesion.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 src/batches/setBatchDetectLesion.m diff --git a/src/batches/setBatchDetectLesion.m b/src/batches/setBatchDetectLesion.m new file mode 100755 index 00000000..2e796d56 --- /dev/null +++ b/src/batches/setBatchDetectLesion.m @@ -0,0 +1,23 @@ +%----------------------------------------------------------------------- +% Job saved on 08-Mar-2021 11:11:19 by cfg_util (rev $Rev: 7345 $) +% spm SPM - SPM12 (7771) +% cfg_basicio BasicIO - Unknown +%----------------------------------------------------------------------- +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1data = ''; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {'C:\Users\michm\spm12\toolbox\ALI\Priors_extraClass\wc4prior0.nii'}; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_size = 0.8; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1coregister = 1; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1mask = {''}; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1vox = 2; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1fwhm = [8 8 8]; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3patients = ''; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3controls = ''; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3Alpha = 0.5; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3Lambda = -4; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3mask = {'C:\Users\michm\spm12\toolbox\ALI\Mask_image\mask_controls_vox2mm.nii'}; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3mask_thr = 0; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3binary_thr = 0.3; +matlabbatch{2}.spm.tools.ali.outliers_detection.step3binary_size = 0.8; +matlabbatch{3}.spm.tools.ali.lesion_overlap.lom = ''; From bbd4e233e71349d4afd20866051cdd8f2b97beca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mich=C3=A8le=20MacLean?= <54547865+mwmaclean@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:30:38 -0500 Subject: [PATCH 2/8] Apply suggestions from code review Change path Co-authored-by: Remi Gau --- src/batches/setBatchDetectLesion.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/batches/setBatchDetectLesion.m b/src/batches/setBatchDetectLesion.m index 2e796d56..ad516821 100755 --- a/src/batches/setBatchDetectLesion.m +++ b/src/batches/setBatchDetectLesion.m @@ -4,7 +4,9 @@ % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.tools.ali.unified_segmentation.step1data = ''; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {'C:\Users\michm\spm12\toolbox\ALI\Priors_extraClass\wc4prior0.nii'}; +spmDir = spm('dir'); +lesionPriorMap = fullfile(spmDir, 'toolbox', 'ALI', 'Priors_extraClass', 'wc4prior0.nii) +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {lesionPriorMap}; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_size = 0.8; From 2d3164220826371e4e1cb8b2cd76b8a70c0c4dab Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 8 Mar 2021 14:39:04 -0500 Subject: [PATCH 3/8] add 3 batches for lesion detection --- src/batches/setBatchAbnormalitiesDetectLesion.m | 14 ++++++++++++++ src/batches/setBatchLesionOverlapMap.m | 6 ++++++ ...Lesion.m => setBatchSegmentationDetectLesion.m} | 11 +---------- 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100755 src/batches/setBatchAbnormalitiesDetectLesion.m create mode 100755 src/batches/setBatchLesionOverlapMap.m rename src/batches/{setBatchDetectLesion.m => setBatchSegmentationDetectLesion.m} (56%) diff --git a/src/batches/setBatchAbnormalitiesDetectLesion.m b/src/batches/setBatchAbnormalitiesDetectLesion.m new file mode 100755 index 00000000..337afe71 --- /dev/null +++ b/src/batches/setBatchAbnormalitiesDetectLesion.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/setBatchDetectLesion.m b/src/batches/setBatchSegmentationDetectLesion.m similarity index 56% rename from src/batches/setBatchDetectLesion.m rename to src/batches/setBatchSegmentationDetectLesion.m index ad516821..eca11150 100755 --- a/src/batches/setBatchDetectLesion.m +++ b/src/batches/setBatchSegmentationDetectLesion.m @@ -5,7 +5,7 @@ %----------------------------------------------------------------------- matlabbatch{1}.spm.tools.ali.unified_segmentation.step1data = ''; spmDir = spm('dir'); -lesionPriorMap = fullfile(spmDir, 'toolbox', 'ALI', 'Priors_extraClass', 'wc4prior0.nii) +lesionPriorMap = fullfile(spmDir, 'toolbox', 'ALI', 'Priors_extraClass', 'wc4prior0.nii'); matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {lesionPriorMap}; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; @@ -14,12 +14,3 @@ matlabbatch{1}.spm.tools.ali.unified_segmentation.step1mask = {''}; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1vox = 2; matlabbatch{1}.spm.tools.ali.unified_segmentation.step1fwhm = [8 8 8]; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3patients = ''; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3controls = ''; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3Alpha = 0.5; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3tissue.step3Lambda = -4; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3mask = {'C:\Users\michm\spm12\toolbox\ALI\Mask_image\mask_controls_vox2mm.nii'}; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3mask_thr = 0; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3binary_thr = 0.3; -matlabbatch{2}.spm.tools.ali.outliers_detection.step3binary_size = 0.8; -matlabbatch{3}.spm.tools.ali.lesion_overlap.lom = ''; From f22ee28d4db31cae9402544d0b4428a045c27195 Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 15 Mar 2021 15:43:49 -0400 Subject: [PATCH 4/8] turn batch into a function --- .../setBatchSegmentationDetectLesion.m | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/batches/setBatchSegmentationDetectLesion.m b/src/batches/setBatchSegmentationDetectLesion.m index eca11150..5591bf12 100755 --- a/src/batches/setBatchSegmentationDetectLesion.m +++ b/src/batches/setBatchSegmentationDetectLesion.m @@ -1,16 +1,37 @@ -%----------------------------------------------------------------------- -% Job saved on 08-Mar-2021 11:11:19 by cfg_util (rev $Rev: 7345 $) -% spm SPM - SPM12 (7771) -% cfg_basicio BasicIO - Unknown -%----------------------------------------------------------------------- -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1data = ''; +% (C) Copyright 2021 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchSegmentationDetectLesion(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('Segmentation for lesion detection'); + +% 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'); + matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {lesionPriorMap}; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_size = 0.8; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1coregister = 1; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1mask = {''}; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1vox = 2; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1fwhm = [8 8 8]; +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; % number of iterations +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; % threshold probability +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_size = 0.8; % threshold size (in cm3) +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1coregister = 1; % coregister in MNI space (yes: 1) +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1mask = {''}; % specify cost function mask CFM (optional) +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1vox = 2; % Voxel sizes (in mm) +matlabbatch{1}.spm.tools.ali.unified_segmentation.step1fwhm = [8 8 8]; % Smooth: FWHM + +end \ No newline at end of file From 95dd4563324e631ad18ff409f9835aa342082f3c Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 15 Mar 2021 16:35:15 -0400 Subject: [PATCH 5/8] rewrite batch structure --- src/batches/setBatchSegmentationDetectLesion.m | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/batches/setBatchSegmentationDetectLesion.m b/src/batches/setBatchSegmentationDetectLesion.m index 5591bf12..7c961d5c 100755 --- a/src/batches/setBatchSegmentationDetectLesion.m +++ b/src/batches/setBatchSegmentationDetectLesion.m @@ -25,13 +25,15 @@ % specify Prior EXTRA class (lesion prior map) lesionPriorMap = fullfile(spmDir, 'toolbox', 'ALI', 'Priors_extraClass', 'wc4prior0.nii'); -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1prior = {lesionPriorMap}; -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1niti = 2; % number of iterations -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_prob = 0.333333333333333; % threshold probability -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1thr_size = 0.8; % threshold size (in cm3) -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1coregister = 1; % coregister in MNI space (yes: 1) -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1mask = {''}; % specify cost function mask CFM (optional) -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1vox = 2; % Voxel sizes (in mm) -matlabbatch{1}.spm.tools.ali.unified_segmentation.step1fwhm = [8 8 8]; % Smooth: FWHM +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 From 39afc47bea8448f786bdc2bbde2a046d67d947a9 Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 15 Mar 2021 17:10:00 -0400 Subject: [PATCH 6/8] change batch names --- .../setBatchLesionAbnormalitiesDetection.m | 14 +++++++ src/batches/setBatchLesionSegmentation.m | 39 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 src/batches/setBatchLesionAbnormalitiesDetection.m create mode 100755 src/batches/setBatchLesionSegmentation.m 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/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 From 129de1fdffd32b7b7dcbc9141a9ab6d4a2c3b04c Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 15 Mar 2021 17:14:05 -0400 Subject: [PATCH 7/8] add lesion segmentation workflow --- .../setBatchAbnormalitiesDetectLesion.m | 14 ------ .../setBatchSegmentationDetectLesion.m | 39 ---------------- src/workflows/bidsLesionSegmentation.m | 44 +++++++++++++++++++ 3 files changed, 44 insertions(+), 53 deletions(-) delete mode 100755 src/batches/setBatchAbnormalitiesDetectLesion.m delete mode 100755 src/batches/setBatchSegmentationDetectLesion.m create mode 100755 src/workflows/bidsLesionSegmentation.m diff --git a/src/batches/setBatchAbnormalitiesDetectLesion.m b/src/batches/setBatchAbnormalitiesDetectLesion.m deleted file mode 100755 index 337afe71..00000000 --- a/src/batches/setBatchAbnormalitiesDetectLesion.m +++ /dev/null @@ -1,14 +0,0 @@ -%----------------------------------------------------------------------- -% 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/setBatchSegmentationDetectLesion.m b/src/batches/setBatchSegmentationDetectLesion.m deleted file mode 100755 index 7c961d5c..00000000 --- a/src/batches/setBatchSegmentationDetectLesion.m +++ /dev/null @@ -1,39 +0,0 @@ -% (C) Copyright 2021 CPP BIDS SPM-pipeline developers - -function matlabbatch = setBatchSegmentationDetectLesion(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('Segmentation for lesion detection'); - -% 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..5f4ff985 --- /dev/null +++ b/src/workflows/bidsLesionSegmentation.m @@ -0,0 +1,44 @@ +% (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, group] = setUpWorkflow(opt, 'lesion segmentation'); + + %% Loop through the groups, subjects, and sessions + for iGroup = 1:length(group) + + groupName = group(iGroup).name; + + parfor iSub = 1:group(iGroup).numSub + + subID = group(iGroup).subNumber{iSub}; + + printProcessingSubject(groupName, iSub, subID); + + matlabbatch = []; + matlabbatch = setBatchLesionSegmentation(matlabbatch, BIDS, opt, subID); + + saveAndRunWorkflow(matlabbatch, 'LesionSegmentation', opt, subID); + + end + end + +end \ No newline at end of file From fa149a9062361cc68bca6a62f493ffc6a42e9a22 Mon Sep 17 00:00:00 2001 From: Michele MacLean Date: Mon, 15 Mar 2021 17:34:26 -0400 Subject: [PATCH 8/8] rm group loop lesion segmentation workflow --- src/workflows/bidsLesionSegmentation.m | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/workflows/bidsLesionSegmentation.m b/src/workflows/bidsLesionSegmentation.m index 5f4ff985..91dde56f 100755 --- a/src/workflows/bidsLesionSegmentation.m +++ b/src/workflows/bidsLesionSegmentation.m @@ -20,25 +20,20 @@ function bidsLesionSegmentation(opt) opt = []; end - [BIDS, opt, group] = setUpWorkflow(opt, 'lesion segmentation'); + [BIDS, opt] = setUpWorkflow(opt, 'lesion segmentation'); - %% Loop through the groups, subjects, and sessions - for iGroup = 1:length(group) + parfor iSub = 1:numel(opt.subjects) - groupName = group(iGroup).name; + subLabel = opt.subjects{iSub}; - parfor iSub = 1:group(iGroup).numSub + printProcessingSubject(iSub, subLabel); - subID = group(iGroup).subNumber{iSub}; + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subLabel); - printProcessingSubject(groupName, iSub, subID); + saveAndRunWorkflow(matlabbatch, 'LesionSegmentation', opt, subLabel); - matlabbatch = []; - matlabbatch = setBatchLesionSegmentation(matlabbatch, BIDS, opt, subID); - - saveAndRunWorkflow(matlabbatch, 'LesionSegmentation', opt, subID); - - end end -end \ No newline at end of file +end +