Skip to content

Commit

Permalink
running analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
alinal committed Feb 11, 2013
1 parent 4423f99 commit c1934cc
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion users/Rachel/LGN_Code/rd_centerOfMassGroupAnalysis.m
Expand Up @@ -49,7 +49,7 @@
end

% subjects = 1:size(subjectDirs,1);
subjects = 7:8;
subjects = [1 2 3 4 5 8];
nSubjects = numel(subjects);

mmMat = repmat(voxelSize,nSubjects,1);
Expand Down
6 changes: 3 additions & 3 deletions users/Rachel/LGN_Code/rd_centerOfMassNormGroupAnalysis.m
Expand Up @@ -4,13 +4,13 @@
[subjectDirs3T subjectDirs7T] = rd_lgnSubjects;

scanner = '7T';
mapName = 'betaM';
mapName = 'betaM-P';
prop = 0.2;
analysisExtension = sprintf('centerOfMassNorm_%s_prop%d_*', mapName, round(prop*100));
hemis = [1 2];

plotFigs = 1;
saveFigs = 1;
saveFigs = 0;
saveAnalysis = 0;

MCol = [220 20 60]./255; % red
Expand Down Expand Up @@ -48,7 +48,7 @@
cVarThresh = 0;

% subjects = 1:size(subjectDirs,1);
subjects = [7 8];
subjects = [1:4];
nSubjects = numel(subjects);

%% File I/O
Expand Down
4 changes: 2 additions & 2 deletions users/Rachel/LGN_Code/rd_getAnalysisFilePath.m
Expand Up @@ -3,7 +3,8 @@
% function filePath = rd_getAnalysisFilePath(subjectDirs, scanner, subject, hemi, analysisExtension)
%
% gets the filepath to a specific analysis file for any subject and
% hemisphere.
% hemisphere. if no analysis file is specified, will still return the file
% directory.

allowWildcardExtension = 1;

Expand Down Expand Up @@ -44,5 +45,4 @@
else
fileName = [];
filePath = [];
fprintf('\nSorry, the analysis file was not sufficiently specified. Check arguments.\n\n')
end
8 changes: 3 additions & 5 deletions users/Rachel/LGN_Code/rd_lgnSubjects.m
Expand Up @@ -12,12 +12,10 @@

subjectDirs7T = {'KS_20111212_Session', 'KS_20111212_15mm', 'ROIX01';
'AV_20111213_Session', 'AV_20111213', 'ROIX01';
'KS_20111214_Session', 'KS_20111214', 'ROIX01/Runs1.3-7';
'KS_20111214_Session', 'KS_20111214', 'ROIX01/Runs1-7';
'RD_20111214_Session', 'RD_20111214', 'ROIX01';
'KS_20111212_Session', 'KS_20111212_125mm', 'ROIX01';
'MN_20120806_Session', 'MN_20120806', 'ROIX01';
'MN_20120806_Session', 'MN_20120806', 'Runs1-5/ROIX02';
'SB_20120807_Session', 'SB_20120807', 'ROIX01';
'JN_20120808_Session', 'JN_20120808', 'ROIX01';
'RD_20120809_Session', 'RD_20120809_axial', 'ROIX01';
% 'JN_20120808_Session', 'JN_20120808_spmDC', 'ROIX01';
'JN_20120808_Session', 'JN_20120808_fslDC', 'ROIX01'};
'RD_20120809_Session', 'RD_20120809_axial', 'ROIX01'};
8 changes: 4 additions & 4 deletions users/Rachel/LGN_Code/rd_mrXformCentersCoordsToVolCoords.m
@@ -1,4 +1,4 @@
% rd_mrXformCentersCoordsToVolCoords.m
function rd_mrXformCentersCoordsToVolCoords(hemi, mapName)
%
% Transforms center of mass cordinates from epi coords to volume coords, in
% order to reorient them to a canonical upright orientation.
Expand All @@ -10,9 +10,9 @@
% 2013 Feb 6

%% Setup
hemi = 1;

mapName = 'betaM-P';
% hemi = 1;
%
% mapName = 'betaM-P';

switch mapName
case 'betaM-P'
Expand Down
24 changes: 13 additions & 11 deletions users/Rachel/LGN_Code/rd_normalizeCenterOfMass.m
Expand Up @@ -19,12 +19,12 @@ function rd_normalizeCenterOfMass(hemi, mapName)
case 'betaP'
prop = 0.8;
otherwise
error ('mapName not recognized when setting prop and betaCoefs')
error ('mapName not recognized when setting prop')
end

plotFigs = 1;
saveAnalysis = 0;
saveFigs = 0;
saveAnalysis = 1;
saveFigs = 1;

%% colors
MCol = [220 20 60]./255; % red
Expand Down Expand Up @@ -85,14 +85,15 @@ function rd_normalizeCenterOfMass(hemi, mapName)
ipVoxSize = mrSESSION.inplanes.voxelSize;
volVoxSize = [1 1 1];
xform = mrSESSION.alignment;
% find volume ROI coordinates - convert from inplane to volume
% Find volume ROI coordinates - convert from Inplane to Volume
coordsTemp = xformROIcoords(figData.coordsAnatomy, xform, ipVoxSize, ...
volVoxSize); % coordsAnatomy are in inplane (gems) space
% For Vol coords, need to switch axi and sag dimensions and need to
% flip the A-P and D-V directions
% flip the A-P and D-V directions to make it match the epi coords
% (and what the plots expect)
coords(1,:) = coordsTemp(3,:); % Sag --> x
coords(2,:) = coordsTemp(2,:)*(-1); % Cor --> y, flip A-P
coords(3,:) = coordsTemp(1,:)*(-1); % Axi --> z, flip D-V
coords(2,:) = coordsTemp(2,:)*(-1); % Cor --> y, flip A-P --> P-A
coords(3,:) = coordsTemp(1,:)*(-1); % Axi --> z, flip D-V --> V-D
otherwise
error('coordsType not recognized.')
end
Expand All @@ -105,11 +106,12 @@ function rd_normalizeCenterOfMass(hemi, mapName)
case 'Volume'
centersTemp{1} = C.centers1Vol;
centersTemp{2} = C.centers2Vol;
% For Vol centers, need to switch axi and sag dimensions
% For Vol centers, need to switch axi and sag dimensions and flip
% A-P and D-V directions
for iC = 1:numel(centersTemp)
centers{iC}(:,1) = centersTemp{iC}(:,3); % Sag --> x
centers{iC}(:,2) = centersTemp{iC}(:,2)*(-1); % Cor --> y, flip A-P
centers{iC}(:,3) = centersTemp{iC}(:,1)*(-1); % Axi --> z, flip D-V
centers{iC}(:,2) = centersTemp{iC}(:,2)*(-1); % Cor --> y, flip A-P --> P-A
centers{iC}(:,3) = centersTemp{iC}(:,1)*(-1); % Axi --> z, flip D-V --> V-D
end
otherwise
error('coordsType not recognized.')
Expand All @@ -132,7 +134,7 @@ function rd_normalizeCenterOfMass(hemi, mapName)

%% save analysis
if saveAnalysis
save(analysisFile, 'C', 'coords', 'centers', 'centersNorm')
save(analysisFile, 'coordsType', 'C', 'coords', 'centers', 'centersNorm')
end

%% plot figs
Expand Down
13 changes: 9 additions & 4 deletions users/Rachel/LGN_Code/rd_runIndivAnalysis.m
Expand Up @@ -10,7 +10,7 @@
subjectDirs = subjectDirs7T;
end

subjects = [10 11];
subjects = [6];
% subjects = 1:size(subjectDirs,1);
nSubjects = numel(subjects);

Expand Down Expand Up @@ -67,9 +67,14 @@

% % center of mass sequence
% rd_centerOfMass_multiVoxData
% rd_normalizeCenterOfMass
% rd_centerOfMassNormGroupAnalysis (makes the good XZ plots)
% rd_centerOfMassGroupAnalysis (used for center of mass interaction)
for hemi = 1:2
for mapName = {'betaM-P','betaM','betaP'}
rd_mrXformCentersCoordsToVolCoords(hemi,mapName{1}); % (if converting to Volume coords)
rd_normalizeCenterOfMass(hemi,mapName{1}); % (option for Volume coords)
end
end
% rd_centerOfMassNormGroupAnalysis % (makes the good XZ plots)
% rd_centerOfMassGroupAnalysis % (used for center of mass interaction)
% rd_centerOfMassGroupMPInteraction

end
Expand Down

0 comments on commit c1934cc

Please sign in to comment.