X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FPsychlopsMain.cs;h=3969c0b780a8e54c47fbf96743fa340ffa46ea3b;hb=2e368438f3f6c0a65f0883ad272b6f2d9b719dbc;hp=16acfd87f95a5c9dc78c404d1e93eb0d8b277e78;hpb=6f8443d682c25aa44d9158e8728ced9dd54fa4ca;p=psychlops%2Fsilverlight.git diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index 16acfd8..3969c0b 100644 --- a/test4/PsychlopsMain.cs +++ b/test4/PsychlopsMain.cs @@ -1,5 +1,140 @@ - +using Psychlops; +namespace PsychlopsSilverlightApp +{ + + public class PsychlopsMain + { + + + public void psychlops_main() { + + Canvas display = new Canvas(768,768); + + double rect_size = 100; + double rect_lum = 0.5; + double bg_lum = 0.5; + double size = 250.0; + double sigma; + sigma = size/6.0; + double lambda; + lambda = 6*sigma; + int envelopemode = 0; + double refresh = display.getRefreshRate(); + double[] SF=new double[2]; + + SF[0]=4.0; + SF[1]=4.0; + + double phase=0; + + double[] initphase = new double[2]; + double _i, _j, _x, _y, _x2, _y2, col; + double amplitude = 1.0; + + Rectangle fixation1 = new Rectangle(3,9); + Rectangle fixation2 = new Rectangle(9,3); + fixation1.centering(); + fixation2.centering(); + Rectangle contrastrect = new Rectangle(); + contrastrect.set(760,760); + + Image envelope = new Image(); + Psychlops.Color bglum= new Color(0.5,0.5,0.5); + Psychlops.Color masklum = new Color(0.5,0.5,0.5,0.5); + + Interval rng = new Interval(); + + + Psychlops.Widgets.Slider TF; + TF = new Psychlops.Widgets.Slider("TF", 0.25<=rng<=2.0 , 0.1); + TF.value=0.75; + + + + Psychlops.Widgets.Slider SFs; + SFs = new Psychlops.Widgets.Slider("SF", 4.0<=rng<=16.0 , 4.0); + SFs.value = 4.0; + + Psychlops.Widgets.Slider contrast; + contrast= new Psychlops.Widgets.Slider("Contrast", 0.0<=rng<=1.0 , 0.1); + contrast.value = 0.1; + + + var element = StaticFunctions.NewArray(2); + for (int i = 0; i < element.Length; i++){ + element[i].setSigma(sigma); // set a size of patch as a halfwidth of Gaussian + element[i].orientation = Math.PI/4.0+Math.PI/2.0*(1-i);//Math.PI/2*(rand()%2);// //set orientations + initphase[i]=0; + } + + + + envelope.set(size, size); + envelope.clear(bglum); + + for(int i=0; i0){ + envelope.centering().shift(size*0.6,-size*0.6).draw(); + envelope.centering().shift(-size*0.6,size*0.6).draw(); + } + masklum.set(bg_lum, bg_lum, bg_lum, 1-contrast); + contrastrect.centering(); + contrastrect.draw(masklum); + fixation1.centering().shift(size*2,0.0); + fixation1.draw(Color.red); + fixation2.centering().shift(size*2,0.0); + fixation2.draw(Color.red); + + Display.flip(); + + + } + +} + + + + } + +} +/* using Psychlops; //Position Bias Program @@ -53,15 +188,16 @@ namespace PsychlopsSilverlightApp //img3.centering().shift(0, isize * 1.5).draw(); - foreach (var g in gabor1) + //foreach (var g in gabor1) + for (int i = 0; i < gabor1.Length; i++) { - g.wavelength = lambda; - g.phase = (double)frames * 2.0 * Math.PI * tfreq / 60; - g.contrast = contrast; + gabor1[i].wavelength = lambda; + gabor1[i].phase = (double)frames * 2.0 * Math.PI * tfreq / 60; + gabor1[i].contrast = contrast; //g.wavelength2 = lambda * 2; //g.phase2 = (double)frames * 2.0 * Math.PI * tfreq / 60; //g.contrast2 = contrast / 2; - g.draw(); + gabor1[i].draw(); } if (!Mouse.left.pressed()) frames++;