2 // Motion with glass patterns.
\r
3 // Ross, J., Badcock, D. R., and Hayes, A. (2000)
\r
4 // Coherent global motion in the absence of coherent velocity signals.
\r
5 // Current Biology, 10, 679-682.
\r
7 //// Include Psychlops Package
\r
8 #include <psychlops.h>
\r
9 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
12 ///+ Stimulus drawing function
\r
13 //// A function for stimulus drawing (main body)
\r
16 void psychlops_main() {
\r
17 Canvas cnvs(Canvas::window);
\r
19 Letters let(L"flower_png24.png");
\r
20 let.fill = Color::white;
\r
22 Psychlops::Ellipse rect(100,100);
\r
23 rect.fill = Color::red;
\r
25 Devices::GenericParallelPort trigger("USB_PARALLEL", 1+8);
\r
29 while(!Keyboard::esc.pushed()) {
\r
31 Display::clear(); //Clear window
\r
34 // rs = CreateProcess("C:\\Windows\\System32\\print.exe",(LPTSTR)" /D:LPT1 D:\\Users\\hskwk\\Desktop\\zzz.txt",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
\r
36 if(t%120==0) trigger.trigger();
\r
39 Display::flip(); // Flip frame buffers
\r
42 ///- Stimulus drawing function
\r
48 // Motion with glass patterns.
\r
49 // Ross, J., Badcock, D. R., and Hayes, A. (2000)
\r
50 // Coherent global motion in the absence of coherent velocity signals.
\r
51 // Current Biology, 10, 679-682.
\r
53 //// Include Psychlops Package
\r
54 #include <psychlops.h>
\r
55 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
58 ///+ Stimulus drawing function
\r
59 //// A function for stimulus drawing (main body)
\r
60 void psychlops_main() {
\r
62 Canvas cnvs(Canvas::window);
\r
64 Letters let(L"flower_png24.png");
\r
65 let.fill = Color::white;
\r
67 Psychlops::Ellipse rect(100,100);
\r
68 rect.fill = Color::red;
\r
70 while(!Keyboard::esc.pushed()) {
\r
71 Display::clear(); //Clear window
\r
74 std::cout << rect.getDatum().x << std::endl;
\r
75 rect.shift(100,100).draw();
\r
76 std::cout << rect.getDatum().x << std::endl << std::endl;
\r
78 let.shift(100,100).draw();
\r
79 std::cout << let.getDatum().x << std::endl;
\r
81 Display::flip(); // Flip frame buffers
\r
84 //Figures::Movie mov;
\r
85 //mov.bin_path = "C:\\";
\r
87 ///- Stimulus drawing function
\r
91 #include <psychlops.h>
\r
92 using namespace Psychlops;
\r
95 Clock before, after;
\r
96 void memoBefore() { before.update(); }
\r
97 double pastTime() { after.update(); return (after-before).at_msec(); }
\r
100 void psychlops_main() {
\r
103 Display target_display = Display::secondary;
\r
104 std::cout << target_display.width << std::endl;
\r
105 std::cout << Display::secondary.getHeight() << std::endl;
\r
108 Canvas display(1024, 768, Canvas::window, target_display);
\r
112 Color::setGammaValue(1.0,1.0,1.0);
\r
114 double cutoff1=1.0,cutoff2=0.0;
\r
115 Widgets::Slider slider[3];
\r
116 slider[0].link(cutoff1, "cutoff1" , 0<=rng<=256, 1);
\r
117 slider[1].link(cutoff2, "half width" , 0<=rng<=1, 0.125);
\r
121 //void drawGrating(Image &img, int width, int height, double wavelength, double contrast, double orientation, double phase);
122 //void drawGaussian(Image &img, double sigma, double factor);
123 //void drawGabor(Image &img, double sigma, double wavelength, double contrast, double orientation, double phase);
\r
124 std::stringstream ss;
126 for(double wavelength_=2; wavelength_<8; wavelength_+=1.0 )
\r
128 for(double ori = 0; ori<180.0; ori+=30)
\r
130 for(double amp = 0.25; amp<=1; amp+=0.25)
\r
132 for(double phase = 0; phase<360.0; phase+=30)
\r
134 Figures::drawGrating(img, 36, 36, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
136 ss << "output/Grating_wav" << pow(2,wavelength_) << "_amp" << amp << "_ori" << ori << "_pha" << phase << ".png";
\r
137 img.save(ss.str());
\r
138 //Figures::drawGrating(img, 45, 45, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
146 while(!Keyboard::esc.pushed()) {
\r
149 std::cout << pastTime() << std::endl;
\r
156 m.source.set(100,100).centering();
\r
158 //while(!Keyboard::esc.pushed()) {
\r
159 for(int j=0; j<10; j++) {
\r
160 display.clear(Color::blue);
\r
163 //img.centering().draw();
\r
164 for(int i=0; i<2; i++)
\r
166 //slider[i].setDatum(Point(0,0)).shift(20, i*25 + 10).draw();
\r
169 //display.to(m[j], r);
\r
172 m.save("test.gif");
\r
173 // std::cout << pastTime() << std::endl;
\r