Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/batches/setBatchLesionAbnormalitiesDetection.m
Original file line number Diff line number Diff line change
@@ -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 = '<UNDEFINED>';
matlabbatch{1}.spm.tools.ali.outliers_detection.step3tissue.step3controls = '<UNDEFINED>';
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;
6 changes: 6 additions & 0 deletions src/batches/setBatchLesionOverlapMap.m
Original file line number Diff line number Diff line change
@@ -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 = '<UNDEFINED>';
39 changes: 39 additions & 0 deletions src/batches/setBatchLesionSegmentation.m
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions src/workflows/bidsLesionSegmentation.m
Original file line number Diff line number Diff line change
@@ -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