1 #include <psychlops.h>
\r
2 using namespace Psychlops;
\r
4 Psychlops::Polygon Poly;
\r
9 double Poly_lum = 0.5;
\r
15 Independent << Poly_lum | "Poly lum" | 0 <= rng <= 1.0 | 0.05 | 0.1;
\r
17 for(int i=0; i<v_n; i++)
\r
19 double angle = (double)i/v_n * 2*PI;
\r
20 Poly.append(radius*cos(angle), radius*sin(angle));
\r
22 Poly.Shape::centering();
\r
24 while(!Keyboard::esc.pushed()){
\r
25 Display::clear(bg_lum);
\r
26 Poly.draw(Poly_lum);
\r
31 void psychlops_main()
\r
33 Canvas canvas(Canvas::window, Display::secondary);
\r
38 p.setDesign(Procedure::DEMO);
\r
39 p.setProcedure(&StimDisplay);
\r
46 // Motion with glass patterns.
\r
47 // Ross, J., Badcock, D. R., and Hayes, A. (2000)
\r
48 // Coherent global motion in the absence of coherent velocity signals.
\r
49 // Current Biology, 10, 679-682.
\r
51 //// Include Psychlops Package
\r
52 #include <psychlops.h>
\r
53 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
56 ///+ Stimulus drawing function
\r
57 //// A function for stimulus drawing (main body)
\r
60 void psychlops_main() {
\r
61 Canvas cnvs(Canvas::window);
\r
63 Letters let(L"flower_png24.png");
\r
64 let.fill = Color::white;
\r
66 Psychlops::Ellipse rect(100,100);
\r
67 rect.fill = Color::red;
\r
70 0,0,0,0,0,0,0,0,0,0,
\r
71 0,0,0,0,0,0,0,0,0,0,
\r
72 0,0,0,0,0,0,0,0,0,0,
\r
73 0,0,0,0,0,0,0,0,0,0,
\r
74 0,0,0,0,0,0,0,0,0,0,
\r
75 0,0,0,0,0,0,0,0,0,0,
\r
76 -128,-128,-128,-128,-128,-128,-128,-128,
\r
77 -128,-128,-128,-128,-128,-128,-128,-128,
\r
78 -128,-128,-128,-128,-128,-128,-128,-128,
\r
79 -128,-128,-128,-128,-128,-128,-128,-128,
\r
81 Devices::GenericParallelPort trigger0("USB_PARALLEL", 0);
\r
82 Devices::GenericParallelPort trigger1("USB_PARALLEL", Devices::GenericParallelPort::D0 + Devices::GenericParallelPort::D2);
\r
88 int trigger_ticks = 100, a;
\r
90 Widgets::Slider slide;
\r
91 slide.link(trigger_ticks, "trigger_ticks", 1<=rng<=1000, 20.0, 100.0);
\r
95 while(!Keyboard::esc.pushed()) {
\r
97 if(t%2==0) Display::clear(); //Clear window
\r
98 else Display::clear(Color::gray); //Clear window
\r
101 // 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
103 //if(t%300==0) trigger1.trigger(data,100);
\r
104 if(t%150==0) trigger0.trigger(trigger_ticks);
\r
109 Display::flip(); // Flip frame buffers
\r
112 ///- Stimulus drawing function
\r
119 // Motion with glass patterns.
\r
120 // Ross, J., Badcock, D. R., and Hayes, A. (2000)
\r
121 // Coherent global motion in the absence of coherent velocity signals.
\r
122 // Current Biology, 10, 679-682.
\r
124 //// Include Psychlops Package
\r
125 #include <psychlops.h>
\r
126 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
129 ///+ Stimulus drawing function
\r
130 //// A function for stimulus drawing (main body)
\r
131 void psychlops_main() {
\r
133 Canvas cnvs(Canvas::window);
\r
135 Letters let(L"flower_png24.png");
\r
136 let.fill = Color::white;
\r
138 Psychlops::Ellipse rect(100,100);
\r
139 rect.fill = Color::red;
\r
141 while(!Keyboard::esc.pushed()) {
\r
142 Display::clear(); //Clear window
\r
145 std::cout << rect.getDatum().x << std::endl;
\r
146 rect.shift(100,100).draw();
\r
147 std::cout << rect.getDatum().x << std::endl << std::endl;
\r
149 let.shift(100,100).draw();
\r
150 std::cout << let.getDatum().x << std::endl;
\r
152 Display::flip(); // Flip frame buffers
\r
155 //Figures::Movie mov;
\r
156 //mov.bin_path = "C:\\";
\r
158 ///- Stimulus drawing function
\r
162 #include <psychlops.h>
\r
163 using namespace Psychlops;
\r
166 Clock before, after;
\r
167 void memoBefore() { before.update(); }
\r
168 double pastTime() { after.update(); return (after-before).at_msec(); }
\r
171 void psychlops_main() {
\r
174 Display target_display = Display::secondary;
\r
175 std::cout << target_display.width << std::endl;
\r
176 std::cout << Display::secondary.getHeight() << std::endl;
\r
179 Canvas display(1024, 768, Canvas::window, target_display);
\r
183 Color::setGammaValue(1.0,1.0,1.0);
\r
185 double cutoff1=1.0,cutoff2=0.0;
\r
186 Widgets::Slider slider[3];
\r
187 slider[0].link(cutoff1, "cutoff1" , 0<=rng<=256, 1);
\r
188 slider[1].link(cutoff2, "half width" , 0<=rng<=1, 0.125);
\r
192 //void drawGrating(Image &img, int width, int height, double wavelength, double contrast, double orientation, double phase);
193 //void drawGaussian(Image &img, double sigma, double factor);
194 //void drawGabor(Image &img, double sigma, double wavelength, double contrast, double orientation, double phase);
\r
195 std::stringstream ss;
197 for(double wavelength_=2; wavelength_<8; wavelength_+=1.0 )
\r
199 for(double ori = 0; ori<180.0; ori+=30)
\r
201 for(double amp = 0.25; amp<=1; amp+=0.25)
\r
203 for(double phase = 0; phase<360.0; phase+=30)
\r
205 Figures::drawGrating(img, 36, 36, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
207 ss << "output/Grating_wav" << pow(2,wavelength_) << "_amp" << amp << "_ori" << ori << "_pha" << phase << ".png";
\r
208 img.save(ss.str());
\r
209 //Figures::drawGrating(img, 45, 45, pow(2,wavelength_), amp, ori/360*2*PI, phase/360*2*PI);
\r
217 while(!Keyboard::esc.pushed()) {
\r
220 std::cout << pastTime() << std::endl;
\r
227 m.source.set(100,100).centering();
\r
229 //while(!Keyboard::esc.pushed()) {
\r
230 for(int j=0; j<10; j++) {
\r
231 display.clear(Color::blue);
\r
234 //img.centering().draw();
\r
235 for(int i=0; i<2; i++)
\r
237 //slider[i].setDatum(Point(0,0)).shift(20, i*25 + 10).draw();
\r
240 //display.to(m[j], r);
\r
243 m.save("test.gif");
\r
244 // std::cout << pastTime() << std::endl;
\r