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.

getitemimg.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. function Jcenter = getitemimg(i,sizegaz,resize);
  2. % Get the image files for the experiment:
  3. imageFolder = 'stimuli/';
  4. imgList = dir(fullfile(imageFolder,['*.' 'jpg']));
  5. imgList = {imgList(:).name};
  6. bth=254;% treshold to subtitute for background
  7. sc_o=(10000/2560)*1.4;
  8. %Object 1
  9. file_object_1 = imgList{i};
  10. img_object_1 = imread(fullfile(imageFolder ,file_object_1));
  11. img_object_1((img_object_1>=bth))=256;%128; %REMOVING BACKGROUND FOR EACH IMAGE
  12. % objectDisplay_1 = Screen('MakeTexture', window1, img_object_1);
  13. % Calculate image position (center of the screen) OBJECT 1
  14. imageSize_o1 = size(img_object_1)/sc_o;
  15. % pos_o1 = [(W-imageSize_o1(2))/2 (H-imageSize_o1(1))/2 (W+imageSize_o1(2))/2 (H+imageSize_o1(1))/2];
  16. J = imresize(img_object_1,imageSize_o1(1:2));
  17. if resize==1 %if the plot is smaller than the images
  18. n=round(sizegaz/2);
  19. m=round(size(J)/2);
  20. point1=m(1)-n(1);
  21. point2=m(1)+n(1);
  22. Jcenter=J(point1:point2,point1:point2,:);
  23. elseif resize==2 %if the plot is bigger than the images
  24. m=round(sizegaz/2);
  25. n=round(size(J)/2);
  26. point1=m(1)-n(1);
  27. point2=m(1)+n(1);
  28. canvas=nan([sizegaz,3]);
  29. canvas(:,:,:)=256;
  30. canvas(point1:point2-1,point1:point2-1,:)=J(:,:,:);
  31. canvas=uint8(canvas);
  32. Jcenter=canvas;
  33. else
  34. Jcenter=J;
  35. end
  36. end