Hetero Chromatic Flicker

March 20, 2018 | Author: Mihai Bogdan | Category: Arduino, Visual Perception, Perception, Integer (Computer Science), Frequency


Comments



Description

HeterochromaticFlickerSimplified demonstration of heterochromatic flicker photometry on Arduino Updated Sep 3, 2012 by [email protected]  Introduction  Details o Arduino sketch (heterochromaticFlicker.ino)    Counting the "button presses" during sampling period  Limiting how often subject can confirm Arduino Debug ( heterochromaticFlickerExclIncrementDecrements.ino) o Python GUI (heterochromaticFlicker.py) o LabVIEW VI (heterochromaticFlicker.vi) Scientific References o Heterochromatic flicker photometry  o Commercial products Critical Flicker Fusion (CFF) measurements  Commercial products Introduction Demonstration how to alternate between different LED channels as is needed to implement psychophysical techniques such as heterochromatic flicker photometry or critical flicker fusion measurement. Arduino had been used similarly in the work of Sun et al. (Hillman Lab, Columbia University) to control LED lights in their open-source SPLASSH framework for multispectral in vivo image acquisition. SeeHeterochromaticFlicker#Scientific_References for further information. Demonstration of heterochromatic flicker technique using our proposed Arduino-based system and LabVIEW Details The basic idea for the heterochromatic flicker photometry implementation is that there are two LEDs of different color (heterochromatic) which are switched on in counter-phase. the subject of the experiment is faced with a flickering annulus (ring of light) and is asked to adjust the intensity of only the other LED. a sampling rate of 1 Hz for digital input in theory would be sufficient if subject pressed long enough the buttons and joystick. LED 1 is ON for first 500 ms of 1000 ms while LED 2 is OFF during this period 2. Thus. The other LED is set at fixed level by the experimenter. in our case only one was sufficient but in some other applications this check could be useful. see the tutorial of LadyAda or our other example CueLightTask. thus the digital inputs are buffered during the whole second cycle and decision of whether subject asked is done based on these buffered samples.ino) Compared to other examples (ControlPWM and CueLightTask). in practice we get around 20 samples per second with current settings. until the perception of flicker is eliminated or minimized. For tutorial on debouncing the digital input (filter noise). additional conditional rules need to be introduced to make sure that the system behaves as we like it to behave: Counting the "button presses" during sampling period We can count how many times the subject presses the button during the 1 sec sampling period. We don't want to change the light intensity during the 500ms/500ms flicker period. Arduino need to return the intensity values (duty cycles in other words) of the both LEDs when the subject presses the confirm button (which can be combined with some other data if needed in the Python GUI and written to disk as a text file for example using ttylog) Arduino sketch (heterochromaticFlicker. The resolution of counting depends on the digital sampling rate. In our application. In our implementation. and 1 digital input is needed to read the "confirm"button that the subject is instructed to press when he perceives no flickering. The variables are initialized as following: . Thus. LED 1 is OFF for the second 500 ms of 1000 ms while the LED 2 is ON during this period This is considered to flicker at a frequency of 2 Hz maybe counter-intuitively to people with engineering background that might take this scheme to have to rectangular signals having a frequency of 1 Hz to be phase-shifted 180 degrees in respect to each other. The subject responses are read using digital inputs of which 2 are needed for 1-axis joystick indicating subject's desire to increase or decrease light intensity. We can then set a threshold of for counts that can be considered as a "real press". the joystick and the button are connected to a 5V power supply and ground via pulldown resistors and when pressed the Arduino detects that digital pin to be HIGH.1. in milliseconds delay(flickerPeriod / numberOfDigitalSamples). analogWrite(ledOut_ch2Pin. } else { analogWrite(ledOut_ch1Pin. i++) { int numberOfDigitalSamples = 10. analogWrite(ledOut_ch2Pin. ledOut_ch2). int boolean_joystickDown = LOW. int boolean_buttonPressed = LOW.e. the number of each channel pressed during // the 1 second period (2xflickerPeriod) int count_joystickUP = 0. } if (digitalValues[2] == HIGH) { count_buttonPressed++.ladyada. // read input value digitalValues[2] = digitalRead(pinmap[2]). int count_joystickDown = 0. 0).g. i <= 2. for (int j = 1. } .net/learn/arduino/lesson5. j <= numberOfDigitalSamples. int count_buttonPressed = 0. ledOut_ch1). // e. // read input value digitalValues[1] = digitalRead(pinmap[1]).html // We can now simply calculate the number of HIGH signals // from each channel. j++) { // Read the digital inputs digitalValues[0] = digitalRead(pinmap[0]). 500 ms } // write the PWM values now to all the channels if (i == 1) { analogWrite(ledOut_ch1Pin.// i. and if the channels are very noisy // we can use some threshold values to determine whether // the button/joystick was actually pressed by the subject if (digitalValues[0] == HIGH) { count_joystickUP++. The basic for-loop in The Arduino sketch for the flickering scheme looks like the following: for (int i = 1. } if (digitalValues[1] == HIGH) { count_joystickDown++. 0). // if pressed or not int boolean_joystickUP = LOW. // read input value // if you need to "filter" spurious button noise // check LadyAda's tutorial on digital inputs // and button debouncing: // http://www. } // delay in each loop. thus it is not possible that subject would like to confirm every second.} In the code we count the number of HIGH's per channel (variables count) and end of each loop delay is introduced which is as long as the desired flicker period). first in the setup of the sketch // additionally we want to limit the possible // frequency of "confirm presses" as it not possible // in the study paradigm really to confirm the flicker // fusion every second #define noOfHistorysSamples 6 int confirmButtonHistory[noOfHistorysSamples]. it takes several tens of seconds for the subject to find the point on which he confirms the "nulling" of flicker. ledOut_ch1--. In practice this can occur if the subject presses the confirm button very long or near the end of the 1 sec sampling period. the button press extending to the subsequent 1 sec sampling period. ledOut_ch1++. } // Evaluate whether the buttons are really pressed if (count_joystickDown >= pressThreshold) { boolean_joystickDown = HIGH. so that on the first execution of the for' (when i == 1) the LED 1 is switched on with desired duty cycle. After the for-loop (~500 ms) the duty cycles of the LEDs are updated. } Limiting how often subject can confirm In practice. this is implemented as following. and on second execution the LED 2 with desired duty cycle while the other LED is off (duty cycle of 0). } // Evaluate whether the buttons are really pressed if (count_buttonPressed >= pressThreshold) { boolean_buttonPressed = HIGH. In the Arduino sketch (heterochromaticFlicker.ino). Which defines a vector with noOfHistorySamples (6 samples now) integer values called confirmButtonHistory. After this we can compare the counts again the set threshold for number of presses: // Evaluate whether the buttons/joysticks are really pressed if (count_joystickUP >= pressThreshold) { boolean_joystickUP = HIGH. Above we defined the rules whether the button (or joystick) . then we can say that sufficient time has // passed since the previous button press if (buttonCount == 1 && boolean_buttonPressed == HIGH) { boolean_buttonPressedAfterHistoryCheck = HIGH.was really pressed. k < noOfHistorysSamples. l++) { if (confirmButtonHistory[l] == HIGH) { buttonCount++. } // calculate the number of presses in the history int buttonCount = 0. k++) { confirmButtonHistory[k] = tempHistory[k]. } } // now after HISTORY CHECK if only one button press // is found. l < noOfHistorysSamples. Only when when number of button presses is 1 ( buttonCount == 1) and a real button press is detected (boolean_buttonPressed == HIGH) final button press is accepted (boolean_buttonPressedAfterHistoryCheck = HIGH). .6 seconds) during which no confirm button is allowed. for (int k = 0. the scope in second is 6 times 1 sec . } So the above introduced noOfHistorySamples is the scope of the history examined (when sampling period is 1 sec. for (int k = 1. k++) { tempHistory[k-1] = confirmButtonHistory[k]. } tempHistory[noOfHistorysSamples-1] = boolean_buttonPressed. for (int l = 0. Example of button confirmation. being limited by the noOfHistorySamples Note that in the current implementation joystick presses are not limited in similar fashion as it was not needed in our experimental paradigm. k <= noOfHistorysSamples-1. and we can extend this to check how many previous presses there were during previous cycles as following: // Add the newly read boolean_buttonPressed after // making "room" for it using a temporary array int tempHistory[noOfHistorysSamples]. but could be modified to be switch-controlled from the Python GUI for example. // so we return then Serial. // prints a tab Serial. if (count_joystickUP >= pressThreshold) { boolean_joystickUP = HIGH. widget): .print("\n"). // prints a line change } The correct behavior of the Arduino sketch can now be monitored using the Serial Monitor of the Arduino IDE without having to having to have a software front-end.Finally the LED intensity valued are returned for example to be read using Python: // PRINT NOW THE VALUES Out if button is pressed if (boolean_buttonPressedAfterHistoryCheck == HIGH) { // Upon confirm we want to know to which intensity // values the user confirmed the fusion.ino'.print(ledOut_ch1).print("\t"). // ledOut_ch1++. } // Evaluate whether the buttons are really pressed if (count_joystickDown >= pressThreshold) { boolean_joystickDown = HIGH. This was omitted from the example from the sake of simplicity.ino) Slight modification of the actual 'heterochromaticFlicker. // prints a tab Serial. Arduino Debug ( heterochromaticFlickerExclIncrementDecrements. } Now the user control of the LED is hard-wired only the 'ch1'.print(ledOut_ch2). Python GUI (heterochromaticFlicker. This is useful when you don't have anything connected to Arduino Pins when the state of the digital pins are not necessarily LOW and the Arduino can then behave as it would receive "phantom" joystick presses from user.py) The basic implementation of Python GUI is simple with only two sliders for adjusting the intensity of the flickering lights: def on_changed(self.print("\t"). Serial. // ledOut_ch1--. Serial. The detection of joystick presses do not know lead to increase/decrease of LED intensity. val = widget. LabVIEW VI (heterochromaticFlicker.get_value() name = widget.get_name() if name == "Channel1": self.ser. LabVIEW can be used to control the LEDs using Arudino.ser.write("b" + chr(int(val))) elif name == "Channel2": self.vi) As shown in ControlPWM. .write("g" + chr(int(val))) else: print "ERROR: Invalid widget name. in on_changed function" The case conditional to identify which LED channel want to be modified is implemented similarly as for other examples (ControlPWM andCueLightTask) Screen capture of the heterochromatic flicker Python GUI. You need to upload the Arduino sketch LVIFA_base. the company behind LabVIEW and vast selection of data acquisition instruments). The example is modified from the example "Simple LED" provided by NI.pde in order to make Arduino responsive to commands sent from LabVIEW: .Demonstration of how to use LabVIEW with Arduino is done using the LabVIEW Interface for Arduino (LIFA) package provided by National Instruments (NI. .pde with its accompanying files.Screen capture of LVIFA_base. The LabVIEW Virtual Instrument block diagram for the heterochromatic flicker looks like that without user inputs (to increment/decrement LED intensity): Screen capture of the block diagram of LabVIEW heterochromatic flicker photometry. The corresponding front panel GUI looks as following: . and D.nlm. http://dx.  Kelly. P R Martin.org/10. no. no. “Two-band Model of Heterochromatic Flicker.doi.001508. and A Valberg.org/10. http://dx. 11 (1976): 1235 – 1239. Priscilla H.org/10. http://www. “Comparison of Four Methods of Heterochromatic Photometry.Scientific References Heterochromatic flicker photometry  Wagner.  Werner.62.doi.67. 1 (October 1.doi. 12 (December 1.ncbi. Seaneen K. John S. 1988): 323 – 347. 1972): 1508– 1515.gov/pubmed/3253435.org/10. Boynton. van Norren. Donnelly.” Vision Research 16. http://dx. and Robert M.nih. ..doi. and Reinhold Kliegl.001081. H. “Aging and Human Macular Pigment Density.” Journal of the Optical Society of America 62.1364/JOSA.” Vision Research 27.1364/JOSA.  Silver. “The Physiological Basis of Heterochromatic Flicker Photometry Demonstrated in the Ganglion Cells of the Macaque Retina. 8 (1977): 1081– 1091.  Lee. “A Grey Squirrel Spectral Sensitivity by Heterochromatic Flicker and Its Implications.1016/00426989(76)90047-X. http://dx.. no.1016/00426989(87)90188-X.” The Journal of Physiology 404. D. Gunther. B B. no.” Journal of the Optical Society of America 67. no. 2 (1987): 257–268. 2012): 1134– 1141.http://dx.1167/11. no. and P. no. and John S. Thomas J. 2004): 137– 142.org/10. Graham Vickery.00499. and Billy Hammond.1444-0938.doi.1755-3768. and Robert J.T. Folkert Horn. http://dx. 8 (2011): 085004. Reliability.1016/j.04.org/10.T. http://dx. Richard A. and Frank Eperjesi. “Heterochromatic Flicker Electroretinograms Reflecting Luminance and Cone Opponent Activity in Glaucoma Patients. “The Role of Macular Pigment Assessment in Clinical Practice: a Review.x.” Journal of Biomedical Optics 16.2007.001213.” Ophthalmic & Physiological Optics 27. 2011 with custom Matlab code.doi.x. http://dx. Werner.K.. Commercial products  Oculus C-Quant straylight meter.1111/j.” Journal of the Optical Society of America A 11. no. Anthony Vugler.org/10.1016/j.  Brown.003.org/10. . 2011): 55– 55.2010. “Determining Heterochromatic Flicker Photometry Frequency for Macular Pigment Optical Densitometry by Critical Flicker Fusion Frequency. 2 (October 15. 5 (September 1. Dora Fix Ventura. and Joris E. http://dx.http://dx.1117/1. Billy R Hammond.  Perimeters from Optos for flicker perimetry applications for example.  van den Berg.1475-1313. http://dx.1016/0042-6989(91)90057-C. Coppens.cub.2004. Thomas J. “Dependence of Intraocular Straylight on Pigmentation and Light Transmission Through the Ocular Wall. 15 (December 27.  Kraft.org/10. Kevin.doi. J. and Susanne Binder. 4 (April 1.1111/j.1364/JOSAA. no.” Journal of Vision 11.abb. and Norm Values for Temporal Contrast Sensitivity Implemented on the Two Alternative Forced Choice C-Quant Device.  O’Brien. Ilse Krebs.org/10.org/10.2012.” Clinical and Experimental Optometry 93. Sei-ichi Tsujimura.” Investigative Ophthalmology & Visual Science (July 21. Carl Glittenberg.  Barboni. which was further modified by van den Berg et al.  Wooten.01418. no.” Current Biology 22. no. http://dx. Bill Wooten. no. 2010): 207– 211. Stefan. Gobinda Pangeni. no. Mirella Telles Salgueiro. 2 (March 1..  Hagen. and Lisa M Renzi. Annette E. James M. “Repeated Measures of Macular Pigment Optical Density to Test Reproducibility of Heterochromatic Flicker Photometry. 7–8 (1991): 1361–1367.” Acta Ophthalmologica 88. “Using Scotopic and Photopic Flicker to Measure Lens Optical Density. Bastiaan Kruijt.” Archives of Biochemistry and Biophysics 430.55.2008.  Bone.. Hannah. “Melanopsin-Based Brightness Discrimination in Mice and Humans.http://dx. and Jan Kremers.org/10.org/10. “Heterochromatic Flicker Photometry. Billy R.1111/j. and John T. Lucas.doi.04. Jonathan Wynne.11-7538.1167/iovs. T. Timothy M. de Waard. Olivia Howells.doi. Landrum.x.15..doi. http://dx. Ijspeert.org/10.11. “Spectral Efficiency Across the Life Span: Flicker Photometry and Brightness Matching. van den Berg. Bill Smollon.00489. 1994): 1213–1221. no. 4 (July 2007): 321– 328.W. 12 (June 19.doi.” Vision Research 31. P.doi.3613922.. Robert Bedford.doi. Luuk Franssen.doi. “Psychophysics.039. Allen.P. 2011).  Bartlett. 2010): 300–308. J.http://www. no. 1965.ncbi. .nlm. 1 (1985): 115–127.  Truss..ncbi. 2011 Critical Flicker Fusion (CFF) measurements  Porter. H. no.doi. 1957): 1130– 1134.” Journal of the Optical Society of America 47. http://www.nlm.org/10. 2 (November 20.gov/pubmed/7153925.ncbi. 1902): 313–329. Carroll Vance. C. no.org/10.  Brown.nih.” The Journal of Physiology 332 (November 1982): 139–155.1364/JOSA.nlm. 2011 and Murray et al. no.doi.” American Journal of Optometry and Archives of American Academy of Optometry 48. 1922): 254–267. http://dx.doi. and S Shlaer.  Hecht.nih. “Contributions to the Study of Flicker. “The Temporal Properties of Rod Vision. and Jyrki Rovamo. no.g. 6 (July 20. 1936): 965–977.1364/JOSA.nih. “Effect of Ametropias on Critical Fusion Frequency. 8 (1986): 1249–1255. 12 (December 1.  Ong. and C D Verrijp. 1933): 237–249. and T Wong. http://dx. The Measurement of Critical Fusion Frequency for the Human Eye.  Hecht.W.1016/00426989(86)90105-7. The Relation Between Intensity and Critical Frequency for Different Parts of the Spectrum. New York: John Wiley & Sons Inc.. Paper II.1364/JOSA. “Flicker an Intermittent Stimulation. 9 (September 1971): 736– 739.nlm. “Critical Frequency Relations in Scotopic Vision. 2010.nih.6.  MPS 9000 Macular Pigment Screener. 5 (May 1.000254. “Frequency Dependence in Scotopic Flicker Sensitivity. and T. no. S. “Relationship Between Critical Flicker-Frequency and a Set of Low-Frequency Characteristics of the Eye.org/10.. Loughman et al. The MacuScope is a "heterochromatic flicker photometer" .” Journal of the Optical Society of America 44. http://www.” Vision Research 25.. http://www.doi. 3 (May 1.  Raninen.” In Vision and Visual Perception. “Chromatic Flicker Fusion Frequency as a Function of Chromaticity Difference.ncbi.000380. edited by Clarence Henry Graham.gov/pubmed/5292020. commercially available? Evaluated in the following papers e. Herbert E. See YouTube video to see the Macuscope in action. S. J D.http://dx.  Nygaard. JL.  Conner.http://dx.the gold standard for measuring macular protective pigment density (MPPD).001130. “Intermittent Stimulation by Light: V.: Bartlett et al. Frumkes.gov/pubmed/19872776.” The Journal of General Physiology 19. 1954): 380–388.  De Lange DZN. no.doi. no.” The Journal of General Physiology 17. R.E. S Shlaer.1016/00426989(85)90085-9. http://dx.44.” Journal of the Optical Society of America 6.org/10.” Proceedings of the Royal Society of London 70 (January 1. Antti.  Ives. “Perimetry of Critical Flicker Frequency in Human Rod and Cone Vision.47. Macuscope.” Vision Research 26. T. “Intermittent Stimulation by Light: II.gov/pubmed/19872976.org/10. http://www. http://dx.org/10.. Bill Smollon.org/10.org/10. and Billy R Wooten.CO. Kristen E.org/10.” Ophthalmic and Physiological Optics 25. 2005): 315– 319.com/product_detail.doi.” Optometry and Vision Science 81.doi. Creel.jns. “ERG Critical Flicker Frequency Assessment in Humans. Paul. no. Wattis.  Diana Racene.lafayettelifesciences.  Bowles. and John P.002.  O’Brien.gov/pubmed/15592114. SPIE 5123. William A Douthwaite.1117/12. Kevin.doi.http://dx. “Determining Heterochromatic Flicker Photometry Frequency for Macular Pigment Optical Densitometry by Critical Flicker Fusion Frequency. David: Katz.org/10.1002/(SICI)1099-1077(199807)13:5<337::AIDHUP7>3.doi. “Development of a Critical Flicker/fusion Frequency Test for Potential Vision Testing in Media Opacities. Marta. Bruce A Noble. Kathleen. Bill Wooten. Borgmeier. Kathleen B. http://dx.doi. Judith.2010. 1–2 (January 15. 5 (1998): 337–355. and Billy Hammond. “CFF Thresholds: Relation to Macular Pigment Optical Density. 4 (July 1. “A Differential Color Flicker Test for Detecting Acquired Color Vision Impairment in Multiple Sclerosis and Diabetic Retinopathy.517043  Vianya-Estopà.2005. no. no. Billy R Jr. and Neri Accornero. Donnell.1167/11.1007/978-1-4614-0631-0_63. 2011): 55– 55. Weinberg. 2011): 130–134. no. Bruno.” Journal of Vision 11.00271.ncbi. and David B Elliott. Commercial products  FLIM Flicker/Fusion Frequency device by SCHUHFRIED GmbH  [www. Stephen.x. Konrad Pesudovs. Proc.15.doi.55. "A Novel Device to Measure Critical Flicker Fusion Frequency" NANOS 2007: Poster Presentations. Curran. Bradley J.” Advances in Experimental Medicine and Biology 723 (2012): 503– 509. Odysseas Papazachariadis. Link (accessed May 17 2012)  Gregori.1016/j. http://dx.” Journal of the Neurological Sciences 300. 12 (December 2004): 905– 910.0. and Timothy W Kraft.nlm.”Human Psychopharmacology: Clinical and Experimental 13.  Hammond.http://dx.  Daetwyler. "Computerized device for critical flicker fusion frequency determination".1111/j. http://dx.1475-1313. Alfonsa Farruggia. Warner. no.nih. 349 (2003). Digre. “Critical Flicker Fusion Threshold: a Useful Research Tool in Patients with Alzheimer’s Disease. 15 (December 27.2-P.org/10.09.asp?ItemID=36 Flicker Fusion System Model 12021] from Lafayette Instrument .
Copyright © 2024 DOKUMEN.SITE Inc.