Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

plot_val_arrays.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. function plot_val_arrays(vals,monkey)
  2. % project a set of values in cortical/array space
  3. % vals = 1x1024
  4. % monkey = 'F' or 'N'
  5. % warning: some info are handcrafted, so it'll only work with 'F' and 'N'
  6. % 2024 P.Papale fecit
  7. img = imread(['\_code\code_utils_v2\_figs\',monkey,'_array.png']);
  8. bw = im2bw(img);
  9. stats = regionprops(not(bw),'Centroid');
  10. vals(isnan(vals))=-Inf;
  11. if monkey == 'F'
  12. arrays_order = [16,15,14,13,12,11,10,9,1,2,3,4,5,7,6,8];
  13. else
  14. arrays_order = [10,9,11,12,14,13,15,6,8,7,5,3,4,2,1];
  15. vals(1+64*(6-1):64*6) = [];
  16. end
  17. stats = stats(arrays_order);
  18. [Xq,Yq] = meshgrid(-75:150/8:75,-75:150/8:75);
  19. z = ones(size(Xq));
  20. XY = [Xq(:) Yq(:)];
  21. theta=90; %TO ROTATE CLOCKWISE BY X DEGREES
  22. R=[cosd(theta) -sind(theta); sind(theta) cosd(theta)]; %CREATE THE MATRIX
  23. rotXY1=XY*R'; %MULTIPLY VECTORS BY THE ROT MATRIX
  24. Xqr = reshape(rotXY1(:,1), size(Xq,1), []);
  25. Yqr = reshape(rotXY1(:,2), size(Yq,1), []);
  26. XY = [Xqr(:) Yqr(:)];
  27. theta=45; %TO ROTATE CLOCKWISE BY X DEGREES
  28. R=[cosd(theta) -sind(theta); sind(theta) cosd(theta)]; %CREATE THE MATRIX
  29. rotXY=XY*R'; %MULTIPLY VECTORS BY THE ROT MATRIX
  30. for i = 1:length(arrays_order)
  31. if monkey == 'F' && i >=14 && i <=16
  32. Xqr = reshape(rotXY(:,1), size(Xqr,1), []);
  33. Yqr = reshape(rotXY(:,2), size(Yqr,1), []);
  34. end
  35. C = reshape(vals(1+64*(i-1):64*i),[8 8]);
  36. %SHIFTING
  37. Xqrs = Xqr+stats(i).Centroid(1);
  38. Yqrs = Yqr+stats(i).Centroid(2);
  39. fvc = surf2patch(Xqrs,Yqrs,z,C);
  40. p=patch(fvc);
  41. shading faceted
  42. hold on
  43. idx = i;
  44. if monkey == 'N' && i > 5
  45. idx = i+1;
  46. end
  47. text(stats(i).Centroid(1),stats(i).Centroid(2),mat2str(idx),'color','r')
  48. end
  49. objs=findall(gcf,'-property','FaceColor');
  50. set(objs,'EdgeColor','w')
  51. xlim([50 1890])
  52. ylim([50 550])
  53. axis equal
  54. axis off
  55. set(gca, 'YDir','reverse')
  56. hold off
  57. %%% Junk
  58. % % %
  59. % imshow(bw)
  60. % hold on
  61. % for i = 1:numel(stats)
  62. % temp = uniquetol(stats(i).Extrema,.05,'ByRows',1);
  63. % vertices(i,:,:) = [temp(3,:);temp([1,2,4],:)];
  64. % scatter(temp(:,1),temp(:,2),'LineWidth',3)
  65. % scatter(stats(i).Centroid(1),stats(i).Centroid(2),'LineWidth',3)
  66. % hold on
  67. % end