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 #define PSYCHLOPS_USE_NIDAQ_MX
\r
9 #include <psychlops.h>
\r
10 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
13 ///+ Stimulus drawing function
\r
14 //// A function for stimulus drawing (main body)
\r
17 void psychlops_main() {
\r
18 Canvas cnvs(Canvas::window);
\r
20 Letters let(L"flower_png24.png");
\r
21 let.fill = Color::white;
\r
23 Psychlops::Ellipse rect(100,100);
\r
24 rect.fill = Color::red;
\r
26 Devices::GenericParallelPort trigger("USB_PARALLEL", 1+8);
\r
27 Devices::NIDAQmx nidaq();
\r
31 while(!Keyboard::esc.pushed()) {
\r
33 Display::clear(); //Clear window
\r
36 // 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
38 if(t%120==0) trigger.trigger();
\r
40 Display::flip(); // Flip frame buffers
\r
43 ///- Stimulus drawing function
\r
49 // Motion with glass patterns.
\r
50 // Ross, J., Badcock, D. R., and Hayes, A. (2000)
\r
51 // Coherent global motion in the absence of coherent velocity signals.
\r
52 // Current Biology, 10, 679-682.
\r
54 //// Include Psychlops Package
\r
55 #include <psychlops.h>
\r
56 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
59 ///+ Stimulus drawing function
\r
60 //// A function for stimulus drawing (main body)
\r
61 void psychlops_main() {
\r
63 Canvas cnvs(Canvas::window);
\r
65 Letters let(L"flower_png24.png");
\r
66 let.fill = Color::white;
\r
68 Psychlops::Ellipse rect(100,100);
\r
69 rect.fill = Color::red;
\r
71 while(!Keyboard::esc.pushed()) {
\r
72 Display::clear(); //Clear window
\r
75 std::cout << rect.getDatum().x << std::endl;
\r
76 rect.shift(100,100).draw();
\r
77 std::cout << rect.getDatum().x << std::endl << std::endl;
\r
79 let.shift(100,100).draw();
\r
80 std::cout << let.getDatum().x << std::endl;
\r
82 Display::flip(); // Flip frame buffers
\r
85 //Figures::Movie mov;
\r
86 //mov.bin_path = "C:\\";
\r
88 ///- Stimulus drawing function
\r
92 #include <psychlops.h>
\r
93 using namespace Psychlops;
\r
96 Clock before, after;
\r
97 void memoBefore() { before.update(); }
\r
98 double pastTime() { after.update(); return (after-before).at_msec(); }
\r
101 void psychlops_main() {
\r
104 Display target_display = Display::secondary;
\r
105 std::cout << target_display.width << std::endl;
\r
106 std::cout << Display::secondary.getHeight() << std::endl;
\r
109 Canvas display(1024, 768, Canvas::window, target_display);
\r
113 Color::setGammaValue(1.0,1.0,1.0);
\r
115 double cutoff1=1.0,cutoff2=0.0;
\r
116 Widgets::Slider slider[3];
\r
117 slider[0].link(cutoff1, "cutoff1" , 0<=rng<=256, 1);
\r
118 slider[1].link(cutoff2, "half width" , 0<=rng<=1, 0.125);
\r
122 //void drawGrating(Image &img, int width, int height, double wavelength, double contrast, double orientation, double phase);
123 //void drawGaussian(Image &img, double sigma, double factor);
124 //void drawGabor(Image &img, double sigma, double wavelength, double contrast, double orientation, double phase);
\r
125 std::stringstream ss;
127 for(double wavelength_=2; wavelength_<8; wavelength_+=1.0 )
\r
129 for(double ori = 0; ori<180.0; ori+=30)
\r
131 for(double amp = 0.25; amp<=1; amp+=0.25)
\r
133 for(double phase = 0; phase<360.0; phase+=30)
\r
135 Figures::drawGrating(img, 36, 36, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
137 ss << "output/Grating_wav" << pow(2,wavelength_) << "_amp" << amp << "_ori" << ori << "_pha" << phase << ".png";
\r
138 img.save(ss.str());
\r
139 //Figures::drawGrating(img, 45, 45, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
147 while(!Keyboard::esc.pushed()) {
\r
150 std::cout << pastTime() << std::endl;
\r
157 m.source.set(100,100).centering();
\r
159 //while(!Keyboard::esc.pushed()) {
\r
160 for(int j=0; j<10; j++) {
\r
161 display.clear(Color::blue);
\r
164 //img.centering().draw();
\r
165 for(int i=0; i<2; i++)
\r
167 //slider[i].setDatum(Point(0,0)).shift(20, i*25 + 10).draw();
\r
170 //display.to(m[j], r);
\r
173 m.save("test.gif");
\r
174 // std::cout << pastTime() << std::endl;
\r