Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. FOR STUFF TO BE IN THE RIGHT DIRECTORY
  2. >> pwd
  3.  
  4. ans =
  5.  
  6. '/Users/Charlotte/Documents/MATLAB'
  7.  
  8. >> ls
  9. MATLAB stuff
  10.  
  11. >> cd 'MATLAB stuff'/
  12. >> ls
  13. ratio30
  14.  
  15. >> cd ratio30/
  16. >>
  17.  
  18.  
  19. clear all; close all; clc
  20.  
  21. global MAXMEM; MAXMEM=256;
  22.  
  23. surf = SurfStatReadSurf( 'av.obj' );
  24.  
  25. mask = SurfStatMaskCut( surf );
  26.  
  27. maskb = (mask & SurfStatROI([0; -16; -8], 20, surf ) == 0);
  28.  
  29. [subject, RatioLeft, RatioRight, gender, age, scanner]...
  30. =textread('GLIMV123ratiowomissingSTRINGENT.csv', '%s %s %s %s %f %s');
  31.  
  32. clf; hist(age); xlabel('age')
  33.  
  34. R1 = SurfStatReadData( [RatioLeft] );
  35. R2 = SurfStatReadData( [RatioRight] );
  36. R3 = horzcat(R1, R2);
  37.  
  38.  
  39. Age = term( age );
  40. Gender = term ( gender );
  41. Scanner = term (scanner );
  42. Subject = term ( subject );
  43.  
  44. Ml = 1 + Age + Gender + random( Subject ) + I;
  45. Mq = 1 + Age + (Age)^2 + Gender + random( Subject ) + I;
  46. Mc = 1 + Age + (Age)^2 + (Age)^3 + Gender + random( Subject ) + I;
  47.  
  48. slm = SurfStatLinMod( R3, Ml, surf );
  49.  
  50. SurfStatView( slm.r.*mask, surf, 'Linear Model' );
  51.  
  52. slm = SurfStatT ( slm, Age);
  53.  
  54. slm = SurfStatT (slm, -age);
  55. % if want to look at T val
  56.  
  57. (SurfStatView ( slm.t.*maskb, surf, ' TVAL' );)
  58.  
  59. [ pval, peak, clus ] = SurfStatP( slm, maskb );
  60.  
  61. SurfStatView( pval, surf, 'PVAL LINEAR');
  62.  
  63. % QUICK WAY TO BYPASS THIS SHIT
  64.  
  65. slm = SurfStatT( SurfStatLinMod( R3, 1 + Age + Gender + random( Subject ) + I, surf ), Age );
  66. [ pval, peak, clus, clusid ] = SurfStatP( slm, mask );
  67. SurfStatView( pval, surf, 'PVAL LINEAR' );
  68.  
  69.  
  70. %THEN CLICK ON POINT OF INTEREST
  71. %THEN EITHER GET THE POINT WITH 10mm around OR
  72. %GET THE AREA
  73.  
  74.  
  75. >> maskROI = SurfStatROI( 67864, 10, surf );
  76. >> reselsROI = SurfStatResels( slm, maskROI );
  77. >> MlROI = mean( R3(:, maskROI), 2 );
  78. >> SurfStatPlot( Age, MlROI, Gender );
  79.  
  80.  
  81. %HOW TO DO THE CLUSTER ID WITHOUT EXCEEDING MATRIX SIZE
  82.  
  83. %HOW TO DO AN AVERAGE OF THE RATIOS IN THE REGION OF INTEREST??
  84.  
  85.  
  86. EXAMPLE::
  87.  
  88. >> global MAXMEM; MAXMEM=256;
  89.  
  90. surf = SurfStatReadSurf( 'av.obj' );
  91.  
  92. mask = SurfStatMaskCut( surf );
  93.  
  94. maskb = (mask & SurfStatROI([0; -16; -8], 20, surf ) == 0);
  95.  
  96. [subject, RatioLeft, RatioRight, gender, age, scanner]...
  97. =textread('GLIMV123ratio2ALLwomissingwoqcmarker.csv', '%s %s %s %s %f %s');
  98.  
  99. clf; hist(age); xlabel('age')
  100.  
  101. R1 = SurfStatReadData( [RatioLeft] );
  102. R2 = SurfStatReadData( [RatioRight] );
  103. R3 = horzcat(R1, R2);
  104. 752 x 1 files to read, % remaining: 100 90 80 70 60 50 40 30 20 10 0 Done
  105. 752 x 1 files to read, % remaining: 100 90 80 70 60 50 40 30 20 10 0 Done
  106. >> Age = term( age );
  107. Gender = term ( gender );
  108. Scanner = term (scanner );
  109. Subject = term ( subject );
  110. >>
  111. >> slm = SurfStatT( SurfStatLinMod( R3, 1 + Age + Gender + random( Subject ) + I, surf ), Age );
  112. [ pval, peak, clus, clusid ] = SurfStatP( slm, mask );
  113. SurfStatView( pval, surf, 'PVAL LINEAR' );
  114.  
  115. >> slm = SurfStatT( SurfStatLinMod( R3, 1 + Age + Gender + random( Subject ) + I, surf ), Age );
  116. [ pval, peak, clus, clusid ] = SurfStatP( slm, mask );
  117. SurfStatView( pval, surf, 'Linear model positive T value' );
  118.  
  119. id =
  120.  
  121. 25439
  122.  
  123. >>
  124. clusid( 25439 )
  125.  
  126. ans =
  127.  
  128. 5
  129.  
  130. >> maskROI = clusid == clusid( 25439 );
  131. >> Linearmodelcluster5 = mean( R3(:, maskROI), 2 );
  132.  
  133. >> SurfStatPlot( Age, Linearmodelcluster5, Gender );
  134.  
  135.  
  136. SO
  137. Linear with Age, screenshot positive correlations
  138. Then get average ratio in every cluster that comes out and plot against age
  139.  
  140. Linear with –age, screenshot negative correlations
  141. Then get average ratio in every cluster that comes out and plot against age.
  142.  
  143.  
  144.  
  145. THE ISSUE OF ADJUSTING FOR GENDER… SHOULD I DO IT FOR MEN AND WOMEN?? THEN HOW?? DIVIDE MY DATA IN MEN AND WOMEN??
  146.  
  147.  
  148. CAN ALSO COMBINE ROIs in their clusters to make one big one.
  149. CAN YOU GET A WAY FOR ALL THE CLUSTERS TO COME OUT OR YOU DO IT VISUALLY?
  150.  
  151. TO COMBINE ROIS, allows you to do the
  152. maskROI = maskROI1 | maskROI2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement