help > HCP-A/AABC Study Skipping Denoising
4 hours ago | zachbrod - The Ohio State University
HCP-A/AABC Study Skipping Denoising

Hello, 


I am wondering how I can skip denoising in CONN using the HCP-A/AABC study scans (AABC is a follow-up of the HCP-A Study). I am using the MNI-Space T1w image (T1w_restore_brain.nii.gz) and the 4# functional image (Ex: rfMRI_REST1_AP_hp0_clean_rclean_tclean.nii.gz) that have undergone sICA and tICA "denoising." 


How do I skip denoising using the conn_batch_humanconnectomeproject.m- I am copying over my edited script below. Also would I need to include Movement_Regressors.txt and still do ART Detection or no since the data has been "denoised" elsewhere. The script below still seems to be denoising the data when I don't want it to (unless it is recommended that I do as well as apply band-pass filtering 0.008-0.09Hz). 


Thank you in advance for your help!


-Zach


%% DEFAULT SETTINGS: EDIT THE LINES BELOW (minimally set CONNECTOMEpath to the actual location of your connectome data)
TARGETpath=pwd; % target folder for conn project (default current folder)
CONNECTOMEpath_T1w = '/fs/scratch/PAS2966/ZB_Directory/AABC/CONN/Data/T1w/%s/MNINonLinear/'; % source of connectome dataset (%s stands for numeric subject-specific folders)
CONNECTOMEpath_Resting = '/fs/scratch/PAS2966/ZB_Directory/AABC/CONN/Data/Resting/%s/MNINonLinear/Results/';
RUNPARALLEL=false; % run in parallel using computer cluster
NSUBJECTS=[4]; % number of subjects to include in your project (leave empty for all subjects)
NJOBS=[]; % number of parallel jobs to submit (leave empty for one job per subject)
COPYFILES=false; % true/false: set to true if you do not have write-permissions into connectome data folders
% This will create a local copy (in same folder as your conn project) of the structural/functional data where any post-processed files will also be stored.
OVERWRITE=false; % overwrites files if they exist in target folder (unzipped files and/or files in local-copy folder)
% Set to false if you have already unzipped / copied-to-local-folder your data and would like to skip this step


%% FINDS STRUCTURAL/FUNCTIONAL Files
clear FUNCTIONAL_FILE* STRUCTURAL_FILE;
subs=dir(regexprep(CONNECTOMEpath_T1w,'%s.*$','*'));
subs=subs([subs.isdir]>0);
subs={subs.name};
subs = subs(startsWith(subs,'HCA')); % keeps your HCA subject folders
if isempty(NSUBJECTS)
NSUBJECTS = numel(subs);
else
NSUBJECTS = min(NSUBJECTS, numel(subs));
subs = subs(1:NSUBJECTS);
end
if isempty(NJOBS), NJOBS=NSUBJECTS;
end
NJOBS=min(NSUBJECTS,NJOBS);

for n=1:numel(subs)
fprintf('Locating subject %s files\n',subs{n});

t1 = fullfile(sprintf(CONNECTOMEpath_T1w,subs{n}),'T1w_restore_brain.nii.gz'); %STRUCTURAL VOLUME
f1=fullfile(sprintf(CONNECTOMEpath_Resting,subs{n}),'rfMRI_REST1_AP','rfMRI_REST1_AP_hp0_clean_rclean_tclean.nii.gz'); % FUNCTIONAL VOLUME (1/4)
f2=fullfile(sprintf(CONNECTOMEpath_Resting,subs{n}),'rfMRI_REST1_PA','rfMRI_REST1_PA_hp0_clean_rclean_tclean.nii.gz'); % FUNCTIONAL VOLUME (2/4)
f3=fullfile(sprintf(CONNECTOMEpath_Resting,subs{n}),'rfMRI_REST2_AP','rfMRI_REST2_AP_hp0_clean_rclean_tclean.nii.gz'); % FUNCTIONAL VOLUME (3/4)
f4=fullfile(sprintf(CONNECTOMEpath_Resting,subs{n}),'rfMRI_REST2_PA','rfMRI_REST2_PA_hp0_clean_rclean_tclean.nii.gz'); % FUNCTIONAL VOLUME (4/4)
if isempty(dir(t1)), error('file %s not found',t1); end
if isempty(dir(f1)), error('file %s not found',f1); end
if isempty(dir(f2)), error('file %s not found',f2); end
if isempty(dir(f3)), error('file %s not found',f3); end
if isempty(dir(f4)), error('file %s not found',f4); end


if COPYFILES
fprintf('Copying files to local folder\n');
[ok,nill]=mkdir(TARGETpath,'LocalCopyDataFiles');
[ok,nill]=mkdir(fullfile(TARGETpath,'LocalCopyDataFiles'),subs{n});
t1b=fullfile(TARGETpath,'LocalCopyDataFiles',subs{n},'structural.nii.gz'); if OVERWRITE||isempty(dir(t1b)), [ok,nill]=system(sprintf('cp ''%s'' ''%s''',t1,t1b)); end; t1=t1b;
f1b=fullfile(TARGETpath,'LocalCopyDataFiles',subs{n},'functional1.nii.gz'); if OVERWRITE||isempty(dir(f1b)), [ok,nill]=system(sprintf('cp ''%s'' ''%s''',f1,f1b)); end; f1=f1b;
f2b=fullfile(TARGETpath,'LocalCopyDataFiles',subs{n},'functional2.nii.gz'); if OVERWRITE||isempty(dir(f2b)), [ok,nill]=system(sprintf('cp ''%s'' ''%s''',f2,f2b)); end; f2=f2b;
f3b=fullfile(TARGETpath,'LocalCopyDataFiles',subs{n},'functional3.nii.gz'); if OVERWRITE||isempty(dir(f3b)), [ok,nill]=system(sprintf('cp ''%s'' ''%s''',f3,f3b)); end; f3=f3b;
f4b=fullfile(TARGETpath,'LocalCopyDataFiles',subs{n},'functional4.nii.gz'); if OVERWRITE||isempty(dir(f4b)), [ok,nill]=system(sprintf('cp ''%s'' ''%s''',f4,f4b)); end; f4=f4b;

end
fprintf('Unzipping files\n');
if OVERWRITE||isempty(dir(regexprep(t1,'\.gz$',''))), gunzip(t1); end; t1=regexprep(t1,'\.gz$','');
if OVERWRITE||isempty(dir(regexprep(f1,'\.gz$',''))), gunzip(f1); end; f1=regexprep(f1,'\.gz$','');
if OVERWRITE||isempty(dir(regexprep(f2,'\.gz$',''))), gunzip(f2); end; f2=regexprep(f2,'\.gz$','');
if OVERWRITE||isempty(dir(regexprep(f3,'\.gz$',''))), gunzip(f3); end; f3=regexprep(f3,'\.gz$','');
if OVERWRITE||isempty(dir(regexprep(f4,'\.gz$',''))), gunzip(f4); end; f4=regexprep(f4,'\.gz$','');

STRUCTURAL_FILE{n,1}=t1;
FUNCTIONAL_FILE(n,1:4)={f1,f2,f3,f4};
end
nsessions=4;
fprintf('%d subjects, %d sessions\n',NSUBJECTS,nsessions);



%% CREATES CONN BATCH STRUCTURE
clear batch;
batch.filename=fullfile(TARGETpath,'conn_HCP_AABC.mat');
if RUNPARALLEL
batch.parallel.N=NJOBS; % number of parallel processing batch jobs
end % note: use default parallel profile (defined in GUI Tools.GridSettings)

% CONN Setup
batch.Setup.isnew=1;
batch.Setup.nsubjects=NSUBJECTS;
batch.Setup.RT=0.8; % TR (seconds)

batch.Setup.conditions.names={'rest'}; % single condition (aggregate across all sessions)
for ncond=1,for nsub=1:NSUBJECTS,for nses=1:nsessions, batch.Setup.conditions.onsets{ncond}{nsub}{nses}=0; batch.Setup.conditions.durations{ncond}{nsub}{nses}=inf;end;end;end % rest condition (all sessions)

batch.Setup.functionals=repmat({{}},[NSUBJECTS,1]); % Point to functional volumes for each subject/session
for nsub=1:NSUBJECTS,for nses=1:nsessions, batch.Setup.functionals{nsub}{nses}=FUNCTIONAL_FILE(nsub,nses);end; end

batch.Setup.structurals=STRUCTURAL_FILE; % Point to anatomical volumes for each subject

batch.Setup.voxelresolution=1; % default 2mm isotropic voxels analysis space... that is the resolution of the fMRI data anyway

batch.Setup.covariates.names={};
batch.Setup.covariates.files={};

batch.Setup.outputfiles=[0,0,0,0,0,0]; % creates d*.nii denoised output files
batch.Setup.analyses=[1,2]; % seed-to-voxel and ROI-to-ROI pipelines
batch.Setup.overwrite='Yes';
batch.Setup.done=1;

batch.Setup.preprocessing.steps={'structural_segment','functional_smooth'}; % Run additional preprocessing steps: segmentation & smoothing
batch.Setup.preprocessing.fwhm=4; % smoothing fwhm (mm)
conn_batch(batch);

clear batch;
% Do NOT run a denoising batch at all since HCP-A+AABC data are tICA+rICA cleaned for motion
batch.Denoising.filter=[-inf inf]; % no temporal filtering
batch.Denoising.detrending=0; % no detrending
batch.Denoising.confounds.names={}; % no nuisance regression
batch.Denoising.done=1;
batch.Denoising.overwrite='Yes';
conn_batch(batch);


clear batch;
% CONN Analysis % Default options (uses all ROIs in conn/rois/ as connectivity sources); see conn_batch for additional options
batch.Analysis.done=1;
batch.Analysis.overwrite='Yes';


%% RUNS CONN BATCH STRUCTURE
conn_batch(batch);