Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hanayik committed Mar 8, 2018
1 parent 2bf142d commit a20c0a9
Show file tree
Hide file tree
Showing 180 changed files with 1,275 additions and 4,420 deletions.
153 changes: 125 additions & 28 deletions NiiStat.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
% NiiStat('LIME.xlsx',1,1,0,0.05,1)
%test

%Added by Roger to ensure right NiiStatGUI cfg file is opened and used

%[filepath, name,ext] = which('NiiStatGUI')
global usesGUI;

if which('NiiStatGUI')
temp = which('niistatGUI_cfg.mat');
[filepath, name, ext] = fileparts(temp);
GUI = load(temp);
if GUI.GUIdata.useClassicNiiStat == 1
usesGUI = false;
else
usesGUI = true;
end
else
usesGUI = false;
end

%manually set usesGUI
%usesGUI = false;

fprintf('Version 3 March 2017 of %s %s %s\n', mfilename, computer, version);
ver; %report complete version information, e.g. "Operating System: Mac OS X Version: 10.11.5 Build: 15F34"
if ~isempty(strfind(mexext, '32')), warning('Some features like SVM require a 64-bit computer'); end;
Expand All @@ -30,13 +51,23 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
checkForUpdate(fileparts(mfilename('fullpath')));
%checkForMostRecentMatFiles(repopath)

if isempty(which('spm')) || ~strcmp(spm('Ver'),'SPM12'), error('SPM12 required'); end;
%if (spm_update ~= 0), warning('SPM is obsolete, run "spm_update(true)"');end; % 5/12/2017 TH commented out due to SPM website outage.
if ~exist('xlsname','var')
[file,pth] = uigetfile({'*.xls;*.xlsx;*.txt;*.tab','Excel/Text file';'*.txt;*.tab','Tab-delimited text (*.tab, *.txt)';'*.val','VLSM/NPM text (*.val)'},'Select the design file');
if isequal(file,0), return; end;
xlsname=[pth file];
% updating SPM temportarily disabled by GY because SPM server is down
%if isempty(which('spm')) || ~strcmp(spm('Ver'),'SPM12'), error('SPM12 required'); end;
%if (spm_update ~= 0), warning('SPM is obsolete, run "spm_update(true)"'); end;
%%%

%%Added switch by Roger
if usesGUI
xlsname = GUI.GUIdata.excelFile;
else
if ~exist('xlsname','var')
[file,pth] = uigetfile({'*.xls;*.xlsx;*.txt;*.tab','Excel/Text file';'*.txt;*.tab','Tab-delimited text (*.tab, *.txt)';'*.val','VLSM/NPM text (*.val)'},'Select the design file');
if isequal(file,0), return; end;
xlsname=[pth file];
end
end


if (strcmpi('ver',xlsname)), return; end; %nii_stat('ver') cause software to report version and quit
if exist(xlsname,'file') ~= 2
error('Unable to find Excel file named %s\n',xlsname);
Expand Down Expand Up @@ -112,21 +143,44 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
def{5} = def{4};

end
answer = inputdlg(prompt,dlg_title,num_lines,def);
if isempty(answer), return; end;
save(cfg_filename,'answer') % save user preferences
numPermute = str2double(answer{1});
pThresh = str2double(answer{2});
minOverlap = str2double(answer{3});
if ~designUsesNiiImages
roiIndices = str2num(answer{4}); %#ok<ST2NM> - we need to read vectors
modalityIndices = str2num(answer{5}); %#ok<ST2NM> - we need to read vectors


%Added switch by Roger
if usesGUI
numPermute = GUI.GUIdata.numPermutations;
pThresh = GUI.GUIdata.correctedP;
minOverlap = GUI.GUIdata.minOverlap;
if ~designUsesNiiImages
roiIndices = GUI.GUIdata.atlasChoice;
modalityIndices = GUI.GUIdata.modalityChoice;
end
special = GUI.GUIdata.specialChoice;
else
answer = inputdlg(prompt, dlg_title, num_lines, def);
if isempty(answer), return; end;
save(cfg_filename,'answer') % save user preferences
numPermute = str2double(answer{1});
pThresh = str2double(answer{2});minOverlap = str2double(answer{3});
if ~designUsesNiiImages
roiIndices = str2num(answer{4}); %#ok<ST2NM> - we need to read vectors
modalityIndices = str2num(answer{5}); %#ok<ST2NM> - we need to read vectors
end
special = str2num(answer{6}); %#ok<ST2NM> - we need to read vectors
end
special = str2num(answer{6}); %#ok<ST2NM> - we need to read vectors



if any(special == 1) %select masking image
[mfile,mpth] = uigetfile('*.nii;*.hdr','Select the mask image');
if isequal(mfile,0), return; end;
maskName=[mpth mfile];

%%Added switch by Roger
if usesGUI
maskName = GUI.GUIdata.chosenMask;
else
[mfile,mpth] = uigetfile('*.nii;*.hdr','Select the mask image');
if isequal(mfile,0), return; end;
maskName=[mpth mfile];
end

end
if any(special == 2) %adjust behavior for lesion volume
regressBehav = true;
Expand Down Expand Up @@ -164,7 +218,13 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
if any (special == 12)
interhemi = true;
end
statname = answer{7};
%Added switch by Roger
if usesGUI
statname = GUI.GUIdata.resultsFolderName;
else
statname = answer{7};
end

end;
if designUsesNiiImages %voxelwise images do not have regions of interest, and are only a single modality
roiIndices = 0;
Expand All @@ -179,7 +239,8 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
specialStr = ['special=[', strtrim(sprintf('%d ',special)),'] '];
end
fprintf('Analyzing roi=%d, modality=%d, permute=%d, %sdesign=%s\n',roiIndex, modalityIndex,numPermute,specialStr, xlsname);
processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh, minOverlap, regressBehav, maskName, GrayMatterConnectivityOnly, deSkew, customROI, doTFCE, reportROIvalues, xlsname, kROIs, doSVM, doVoxReduce, hemiKey, interhemi, statname); %%GY
%Roger added GUI as last argument
processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh, minOverlap, regressBehav, maskName, GrayMatterConnectivityOnly, deSkew, customROI, doTFCE, reportROIvalues, xlsname, kROIs, doSVM, doVoxReduce, hemiKey, interhemi, statname,GUI); %%GY
end
end
%end nii_stat_mat()
Expand Down Expand Up @@ -253,7 +314,8 @@ function NiiStat(xlsname, roiIndices, modalityIndices,numPermute, pThresh, minOv
% end
% %end readDesign()

function processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh, minOverlap, regressBehav, mask_filename, GrayMatterConnectivityOnly, deSkew, customROI, doTFCE, reportROIvalues, xlsname, kROIs, doSVM, doVoxReduce, hemiKey, interhemi, statname) %%GY
%Roger added GUI as input argument
function processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh, minOverlap, regressBehav, mask_filename, GrayMatterConnectivityOnly, deSkew, customROI, doTFCE, reportROIvalues, xlsname, kROIs, doSVM, doVoxReduce, hemiKey, interhemi, statname,GUI) %%GY
%GrayMatterConnectivityOnly = true; %if true, dti only analyzes gray matter connections
%kROIs = strvcat('bro','jhu','fox','tpm','aal','catani'); %#ok<*REMFF1>
%kModalities = strvcat('lesion','cbf','rest','i3mT1','i3mT2','fa','dti','md'); %#ok<REMFF1> %lesion, 2=CBF, 3=rest
Expand Down Expand Up @@ -585,10 +647,46 @@ function processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh,
%NEXT roi masking
roiMaskI = []; %inclusive ROI mask - e.g. if [1 2 12] then only these 3 regions analyzed...
les_names = cellstr(subj_data{1}.(ROIfield).label); %les_names = cellstr(data.(ROIfield).label);

if customROI
answer = inputdlg(['Only include the following regions (1..', sprintf('%d',numel(les_names)),')'] ,'ROI inclusion criteria',1,{'1 2 6 8'});
if isempty(answer), return; end;
roiMaskI = str2num(answer{1});

%Roger Added the switches below based on the GUI.GUIdata through
%line 682
if GUI.GUIdata.useClassicNiiStat == 1
answer = inputdlg(['Only include the following regions (1..', sprintf('%d',numel(les_names)),')'] ,'ROI inclusion criteria',1,{'1 2 6 8'});
if isempty(answer), return; end;
roiMaskI = str2num(answer{1});
end

if GUI.GUIdata.useClassicNiiStat == 0

if isequal(ROIfield,'lesion_fox') %lesion_fox
roiMaskI = GUI.GUIdata.fox_picks
end
if isequal(ROIfield,'lesion_aal') %lesion_aal
roiMaskI = GUI.GUIdata.aal_picks
end
if isequal(ROIfield,'lesion_aalcat') %lesion_aalcat
roiMaskI = GUI.GUIdata.aalcat_picks
end
if isequal(ROIfield,'lesion_jhu') %lesion_jhu
roiMaskI = GUI.GUIdata.jhu_picks
end
if isequal(ROIfield,'lesion_aicha')
roiMaskI = GUI.GUIdata.aicha_picks
end
if isequal(ROIfield,'lesion_bro') %lesion_bro
roiMaskI = GUI.GUIdata.brodmann_picks
end
if isequal(ROIfield,'lesion_catani') %lesion_catani
roiMaskI = GUI.GUIdata.catani_picks
end
if isequal(ROIfield,'lesion_cat') %lesion_cat
roiMaskI = GUI.GUIdata.cat_picks
end
end


else
global global_roiMask
roiMaskI = global_roiMask; %inclusion mask
Expand Down Expand Up @@ -889,7 +987,7 @@ function processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh,
%end

if doSVM
nii_stat_svm(les1, beh1, beh_names1,statname, les_names, subj_data, roiName, logicalMask1);
nii_stat_svm(les1, beh1, beh_names1,statname, les_names, subj_data, roiName, logicalMask1, hdr);
else
%nii_stat_core(les1, beh1, beh_names1,hdr, pThresh, numPermute, minOverlap,statname, les_names,hdrTFCE, voxMask);
nii_stat_core(les1, beh1, beh_names1,hdr, pThresh, numPermute, logicalMask1,statname, les_names,hdrTFCE);
Expand All @@ -907,7 +1005,7 @@ function processExcelSub(designMat, roiIndex, modalityIndex,numPermute, pThresh,
%les_names(2:2:end)=[]; % Remove even COLUMNS: right in AALCAT: analyze left
%les(:,2:2:end)=[]; % Remove even COLUMNS: right in AALCAT: analyze left
if doSVM
nii_stat_svm(les, beh, beh_names, statname, les_names, subj_data, roiName, logicalMask);
nii_stat_svm(les, beh, beh_names, statname, les_names, subj_data, roiName, logicalMask, hdr);
else
nii_stat_core(les, beh, beh_names,hdr, pThresh, numPermute, logicalMask,statname, les_names, hdrTFCE);
end
Expand Down Expand Up @@ -1206,7 +1304,6 @@ function checkForUpdate(repoPath)
warning(sprintf('To enable updates run "!git clone git@github.com:neurolabusc/%s.git"\n or "!git clone git clone https://github.com/neurolabusc/%s.git"',mfilename,mfilename));
end
cd(prevPath);
disp('finished checkForUpdate!')
%end checkForUpdate()

function showRestartMsg
Expand Down
19 changes: 19 additions & 0 deletions NiiStatGUI/GetROIFilesGivenDirectory.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function roifileresults = GetROIFilesGivenDirectory(roidirname)

onefile = which('jhu.txt');
onefilelength = length(onefile);
roifolder = fullfile(onefile(1:onefilelength-11),roidirname);

%find roi files in that folder
files = dir(roifolder);
L = length(files);
index = false(1, L);
for k = 1:L
M = length(files(k).name);
if M > 4 && strcmp(files(k).name(M-2:M), 'txt')
index(k) = true;
end
end
roifileresults = files(index);

end
24 changes: 24 additions & 0 deletions NiiStatGUI/GetROINamesFromFile.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function outty = GetROINamesFromFile(fname,indx)

fileID = fopen(fname,'r');
C = textscan(fileID,'%s %s %s %s %s %s','Delimiter','|');

fclose(fileID);

for i = 1:length(C{1})
C{4}{i} = strcat( C{1}{i} ,'|',C{2}{i},'|',C{3}{i} );
end

outty = C{4};

end

%
% fileID = fopen('jhu.txt');
% while fgetl(fileID) ~= -1
% ln = fgetl(fileID);
% fprintf(ln);
% %fprintf('\n');
%
% end
%
7 changes: 7 additions & 0 deletions NiiStatGUI/GetROIPathGivenDirectoryName.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function roifiledir = GetROIPathGivenDirectoryName(roidirname)

onefile = which('jhu.txt');
onefilelength = length(onefile);
roifiledir = fullfile(onefile(1:onefilelength-11),roidirname);

end
Binary file added NiiStatGUI/NiiStatGUI.mlapp
Binary file not shown.
5 changes: 5 additions & 0 deletions NiiStatGUI/PlayMusic.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function PlayMusic
[y, Fs] = audioread('backgroundMusic_01.mp3');
player = audioplayer(y, Fs);
play(player)
end
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/InterHemispheric.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/LESION.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/aal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/aalcat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/aicha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/brodmann.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/cbf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/download.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/fmri.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/fox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/grigori.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/jhu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/ATLAS/voxels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/GoldShield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/GreenRoundedButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide1 copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide12.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide13.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide15.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide16.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide17.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide18.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide20.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide22.png
Binary file added NiiStatGUI/UIBUTTONS/UI/Slide9.png
Binary file added NiiStatGUI/UIBUTTONS/UI/buttongreen.png
Binary file added NiiStatGUI/UIBUTTONS/UI/buttonyellow.png
Binary file added NiiStatGUI/UIBUTTONS/UI/frame1.png
Binary file added NiiStatGUI/UIBUTTONS/UI/frame2.png
Binary file added NiiStatGUI/UIBUTTONS/UI/frame3.png
Binary file added NiiStatGUI/UIBUTTONS/UI/frameempty.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem1.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem2.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem3.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem3backup.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem3backup2.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem4.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gem_red.png
Binary file added NiiStatGUI/UIBUTTONS/UI/gemback.png
Binary file added NiiStatGUI/UIBUTTONS/UI/green.png
Binary file added NiiStatGUI/UIBUTTONS/UI/greenT.png
Binary file added NiiStatGUI/UIBUTTONS/UI/marcia.png
Binary file added NiiStatGUI/UIBUTTONS/UI/mover.png
Binary file added NiiStatGUI/UIBUTTONS/UI/norlunds.png
Binary file added NiiStatGUI/UIBUTTONS/UI/progressgreen.png
Binary file added NiiStatGUI/UIBUTTONS/UI/progressred.png
Binary file added NiiStatGUI/UIBUTTONS/UI/red.png
Binary file added NiiStatGUI/UIBUTTONS/UI/redT.png
Binary file added NiiStatGUI/UIBUTTONS/UI/rew.png
Binary file added NiiStatGUI/UIBUTTONS/UI/roundbuttonblue.png
Binary file added NiiStatGUI/UIBUTTONS/UI/roundbuttongrey.png
Binary file added NiiStatGUI/UIBUTTONS/UI/s10.png
Binary file added NiiStatGUI/UIBUTTONS/UI/shop.png
Binary file added NiiStatGUI/UIBUTTONS/UI/white_web_button.png
Binary file added NiiStatGUI/UIBUTTONS/UI/yellow.png
Binary file added NiiStatGUI/UIBUTTONS/UI/yellowT.png
Binary file added NiiStatGUI/backgroundMusic_01.mp3
Binary file not shown.
Binary file added NiiStatGUI/niistatGUI_cfg.mat
Binary file not shown.
Binary file added NiiStatGUI/niistat_cfg.mat
Binary file not shown.
18 changes: 18 additions & 0 deletions NiiStatGUI/roiNames2roiNumbers.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function roiNumVec = roiNames2roiNumbers(cellNameArray)
%Takes an array of cells that specify text read in from the ROI file
%and extracts the numbers at the beginning (before the first | character)
%and places them in a 1xX vector of integers (note uses str2double as that
%works on cell array whereas str2int does not automatically work in that
%way.

roiNumVec = [];

for i = 1:length(cellNameArray)
roiNumVec = cat(2,roiNumVec,round(str2double(strtok(cellNameArray(i),'|'))));

end

%roiNumVec

end

Empty file modified fdr_bh.m
100755 → 100644
Empty file.
Empty file modified gitlfs/git-lfs
100755 → 100644
Empty file.
Empty file modified gitlfs/install.sh
100755 → 100644
Empty file.
Empty file modified glm/xl_xls2mat.m
100755 → 100644
Empty file.
Empty file modified libsvm/COPYRIGHT_libSVM_3.18.txt
100755 → 100644
Empty file.
Empty file modified libsvm/Makefile
100755 → 100644
Empty file.
Empty file modified libsvm/README
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmread.c
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmread.mexa64
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmread.mexmaci64
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmread.mexw64
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmwrite.c
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmwrite.mexa64
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmwrite.mexmaci64
100755 → 100644
Empty file.
Empty file modified libsvm/libsvmwrite.mexw64
100755 → 100644
Empty file.
Empty file modified libsvm/make.m
100755 → 100644
Empty file.
Empty file modified libsvm/matlab.zip
100755 → 100644
Empty file.
Empty file modified libsvm/svm_model_matlab.c
100755 → 100644
Empty file.
Empty file modified libsvm/svm_model_matlab.h
100755 → 100644
Empty file.
Empty file modified libsvm/svmpredict.c
100755 → 100644
Empty file.
Empty file modified libsvm/svmpredict.mexa64
100755 → 100644
Empty file.
Empty file modified libsvm/svmpredict.mexmaci64
100755 → 100644
Empty file.
Empty file modified libsvm/svmpredict.mexw64
100755 → 100644
Empty file.
Empty file modified libsvm/svmtrain.c
100755 → 100644
Empty file.
Empty file modified libsvm/svmtrain.mexa64
100755 → 100644
Empty file.
Empty file modified libsvm/svmtrain.mexmaci64
100755 → 100644
Empty file.
Empty file modified libsvm/svmtrain.mexw64
100755 → 100644
Empty file.
Empty file modified libsvm/windows/libsvm.dll
100755 → 100644
Empty file.
Empty file modified libsvm/windowsLIBSVM.zip
100755 → 100644
Empty file.
Empty file modified nii_make_roi.m
100755 → 100644
Empty file.
Empty file modified nii_mat2nii.m
100755 → 100644
Empty file.
Empty file modified nii_mat2ortho.m
100755 → 100644
Empty file.
Empty file modified nii_matver.m
100755 → 100644
Empty file.
Empty file modified nii_mergestruct.m
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions nii_nii2mat.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ function nii_nii2mat (niinames, modalityIndex, disknames, roi)
end;
%s = nii_roi2stats('jhu','LS_LM1001.nii','','','lesion_') %3d volume
statfield = [Voxfield '_'];

new = nii_roi2stats(ROIname,hdr,img,statfield);
stat = nii_mergestruct(stat,new);
end;
Expand Down
Empty file modified nii_nii2matReport.m
100755 → 100644
Empty file.
Empty file modified nii_nii2roi.m
100755 → 100644
Empty file.
Empty file modified nii_reslice_target.m
100755 → 100644
Empty file.
Empty file modified nii_roi2mm.m
100755 → 100644
Empty file.
18 changes: 13 additions & 5 deletions nii_roi2stats.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
inimg(:,:,i,v) = spm_slice_vol(inimgOrig1, M, imgdim(1:2), 1); % (linear interp)
end
end; %for each volume

% h =rhdr(1);
% h.fname = 'test.nii';
% h.dt(1) = 16; %float
% spm_write_vol(h,inimg(:,:,:,1));
else
%for 4D images, we reslice the ROI to match the imag
rimgOrig = rimg; %load input image
Expand All @@ -91,14 +96,13 @@
M = inv(spm_matrix([0 0 -i])*inv(inhdr(1).mat)*rhdr.mat); %#ok<MINV>
rimg(:,:,i) = spm_slice_vol(rimgOrig, M, imgdim(1:2), 0); % (nearest neighbor interp)
end
%h =inhdr(1);
%h.fname = 'test.nii';
%h.dim = inhdr(1).dim(1:3);
%spm_write_vol(h,rimg);
% h =inhdr(1);
% h.fname = 'test.nii';
% h.dim = inhdr(1).dim(1:3);
% spm_write_vol(h,rimg);
end
end %if image must be resliced to match ROI
if size(inimg,4) == 1 %3D data

stat.(proi).mean = roiMeanSub (inimg, rimg);
if (size(stat.(proi).label,1) ~= size(stat.(proi).mean,1))
error('Error: somthing is wrong with the ROI file: %d labels but %d regions', size(stat.(proi).label,1), size(stat.(proi).mean,1));
Expand Down Expand Up @@ -137,13 +141,17 @@
return;
end
nroi = max(rimg(:));
%save('img.mat','-struct','img');
%save('rimg.mat','-struct','rimg');
%rimg(isnan(img)) = 0; %<- a simpler way to handle NaNs?
mn = zeros(nroi,1);
for r = 1:nroi
%idx = (rimg(:) == r);
idx = (rimg(:) == r) & (~isnan(img(:)) );
mn(r) = mean(img(idx));
%fprintf('Region %d has %d voxels with a mean of %f\n',r,sum(idx), mn(r));
end

%end roiMeanSub

function [r,p] = roiCorrelSub (img, rimg, showGraph)
Expand Down
Loading

0 comments on commit a20c0a9

Please sign in to comment.