Hello,
I'm actually working with spm and got a script, that uses several spm
methods to transform anatomical and functional MR images into the MNI
space (Colin-Standard). This transformation is done on Dicom images,
which are transformed to Analyze format. This is done via loading
different workspaces after each other and using the spm_jobman method to
run the method. A rough sequence looks like this:
%Convertation from Dicoms
load se_convert.mat;....
spm_jobman('run',jobs)
%realignment of EPI data
load se_realign.mat....
spm_jobman('run',jobs)
%EPI Realignment
load se_mean.mat ....
spm_jobman('run',jobs)
%Coregistration T1 -> mean EPI
load se_coregister.mat;...
spm_jobman('run',jobs)
%Coregistration mean EPI -> MNI
load se_coregisterToMNI.mat;...
spm_jobman('run',jobs)
% Normalise
load se_segment.mat;
spm_jobman('run',jobs)
load se_normalise.mat
(I've also attached the whole script, calling all the methods)
If we use now some other Analyze files as input than those calculated
from Dicom, the outputs are horribly distorted. As it is hard to look
into the routines and reconstruct what is happing internally, some
questions about the functionality of the transformation occurred:
Which header information (regarding the analyze file) is required for
the transformation?
Is it the transformation based on the functional images and is the same
transformation just applied on the anatomical data?
Or would it also be possible to just transfer the anatomical images?
Because we've not found a way so far.
Is there a homogeneity correction included at some step of the
transformation?
I hope someone can help me and answer the one or the other question!
Thanks a lot
Corinna Vehlow
function TransformationToColin()
clear, clc
% set(0,'RecursionLimit',2000);
global defaults; spm_defaults
success = 0;
% All flags switched by 0 / 1
doDICOM = 0; %1 % DICOM conversion (EPI, wholebrains and T1)
doDelete = 0; %1 % delete dummies CAVE: files are irreversibly deleted and counted by available files (-> don't run twice!)
deleteDummies = 0; % CAVE (1), files are irreversibly deleted; CAVE (2) count by available files (-> don't run twice!)
% only if DicomMethod run before
doMeanWholeBrain = 0; % Create mean of additional wholebrain EPIs (only executed if wholeEPI is not {}
% -> Nur n�tig, wenn bei part-brain coverage zus�tzlich einige full-brain aufnahmen f�r die normalisierung aufgenommen wurden
doRealign = 0;%1 % Realignment der EPI-Daten
doMean = 0;%1 % EPI realignemnt --> Erstellt das mean EPI aus den realignten EPIs
doCoreg = 0;%1 % Coregister T1 -> mean EPI
doCoregMNI = 0;%1 % Coregister mean EPI -> MNI; Affine voranpassung in den MNI space, macht die unified segmentation robuster
doNormalise = 1;%1 % Normalise using unified segmentation (following initial affine coregistration into prior space for robstness)
% Berechnen der Normalisierungsvorschrift mittels unified segmentation
doWrite = 0;%1 % Write normalised EPIs, mean EPI and T1; Anwenden der Normalisierung
doMove = 0;%1 % Sorts the normalised files in the correct directories
doSmooth = 0 ; % Smooth EPI images
FWHM = 8;
%---Ordner f�r die einzelnen Daten
paths = {'Orig'; 'Normalised'; ['Smooth_' int2str(FWHM) 'mm']}; % Should stay like this
subjects = struct([]); % Separated by komma or semicolon
runs = {'1';'2';'3';'4';'5'}; % Separated by komma or semicolon
structurals = {'3D'}; % {} for none
wholeEPI = {}; % {} for none Characterarray with foldernames for Dicomdata
%---Pfade f�r die Daten setzen----
numP = 1;
set =1;
while set
dp = uigetdir; %('Select the data folder');
if dp==0
set = 0;
else
l = length(dp);
for i=l:-1:1
if (strcmp(dp(i),filesep)==1)
subjects{numP}=dp(i+1:l);
datapath{numP}=dp(1:i);
break;
end
end
numP = numP+1;
end
end
% Waitbar initialisieren
maxWait = numel(subjects)*(9+2); %Objektanzahl*Methodenanzahl
actWait = 0;
wb = waitbar(actWait, 'Please wait...the process will take some time!');
%------Durchlaufe alle Datens�tze-----------------
for sub = 1:numel(subjects) % numel(A) returns the number of elements, n, in array A
if doDICOM
waitbar(actWait,wb,'Please wait...Dicom conversion!');
% ---------- DICOM conversion --------------------
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep 'DICOM' filesep paths{1} filesep runs{ses}])==7
try
load se_convert.mat;
[Files, Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep 'DICOM' filesep paths{1} filesep runs{ses}], '*.*');
Files = [repmat([datapath{sub} subjects{sub} filesep 'DICOM' filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1,1}.util{1,1}.dicom.data{file,1} = [Files(file,:)];
end
% Orig\run{ses} wird erstellt
mkdir([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}]);
jobs{1,1}.util{1,1}.dicom.outdir = {[datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}]};
% wholeEPI{ses} = runs{ses};
spm_jobman('run',jobs)
end
end
end
if numel(wholeEPI)>0
load se_convert.mat;
mkdir([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1}]);
[Files, Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep 'DICOM' filesep paths{1} filesep wholeEPI{1}],'*.*');
Files = [repmat([datapath{sub} subjects{sub} filesep 'DICOM' filesep paths{1} filesep wholeEPI{1} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.util{1}.dicom.data{file,1} = [Files(file,:)];
end
jobs{1}.util{1}.dicom.outdir = {[datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1}]};
spm_jobman('run',jobs)
end
if numel(structurals)>0
load se_convert.mat;
% 3D Ordner wird erstellt
mkdir([datapath{sub} subjects{sub} filesep structurals{1}]);
[datapath{sub} subjects{sub} filesep 'DICOM' filesep structurals{1}]
[Files, Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep 'DICOM' filesep structurals{1}], '*.*');
Files = [repmat([datapath{sub} subjects{sub} filesep 'DICOM' filesep structurals{1} filesep],size(Files,1),1) Files];
jobs{1}.util{1}.dicom.data = {};
for file = 1:size(Files,1)
jobs{1}.util{1}.dicom.data{file,1} = [Files(file,:)];
end
jobs{1}.util{1}.dicom.outdir = {[datapath{sub} subjects{sub} filesep structurals{1}]};
spm_jobman('run',jobs)
end
end
if doDelete
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...deleting dummies!');
% ---------- Delete Dummys --------------------
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for ex = 1:deleteDummies
delete(Files(ex,:))
delete([Files(ex,1:end-3) 'hdr'])
end
end
end
end
if numel(wholeEPI)>0
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep],size(Files,1),1) Files];
for ex = 1:deleteDummies
delete(Files(ex,:))
delete([Files(ex,1:end-3) 'hdr'])
end
end
end
if doMeanWholeBrain && numel(wholeEPI)>0
load se_realign.mat
jobs{1}.spatial{1}.realign{1}.estwrite.data = {};
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.realign{1}.estwrite.data{1}(file,:) = [Files(file,:) ',1'];
end
spm_jobman('run',jobs)
end
if doRealign
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Realignment der EPI-Daten!');
% ---------- Realign --------------------
load se_realign.mat
jobs{1}.spatial{1}.realign{1}.estwrite.data = {};
if numel(wholeEPI)>0
jobs{1}.spatial{1}.realign{1}.estwrite.eoptionsrtm = 0;
mepi = dir([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep 'mean*.img']);
mEPI = [datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep mepi(1).name]
jobs{1}.spatial{1}.realign{1}.estwrite.data{1}(1,:) = mEPI;
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.realign{1}.estwrite.data{ses+1}(file,:) = [Files(file,:) ',1'];
end
end
end
end
spm_jobman('run',jobs)
mEPI = dir([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep 'mean*.img'])
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep mEPI.name],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img'])
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep mEPI.name(1:end-3) 'hdr'],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.hdr'])
delete([datapath{sub} subjects{sub} filesep paths{1} filesep wholeEPI{1} filesep 'mean*.*'])
else
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.realign{1}.estwrite.data{ses}(file,:) = [Files(file,:) ',1'];
end
end
end
end
spm_jobman('run',jobs)
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
mEPI = dir([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep 'mean*.img']);
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep mEPI.name],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img'])
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep mEPI.name(1:end-3) 'hdr'],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.hdr'])
end
end
end
end
end
if doMean
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...EPI Realignment!');
load se_mean.mat
jobs{1}.spatial{1}.realign{1}.write.data = {};
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.realign{1}.write.data{ses}(file,:) = [Files(file,:) ',1'];
end
end
end
end
spm_jobman('run',jobs)
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
mEPI = dir([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep 'mean*.img']);
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep mEPI.name],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img'])
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep mEPI.name(1:end-3) 'hdr'],...
[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.hdr'])
end
end
end
end
if doCoreg
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Coregistration T1 -> mean EPI!');
% ---------- Coregister T1 -> meanEPI --------------------
load se_coregister.mat;
jobs{1}.spatial{1}.coreg{1}.estimate.eoptions.sep = [4 2];
[source,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep structurals{1}],'*.img');
jobs{1}.spatial{1}.coreg{1}.estimate.source = {[datapath{sub} subjects{sub} filesep structurals{1} filesep source]};
jobs{1}.spatial{1}.coreg{1}.estimate.ref = {[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img']};
jobs{1}.spatial{1}.coreg{1}.estimate.source
jobs{1}.spatial{1}.coreg{1}.estimate.ref
spm_jobman('run',jobs)
end
if doCoregMNI
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Coregistration mean EPI -> MNI!');
% ---------- Affine registration into MNI space --------------------
load se_coregisterToMNI.mat;
jobs{1}.spatial{1}.coreg{1}.estimate.other = {};
cnt = 1;
[source,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep structurals{1}],'*.img');
jobs{1}.spatial{1}.coreg{1}.estimate.source = {[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img']};
jobs{1}.spatial{1}.coreg{1}.estimate.ref = {defaults.segment.estimate.priors(1,:);};
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.coreg{1}.estimate.other{cnt,1} = [Files(file,:) ',1'];
cnt = cnt+1;
end
end
end
end
jobs{1}.spatial{1}.coreg{1}.estimate.other{cnt,1} = [datapath{sub} subjects{sub} filesep structurals{1} filesep source];
spm_jobman('run',jobs)
end
if doNormalise
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Normalisation!');
% ---------- Normalise using unified segmentation -----
load se_segment.mat;
jobs{1}.spatial{1}.preproc.opts.tpm{1} = defaults.segment.estimate.priors(1,:);
jobs{1}.spatial{1}.preproc.opts.tpm{2} = defaults.segment.estimate.priors(2,:);
jobs{1}.spatial{1}.preproc.opts.tpm{3} = defaults.segment.estimate.priors(3,:);
jobs{1}.spatial{1}.preproc.data = {[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img']};
spm_jobman('run',jobs)
end
if doWrite
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...write AnalyseFiles!');
% ---------- Normalise --------------------
load se_normalise.mat; cnt = 1;
jobs{1}.util{1}.defs.comp{1}.comp{1}.sn2def.matname = {[datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI_seg_sn.mat']};
jobs{1}.util{1}.defs.comp{1}.comp{2}.sn2def.matname = {'colin27T1_seg_seg_inv_sn.mat'};
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.util{1}.defs.fnames{cnt,1} = [Files(file,:)];
cnt = cnt+1;
end
end
end
end
jobs{1}.util{1}.defs.fnames{cnt,1} = [datapath{sub} subjects{sub} filesep paths{1} filesep subjects{sub} '_meanEPI.img'];
if numel(structurals)>0
[source,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep structurals{1}],'*.img');
jobs{1}.util{1}.defs.fnames{cnt+1,1} = [datapath{sub} subjects{sub} filesep structurals{1} filesep source];
se_defs(jobs{1}.util{1}.defs)
end
end
if doMove
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...move Files!');
% ---------- Move normalised files --------------------
for ses =1:numel(runs)
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses}],'w*.*');
if exist([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}])==0
mkdir([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}]);
end
for f = 1:size(Files,1)
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep runs{ses} filesep Files(f,:)],...
[datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses} filesep Files(f,:)]);
end
end
end
% ---------- Move meanEPI files --------------------------
mkdir([datapath{sub} subjects{sub} filesep paths{2}]);
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep 'w' subjects{sub} '_meanEPI.img'],...
[datapath{sub} subjects{sub} filesep paths{2} filesep 'w' subjects{sub} '_meanEPI.img'])
movefile([datapath{sub} subjects{sub} filesep paths{1} filesep 'w' subjects{sub} '_meanEPI.hdr'],...
[datapath{sub} subjects{sub} filesep paths{2} filesep 'w' subjects{sub} '_meanEPI.hdr'])
% ---------- Move anatomical T1 files --------------------------
mkdir([datapath{sub} subjects{sub} filesep paths{2} filesep structurals{sub}]);
[Files, Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep structurals{1}], '*.*');
[num,b]=size(Files);
for i=1:num
fn = Files(i,:);
l = length(fn);
if (fn(1)=='w')
if (fn(l-3:l)=='.img')
movefile([datapath{sub} subjects{sub} filesep structurals{1} filesep fn],...
[datapath{sub} subjects{sub} filesep paths{2} filesep structurals{1} filesep 'w' subjects{sub} '.img'])
else
movefile([datapath{sub} subjects{sub} filesep structurals{1} filesep fn],...
[datapath{sub} subjects{sub} filesep paths{2} filesep structurals{1} filesep 'w' subjects{sub} '.hdr'])
end
end
end
end
if doSmooth
% ---------- Smooth --------------------
load se_smooth.mat; cnt = 1;
if numel(FWHM) == 1
jobs{1}.spatial{1}.smooth.fwhm = [FWHM FWHM FWHM];
else
jobs{1}.spatial{1}.smooth.fwhm = [FWHM(1:3)];
end
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}])==7
try
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}],'w*.img');
Files = [repmat([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses} filesep],size(Files,1),1) Files];
for file = 1:size(Files,1)
jobs{1}.spatial{1}.smooth.data{cnt,1} = [Files(file,:) ',1']; cnt = cnt+1;
end
end
end
end
spm_jobman('run',jobs)
% ---------- Move smoothed files --------------------
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}])==7
try
mkdir([datapath{sub} subjects{sub} filesep paths{3} filesep runs{ses}]);
[Files,Dirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}],'sw*.*');
for f = 1:size(Files,1)
movefile([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses} filesep Files(f,:)],...
[datapath{sub} subjects{sub} filesep paths{3} filesep runs{ses} filesep Files(f,:)]);
end
end
end
end
end
fprintf('Transformation to Colin Ready\n');
% ------------------------------------------------------------------------
% Umwandlung Analyse in VMR
% ------------------------------------------------------------------------
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Transformation to BV-Format - VMR!');
%---------Daten "einlesen"--------------------------------------
[VmrFiles,VmrDirs] = spm_list_files([datapath{sub} subjects{sub} filesep ...
paths{2} filesep structurals{1}],'w*.img*');
VmrFiles = [repmat([datapath{sub} subjects{1} filesep paths{2} filesep ...
structurals{sub} filesep],size(VmrFiles,1),1) VmrFiles];
VmrF = cell(size(VmrFiles,1),1);
for i=1:size(VmrFiles,1),
VmrF{i} = VmrFiles(i,:);
end
%--------Filename f�r vmr erstellen-------------------------------
fnVMR = [datapath{sub} subjects{sub} filesep paths{2} filesep subjects{sub} 'toColin' '.vmr'];
exportAnalyzeToVmr(VmrF,fnVMR);
% ------------------------------------------------------------------------
% Umwandlung von Analyze zu VTC
% ------------------------------------------------------------------------
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Please wait...Transformation to BV-Format - VTC!');
%--------Daten "einlesen"-------------------------------------------------
for ses =1:numel(runs)
if exist([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}])==7
try
[VtcFiles,VtcDirs] = spm_list_files([datapath{sub} subjects{sub} filesep paths{2}...
filesep runs{ses}],'w*.hdr');
VtcFiles = [repmat([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses} ...
filesep],size(VtcFiles,1),1) VtcFiles];
VtcF = cell(size(VtcFiles,1),1);
for i=1:size(VtcFiles,1),
VtcF{i} = VtcFiles(i,:);
end;
[num,a]=size(VtcF);
%--------Filename f�r vmr erstellen-------------------------------
fnVTC = [datapath{sub} subjects{sub} filesep paths{2} filesep ...
subjects{sub} 'toColin' 'Run' runs{ses} '.vtc'];
exportAnalyzeToVtc(VtcF,fnVTC);
end
end
end
actWait = actWait+(1/maxWait);
waitbar(actWait,wb,'Transform Analyze to BVformat Ready');
fprintf('Transform Analyze to BVformat Ready\n');
% %---------------------------------------------------------------------
% % Remove Data
% %---------------------------------------------------------------------
%
% % remove subject\Orig
% rmdir([datapath{sub} subjects{sub} filesep paths{1}],'s');
%
% % remove subject\3D
% rmdir([datapath{sub} subjects{sub} filesep structurals{1}],'s');
%
% % remove subject\Normalised\1
% for ses =1:numel(runs)
% try
% rmdir([datapath{sub} subjects{sub} filesep paths{2} filesep runs{ses}],'s');
% end
% end
%
% % remove subject\Normalised\3D
% rmdir([datapath{sub} subjects{sub} filesep paths{2} filesep structurals{1}],'s');
end
close(wb);
success = 1;
% INPUT Directory Structure
% Path to se_batchPreprocessing
% |
% |- Data (written like this, otherwise change in line 6)
% |
% |-Subject1 (name as provided by the variable "subjects")
% | |
% | |- DICOM
% | |
% | |- DICOM files for EPIs of Run 1 (directory name as provided by the variable "runs")
% | |- DICOM files for EPIs of Run 2 (directoryname as provided by the variable "runs") ...
% | |- DICOM files for EPIs of Run X (directoryname as provided by the variable "runs")
% | |- DICOM files for additional whole brain EPIs (directoryname as provided by the variable "wholeEPI")
% | |- DICOM files for anatomical T1 images (directoryname as provided by the variable "structurals")
% |
% |-Subject2 (name as provided by the variable "subjects")
% | |
% | |- DICOM
% | |
% | |- DICOM files for EPIs of Run 1 (directory name as provided by the variable "runs")
% | .
% | .
% | .
% |-Subject3 (name as provided by the variable "subjects")
% .
% .
% .
% OUTPUT Directory Structure
% Path to se_batchPreprocessing
% |
% |- Data (written like this, otherwise change in line 6)
% |
% |-Subject1 (name as provided by the variable "subjects")
% | |
% | |- DICOM
% | |- 3D
% | |- orig [Directory contains native-space and normalised mean EPI as well as the normalisation parameter file]
% | | |- Run 1 (directory name as provided by the variable "runs")
% | | |- Run 2 (directoryname as provided by the variable "runs") ...
% | | |- Run X (directoryname as provided by the variable "runs")
% | |
% | |- Normalised
% | | |- Run 1 (directory name as provided by the variable "runs")
% | | |- Run 2 (directoryname as provided by the variable "runs") ...
% | | |- Run X (directoryname as provided by the variable "runs")
% | |
% | |- Smooth_8mm
% | |- Run 1 (directory name as provided by the variable "runs")
% | |- Run 2 (directoryname as provided by the variable "runs") ...
% | |- Run X (directoryname as provided by the variable "runs")
% |-Subject2
% | |- DICOM
% | |- 3D
% | |- orig
% | |- Normalised
% | |- Smooth_8mm
% |-Subject3
|