the distance between a stimulating electrode and the spinal cord surface may be inferred from a function dependent upon : 1 ) the optical path lengths of light between a near infrared light emitter and detectors , where the light is reflected from the spinal cord ; 2 ) the spinal cord geometry ; 3 ) the optical divergence of the light emitter ; and 4 ) the presence of chromophores in the optical path . the dura surrounding the spinal cord itself is translucent to near infrared light . near infrared light will be scattered by , and will reflect from , the spinal cord . cerebrospinal fluid ( csf ) will negligibly scatter near infrared light and will not act as a significant reflector of near - infrared light . light from the light emitter passes through the thin , relatively avascular dura to enter the csf . light incident on the spinal cord experiences scatter resulting in a portion being reflected and another portion being absorbed by chromophores . optical absorption in a fluid medium may be described by the beer - lambert law ( beer &# 39 ; s law ), which is reasonably accurate for a range of chromophores and concentrations . beer &# 39 ; s law states that the optical absorbance of a fluid with a chromophore concentration varies linearly with path length through the fluid and the chromophore concentration as : ε λ = molar absorptivity or extinction coefficient of the chromophore at wavelength λ ( the optical density of a 1 - cm thick sample of a 1 m solution ); b = sample path length in centimeters ; and , c = concentration of the compound in the sample , in molarity ( mol l − 1 ). the absorbance ( a λ ) at a wavelength λ is related to the ratio of light energy passing through the fluid , i , to the incident light energy , i 0 , in for deoxyhemoglobin and oxyhemoglobin , the extinction coefficient spectra are well known . the path length within the spinal cord is dependent upon the geometry of the ellipsoid shaped spinal cord cross - section and its normal vector relative to the optical axes of the emitter and detector pair . the optical path length within csf is roughly equal to the nominal geometric path length as the scatter is small and the index of refraction does not vary considerably along the path . light absorption of the csf may be approximated by that of its primary constituent , h 2 0 . sensitivity of the system to csf path length may be optimized using a light wavelength at a local maxima of the water extinction coefficient curve near 950 - 1100 nm . when considering the light emitter wavelength , one must also consider the extinction coefficients of the primary chromophores , deoxy - and oxy - hemoglobin . to minimize effects of blood flow changes within the spinal cord ( although these are thought to be insignificant in the quasi - static sense ), one may select the isosbestic wavelength of these chromophore species , preferably at about 805 nm . the geometry of the light emitter and detector aperture relative to the spinal cord is the parameter most prone to variability . the variance results from factors such as dependence upon placement of the electrode within the spinal canal , canal diameter , spinal cord shape , spinal cord caliber , and presence of scoliotic or kyphotic curvature within the spine . consequently , this geometric parameter is the primary reason that the system must be calibrated , in situ , in vivo . spinal cord position may then be inferred through various methods from data obtained at ordinal body positions . the effects of geometry may be minimized by minimizing the angle between the light emitter and optical detector optical axes relative to the spinal cord surface normal vector . the beam divergence of the light emitter relative to the incident and reflected rays will influence the detected light amplitude . it is desirable to maintain a constant electric field at a group of target cells in the spinal cord as the spinal cord moves in order to consistently reduce the transmission of a pain sensation to the brain . with the patient in a prone position or bending forward ( 0 ° direction ), the spinal cord moves anterior within its orbit in the spinal canal . an increase in stimulation pulse amplitude for each electrode pair is required to maintain the same electric field density . in the right lateral position or bent to the right ( 90 ° direction ), the spinal cord moves to the right within its orbit in the spinal canal . a decrease in electrode stimulation pulse amplitude in the right electrode and an increase in electrode stimulation pulse amplitude in the left electrode of the electrode pair is required . in the supine position or bending backward ( 180 ° direction ), the spinal cord moves dorsally within its orbit within the spinal canal . a decrease in electrode stimulation pulse amplitude bilaterally is required to maintain a constant electric field across the spinal cord . in the left lateral position or bent toward the left ( 270 ° direction ), the spinal cord moves to the left within its orbit . a decrease in electrode stimulation pulse amplitude in the left electrode and an increase in electrode stimulation pulse amplitude in the right electrode of the electrode pair is required . referring to fig5 a , a preferred embodiment of surgical lead 520 is shown . surgical lead 520 includes an elastomeric housing 501 connected to lead 510 and to lead 511 . optical fiber 502 , optical fiber 503 , electrodes 512 and electrodes 513 are embedded in elastomeric housing 501 . in a preferred embodiment , the elastomeric housing is generally rectangular . other shapes may suffice . optical fiber 502 is terminated with optical element 509 . optical fiber 503 is terminated with optical element 508 . lead 510 encloses optical fiber 502 and wires 504 and is terminated with opto - electrical connector 506 . lead 511 encloses optical fiber 503 and wires 505 and is terminated with opto - electrical connector 507 . fig5 b shows a cross - sectional view of lead 510 . leads 510 and 511 are identical in structure . lead 510 includes outer surface 515 which encapsulates wires 504 , lumen 516 and filler material 519 . lumen 516 encloses optical fiber 502 . outer surface 515 is comprised of a shield for electromagnetic signals . in a preferred embodiment , the outer surface is made of a conductive material including metal sheeting , wire mesh and metal coatings . filler material 519 is comprised of a polyimide polymer . in an alternate embodiment , filler material 519 can include additional materials with physical properties that enhance electromagnetic shielding properties such as conductive particles and / or carbon nano - tube composites . referring to fig5 c , opto - electrical coupler 506 is shown . opto - electrical couplers 506 and 507 are identical in structure . in a preferred embodiment , opto - electrical coupler 506 includes case 560 with epoxy header 552 , and optical fiber with cladding 553 . epoxy header 552 includes cavity 557 . cavity 557 includes spring loaded connectors 556 which are electrically connected to the pulse generator and sender unit ( which will be further described ). case 560 includes cavity 561 connecting to cavity 557 and terminating in nir transparent window 562 . in a preferred embodiment , nir transparent window 562 is flat . however , in an alternate embodiment , nir transparent window is a lens . in another example , collimating lens 554 is an optical fiber with a polished end . opto - electrical component 565 is situated behind the nir transparent window . nir transparent window 562 serves as a hermetic barrier between cavity 561 and opto - electrical component 565 . nir transparent window 562 also serves as an optical coupler . opto - electrical component 565 may be an optical emitter . opto - electrical component 565 may be an optical detector . in use , the lead is inserted into cavity 557 during a surgical procedure until collimating lens 554 is directly adjacent barrier 562 . the spring connectors override and engage contacts 551 on lead 550 . fig6 shows a cross - sectional view of a vertebra 622 and spinal cord 625 . surgical lead 620 is implanted in epidural space 626 of vertebra 622 between the dura 621 and the walls of the spinal canal 629 using a surgical procedure . referring to fig7 , a sagittal view of surgical lead 620 is shown implanted in relation to dura 721 and spinal cord 720 . spinal cord 720 includes target cells 719 . surgical lead 620 is implanted outside dura 721 , approximately aligned with midline axis 724 . in use , probe light beam 761 is transmitted through optical fiber 611 and emitted from optical element 608 . the probe light beam propagates through spinal canal , experiences absorption by the dura and the spinal fluid , and is reflected and scattered by the spinal cord . reflected light beam 762 is collected by optical element 609 and is transmitted through optical fiber 613 . electrodes 512 and 513 supply stimulation current to the spinal cord based on the intensity of the reflected light beam . referring to fig8 a - 8 d , axial views of the spinal cord 820 and surgical lead 800 are shown with spinal cord 820 and dura 821 in various positions in the spinal canal caused by movement of the patient . the figures are shown in relation to coronal axis 824 and sagittal axis 825 . referring to fig8 a , spinal cord 820 is in a forward position toward 0 ° along sagittal axis 825 . path p 1 defines a light path from optical element 608 to reflection point r 1 and then to optical element 609 . the length of path p 1 is d 1 . optical element 608 emits light from optical source 805 along path p 1 where it is reflected at point r 1 by the spinal cord surface . optical element 609 collects light from path p 1 after reflection at point r 1 . light collected by optical element 609 , is detected by photodetector 806 and converted to photocurrent i 1 in response . in fig8 b , spinal cord 820 is in a rightward position , rotated by angle 828 from sagittal axis 825 where target cells 819 are shifted rightward toward 90 ° and parallel to coronal axis 824 by distance 827 . path p 2 defines a light path from optical element 608 to reflection point r 2 and then to optical element 609 . the length of path p 2 is d 2 ( which is less than d 1 ). optical element 609 emits light from optical emitter 805 along path p 2 where it is reflected at point r 2 by the spinal cord surface . optical element 608 collects light from path p 2 after reflection at point r 2 . light collected by optical element 608 , is detected by photodetector 806 and converted to photocurrent i 2 in response . in fig8 c , spinal cord 820 is in a posterior position shifted by a distance 826 towards optical elements 608 and 609 along sagittal axis 825 . path p 3 defines a light path from optical element 609 to reflection point r 3 and then to optical element 608 . the length of path p 3 is d 3 ( which is less than d 1 or d 2 ). optical element 609 emits light from optical emitter 805 along path p 3 where it is reflected at point r 3 by the spinal cord surface . optical element 608 collects light from path p 3 after reflection at point r 3 . light collected by optical element 608 , is detected by photodetector 806 and converted to photocurrent i 3 in response . in fig8 d , spinal cord 820 is in a left position , rotated by angle 830 from sagittal axis 825 where target cells 819 are shifted leftward along sagittal axis 824 by distance 829 . path p 4 defines a light path from optical element 609 to reflection point r 4 and then to optical element 608 . the length of path p 4 is d 4 which is less than d 1 , but about the same as d 2 . optical element 609 emits light from optical emitter 805 along path p 4 where it is reflected at point r 4 by the spinal cord surface . optical element 608 collects light from path p 4 after reflection at point r 4 . light collected by optical element 608 , is detected by photodetector 806 and converted to photocurrent i 4 in response . an electric field produced by the electrodes 801 , including electrodes 812 and electrodes 813 , stimulates target cells 819 in the spinal cord 820 . current amplitude is supplied to the electrodes in pulses , each having a pulse width and a pulse frequency . the relative current amplitude must be increased as the target cells move away from the electrodes . also , the intensity of the reflected signal decreases as the surface of the spinal cord moves away from the optical elements . hence , as the reflected light beam decreases , the current amplitude must increase to maintain the same electrical field intensity at the target cells . fig9 shows a plot 900 of relative electric field strength required to be generated at the electrodes in order to maintain a constant electrical field at target cells 819 , as the spinal cord is moved through an orbit of 360 ° in the spinal canal . referring to fig1 , an alternate embodiment of a surgical lead is shown . surgical lead 1000 includes an elastomeric housing 1001 connected to lead 1010 and to lead 1011 . embedded in elastomeric housing 1001 , are optical fiber 1002 , optical fiber 1003 , electrodes 1012 and electrodes 1013 . optical fiber 1002 is terminated with an optical element 1008 . optical fiber 1003 is terminated with optical element 1009 . lead 1010 encloses optical fiber 1002 and wires 1004 which are terminated in opto - electrical connector 1006 . lead 1011 encloses optical fiber 1003 and wires 1005 which are terminated in opto - electrical connector 1007 . referring to fig1 , a cross - sectional view of vertebra 1122 is shown enclosing spinal cord 1125 . surgical lead 1100 is placed in the epidural space 1126 of vertebra 1122 between dura 1121 and the walls of the spinal canal 1129 . surgical lead 1100 includes optical elements 1108 and 1109 . referring to fig1 , a top view of surgical lead 1200 is shown implanted adjacent dura 1221 . optical source 1205 and optical detector 1204 are shown schematically . surgical lead 1200 includes optical element 1208 coupled to optical source 1205 and optical element 1209 coupled to optical detector 1204 . surgical lead 1200 is positioned within an operational range of target cells 1219 . in use , light beam 1261 is emitted from optical source 1205 , propagates through optical fiber 1203 and exits from optical element 1208 . the light beam then propagates through spinal canal , experiences absorption by the dura and the spinal fluid , and is reflected and scattered by the surface of the spinal cord . reflected light beam 1262 is collected by optical element 1209 . reflected light beam 1262 propagates through optical fiber 1202 and is detected by optical detector 1204 . referring to fig1 a - 13 d , top views of spinal cord 1220 and surgical lead 1200 are shown with spinal cord 1220 in various positions . electrodes 1212 and 1213 supply stimulation current to the spinal cord . surgical lead 1200 is approximately aligned with coronal axis 1324 . the figures are shown in relation to coronal axis 1324 and sagittal axis 1325 . referring to fig1 a , the spinal cord is positioned forward . path p 5 defines a light path from optical element 1208 to reflection point r 5 and then to optical element 1209 . the length of path p 5 is d 5 . optical element 1208 emits light along path p 5 and optical element 1209 collects light from path p 5 after reflection at point r 5 from spinal cord 1220 . light collected by optical element 1209 is detected by photodetector 1204 which produces a photocurrent of i 5 in response . referring to fig1 b , the spinal cord is rotated through angle 1328 and positioned rightward by a distance 1327 . path p 6 defines a light path from optical element 1208 to reflection point r 6 and then to optical element 1209 . the length of path p 6 is d 6 which is less than the length d 5 . optical element 1208 emits light along path p 6 and optical element 1209 collects light from path p 6 after reflection at point r 6 from spinal cord 1220 . light collected by optical element 1209 is detected by photodetector 1204 which produces a photocurrent of i 6 in response . i 6 is greater than i 5 . referring to fig1 c , the spinal cord is positioned towards the back and displaced by a distance 1326 . path p 7 defines a light path from optical element 1208 to reflection point r 7 and then to optical element 1209 . the length of path p 7 is d 7 which is shorter than length d 5 or d 6 . optical element 1208 emits light along path p 7 and optical element 1209 collects light from path p 7 after reflection at point r 7 from spinal cord 1220 . light collected by optical element 1209 is detected by photodetector 1204 which produces a photocurrent of i 7 in response . i 7 is greater than i 5 and i 6 . referring to fig1 d , the spinal cord is rotated through angle 1330 and positioned leftward by a distance 1329 . path p 8 defines a light path from optical element 1208 to reflection point r 8 and then to optical element 1209 . the length of path p 8 is d 8 which is less than length d 5 but about the same as d 6 . optical element 1208 emits light along path p 8 and optical element 1209 collects light from path p 8 after reflection at point r 8 from spinal cord 1220 . light collected by optical element 1209 is detected by photodetector 1204 which produces a photocurrent of i 8 in response . i 8 is about the same as i 6 . an electric field produced by electrodes 1212 and electrodes 1213 , stimulates target cells 1219 in the spinal cord 1220 . table 1 indicates the relative levels of electrode stimulation current required based on photocurrent . referring to fig1 , alternate embodiment 1450 is shown in which two percutaneous leads are provided . percutaneous lead 1461 includes optical fiber 1451 , optical element 1459 , electrodes 1471 and contacts 1475 . optical fiber 1451 is coupled to optical element 1459 . percutaneous lead 1461 also includes electrical wires ( not shown ). the percutaneous lead terminates in opto - electrical connector 1453 . percutaneous lead 1462 includes optical fiber 1452 , optical element 1458 , electrodes 1472 and contacts 1476 . optical fiber 1452 is coupled to optical element 1458 . percutaneous lead 1462 also includes electrical wires ( not shown ). the percutaneous lead terminates in opto - electrical connector 1454 . percutaneous lead 1461 is identical to percutaneous lead 1462 . referring to fig1 a , a preferred embodiment of a percutaneous lead is shown . percutaneous lead 1500 includes lead body 1501 in which an optical fiber 1510 is embedded . optical fiber 1510 is coupled to collimating lens 1504 . lead body 1501 also includes electrodes 1507 connected by electrical wires 1509 to contacts 1508 . optical fiber 1510 includes a cladding 1502 and a core 1503 co - centered on fiber optic axis 1548 . optical fiber 1510 is coupled to an angled lens assembly 1505 . angled lens assembly 1505 includes a housing 1549 coupled to optical fiber 1510 and core 1503 . housing 1549 further includes collimating lens 1542 and reflective surface 1544 at an angle α from fiber optic axis 1548 . collimating lens 1542 and reflective surface 1544 are positioned to collimate light along axis 1547 . angle α is preferably in the range of about 30 ° to about 60 °. referring to fig1 b , an alternate embodiment of a percutaneous lead is shown . percutaneous lead 1520 includes lead body 1521 in which an optical fiber 1530 is embedded . optical fiber 1530 is coupled to collimating lens 1524 . lead body 1521 also includes electrodes 1527 connected by electrical wires 1529 to contacts 1528 . optical fiber 1530 includes cladding 1522 and core 1523 . optical fiber 1530 includes negative axicon 1525 . for an uncoated negative axicon , angular extent β is less than about 33 ° for typical glass . the maximum value of β is determined as the complement of the critical angle χ for the optical material in core 1523 . the complement of the critical angle is ( 90 °− χ ). if the negative axicon has a reflective coating then angular extent 13 is approximately 45 °. referring to fig1 , a cross - sectional view of vertebra 1622 is shown enclosing spinal cord 1620 . percutaneous lead 1661 and percutaneous lead 1662 are implanted in epidural space 1626 of vertebra 1622 between dura 1621 and the walls of the spinal canal 1629 . in a preferred embodiment , the percutaneous leads are implanted side - by - side at a predetermined distance apart , adjacent , and generally parallel to , each other . placement of percutaneous leads 1661 and 1662 can be accomplished through insertion of the leads through needles placed percutaneously into the epidural space . referring to fig1 , a cross - sectional axial view of the percutaneous leads implanted is shown . percutaneous lead 1761 includes optical element 1708 and electrodes 1471 . optical element 1708 is coupled to an optical source 1705 . percutaneous lead 1762 , also implanted outside dura 1721 , includes optical element 1709 and electrodes 1472 where optical element 1709 is coupled to optical detector 1704 . percutaneous leads 1761 and 1762 are positioned within an operational range of target cells 1719 of spinal cord 1720 . in use , a light beam is emitted from optical source 1704 , propagates through optical fiber 1703 and exits from optical element 1708 as light beam 1781 . light beam 1781 propagates through the spinal canal , experiences absorption by the dura and the spinal fluid , and is reflected and scattered to create reflected light beam 1782 . reflected light beam 1782 is collected by optical element 1709 and detected by optical source 1705 . referring to fig1 a - 18 d , spinal cord 1720 is shown in various positions in the spinal canal in relation to coronal axis 1824 and sagittal axis 1825 . referring to fig1 a , the spinal cord is positioned forward , path p 9 defines a light path from optical element 1708 to reflection point r 9 and then to optical element 1709 . optical element 1708 emits light , along path p 9 . optical element 1709 collects light after reflection from point r 9 . light collected by optical element 1709 is detected by optical source 1705 which produces a photocurrent i 9 in response . referring to fig1 b , the spinal cord is rotated through angle 1828 and positioned rightward by a distance 1827 towards 90 °. path p 10 defines a light path from optical element 1708 to reflection point r 10 and then to optical element 1709 . the length of path p 10 is less than the length of path p 9 . optical element 1708 emits light , including light along path p 10 . optical element 1709 collects light after reflection at point r 10 . reflected light collected by optical element 1708 is detected by photodetector 1705 which produces a photocurrent i 10 in response . i 10 is greater than i 9 . referring to fig1 c , the spinal cord is positioned towards the back and displaced dorsally by a distance 1826 . path p 11 defines a light path from optical element 1708 to reflection point r 11 and then to optical element 1709 . the length of path p 11 is shorter than the length of paths p 9 or p 10 . optical element 1708 emits light , including light along path p 11 . optical element 1709 collects reflected light . reflected light collected by optical element 1709 is detected by photodetector 1705 which produces a photocurrent i 11 in response . i 11 is greater than i 9 and i 10 . referring to fig1 d , the spinal cord is rotated through angle 1830 and positioned leftward by a distance 1829 towards 270 °. path p 12 defines a light path from optical element 1708 to reflection point r 12 and then to optical element 1709 . the length of path p 12 is less than length of path p 9 but about the same as the length of path p 10 . optical element 1708 emits light , including light along path p 12 . optical element 1709 collects reflected light , including light from path p 12 . reflected light collected by optical element 1709 is detected by photodetector 1705 which produces a photocurrent i 12 in response . i 12 is about the same amplitude as i 10 . the relative electrode stimulation amplitudes for various photocurrents are summarized by table 1 . referring to fig1 , a preferred embodiment of a stimulator system is shown . stimulator system 1945 includes pulse generator and signal processor ( pgsp unit ) 1950 is connected to stimulator lead assembly 1940 . pgsp unit 1950 provides power to the electrodes in stimulator lead assembly 1940 and houses electronic and electro - optical components of the system . stimulator lead assembly 1940 connects the stimulator electrodes of each stimulator lead to a controllable current source . stimulator lead assembly 1940 further connects at least one infrared emitter to at least one optical fiber through a first fiber optical connector and at least one photodetector to at least one optical fiber through additional fiber optic connectors . in a preferred embodiment pgsp unit 1950 is installed subcutaneously in a patient and stimulator lead assembly 1940 includes a percutaneous lead or a surgical lead . in an alternate embodiment , pgsp unit 1950 is outside the host patient &# 39 ; s body and stimulator lead assembly includes the percutaneous leads . pgsp unit 1950 gathers and processes photodetector signals and makes adjustments to the stimulator electrode current ( or voltage ) based on the photodetector signals . pgsp unit 1950 is connected by wireless communication link 1952 across skin boundary 1956 to scs controller 1953 . the scs controller is configured to allow percutaneous activation of and adjustments to stimulator system 1945 . pgsp unit 1950 is also connected by wireless communication link 1955 to calibration and programming unit 1954 . calibration and programming unit 1954 is programmed to accept patient input and transmit the patient input to pgsp 1950 during calibration . in an alternate embodiment , calibration and programming unit 1954 is incorporated into scs controller 1953 . pgsp unit 1950 is preferably powered by batteries . in an alternate embodiment , pgsp unit 1950 derives power from capacitive or inductive coupling devices . wireless communication links 1952 or 1955 may further serve as a means of providing electrical charge for the batteries or capacitive devices of pgsp unit 1950 . referring to fig2 , a block diagram of pgsp unit 1950 is shown . pgsp unit 1950 includes cpu 2070 having onboard memory 2072 and hardware timer 2073 . in a preferred embodiment , the memory includes two data buffers which are used as “ stacks .” the hardware timer includes a timer register . cpu 2070 is connected to pulse modulator 2062 , pulse generator 2060 , and pulse generator 2061 . pulse modulator 2062 is connected to pulse generators 2060 and 2061 which are further connected to a stimulator lead through lead connectors 2083 and 2084 , respectively . cpu 2070 is also operatively connected to optical modulator 2068 and optical signal processor 2064 . optical modulator 2068 is connected to emitter driver 2066 . emitter driver 2066 is connected to ir emitter 2079 and drives ir emitter 2079 . ir emitter 2079 includes fiber optic connector 2081 to effectively couple ir emitter 2079 to a first optical fiber which is further connected to a first distal optical element in a surgical lead or percutaneous lead assembly . optical detector 2077 is connected to fiber optical connector 2082 to effectively couple optical detector 2077 to a second optical fiber which is further connected to a second distal optical element in a surgical lead or percutaneous lead assembly . optical detector 2077 translates incoming light pulses from the optical fiber into electrical signals which are processed by optical signal processor 2064 . in a preferred embodiment , the photodetector is similar to that of part no . op501 from optek technology . cpu 2070 is connected to optical signal processor 2064 . optical signal processor 2064 is connected to optical detector 2077 and receives an optical signal from the photodetector and filters the optical signal . optical signal processor 2064 may include a synchronized gated detection ( e . g ., lock - in amplifier type ) function or other demodulation function to improve the signal to noise ratio of the detected light . cpu 2070 is connected to optical modulator 2068 . emitter driver 2066 is connected to both optical modulator 2068 and cpu 2070 . in operation , cpu 2070 activates optical modulator 2068 which generates a waveform and transmits the waveform to the emitter driver 2066 . the emitter driver then causes ir emitter 2079 to launch a light pulse with the waveform into the first optical fiber . the optical waveform may take several forms . for example , the pulse width of the optical waveform may have a low duty cycle to minimize power consumption . a single optical pulse may occur for multiple electrode stimulation pulses . the optical waveform may include frequency , phase or amplitude modulation . typical wavelength of the ir light from the ir emitter is in a range from 800 nm to 870 nm . typical output intensity of the ir emitter is 1 to 2 mw and a suitable part is part no . vsmy1859 from vishay intertechnology , inc . pulse generator 2060 is connected to electrodes in stimulator lead assembly 1940 through lead connector 2083 . in order to generate a pulse to the electrodes , cpu 2070 consults a calibration table stored in onboard memory 2072 to determine pulse width pw , pulse frequency pf and pulse amplitudes for the electrodes , respectively . the pulse width and frequency are transmitted to pulse modulator 2062 which creates a modified square wave signal . the modified square wave signal is passed to pulse generator 2060 . cpu 2070 passes the amplitudes for the electrodes to pulse generator 2060 in digital form . pulse generator 2060 then regulates the peak current or voltage of the modified square waves according to the pulse amplitudes and transmits them to the electrodes through lead connector 2083 . cpu 2070 is in transcutaneous communications , via rf transceiver 2071 , with calibration and programming unit 1954 and scs controller 1953 . pulse generator 2060 and pulse modulator 2062 may collectively be composed of a digital - to - analog converter with associated current or voltage sources . pulse generator 2061 is connected to electrodes in stimulator lead assembly 1940 through lead connector 2084 . in order to generate a pulse to the electrodes , cpu 2070 consults a calibration table stored in onboard memory 2072 to determine pulse width pw , pulse frequency pf and pulse amplitudes for the electrodes , respectively . the pulse width and frequency are transmitted to pulse modulator 2062 which creates a modified square wave signal and passes it to pulse generator 2061 . cpu 2070 passes the amplitudes for the electrodes to pulse generator 2061 in digital form . pulse generator 2061 then regulates the peak amplitude of the modified square waves according to the pulse amplitudes and transmits them to electrodes through lead connector 2084 . cpu 2070 is in transcutaneous communications , via rf transceiver 2071 , with calibration and programming unit 1954 and scs controller 1953 . pulse generator 2061 and pulse modulator 2062 may collectively be composed of a digital - to - analog converter with associated current or voltage sources . the modified square wave has an amplitude and duration ( or width ). pulse widths varying from 20 to 1000 microseconds have been shown to be effective . the frequency of the pulse waveforms between 20 and 10 , 000 hertz have been shown to be effective . the output amplitude is preferably from 0 ( zero ) to +/− 20 ma or 0 ( zero ) to +/− 10 v but may vary beyond those ranges according to patient sensitivity . pgsp unit 1950 also includes an orientation detector 2090 for determining the physical orientation of the patient including roll , pitch and yaw coordinates . preferably , the orientation detector can distinguish lack of motion in the patient for a predefined period of time . a suitable component for the orientation detector is one of part numbers um6 - lt and minimu - 9 orientation sensors from polulu corporation . in a preferred embodiment , orientation detector 2090 is installed or affixed to the pgsp . in a preferred embodiment , the pgsp is installed so that the orientation detector roll axis coincides with the patient &# 39 ; s longitudinal axis ( intersection of sagittal and coronal planes ), the pitch axis coincides with a first transverse axis ( intersection of transverse and coronal planes ), and the yaw axis coincides with a second transverse axis ( intersection of transverse and sagittal planes ). referring to fig2 , scs controller 1953 is shown . scs controller 1953 includes processor 2100 connected to rf transceiver 2102 , to display 2104 , to input / output device 2106 and to memory 2108 . in the preferred embodiment , display 2104 is a low power liquid crystal display adapted to show the current operational state of the system . i / o device 2106 is a simple push button contact array which is constantly monitored by processor 2100 . in the preferred embodiment , rf transceiver 2102 is a low power transmitter / receiver combination . referring to fig2 , calibration and programming unit 1954 is described . calibration and programming unit 1954 includes processor 2210 connected to onboard memory 2218 , to input / output devices 2216 and 2217 , to rf transceiver 2212 and to display 2214 . display 2214 , in the preferred embodiment , is a low power liquid crystal display . input / output device 2216 and input / output device 2217 are simple push button switches monitored continuously by the processor . rf transceiver 2212 is a low power transmitter / receiver combination . referring to fig2 , the various states of the scs controller in operation will be described . at wait state 2305 , scs controller 1953 enters a waiting posture and continually polls the i / o device and responds to system interrupt signals , for example , a timer interrupt to enter the “ run ” state . upon receipt of a “ run ” signal from the i / o device , the processor enters “ run ” state 2307 and transmits a “ run ” signal to the rf transceiver . the rf transceiver then transmits the “ run ” signal to pgsp 1950 for further action , for example , executing a run cycle method . after transmission , the processor returns to wait state 2305 . while in “ run ” state 2307 , if the patient is determined to be at rest for a predetermined period of time , then the scs controller enters the “ calibrate optics ” state 2308 and the optical source is recalibrated . after the recalibration of the optical source is complete or if the patient begins to move , the scs controller returns to “ run ” state 2307 . if a “ stop ” signal is received from the i / o device , the processor passes a “ stop ” signal to the rf transceiver , which in turn sends the “ stop ” signal to pgsp 1950 . the pgsp unit then enters stop state 2309 . the processor then returns to wait state 2305 . if the “ stop ” signal includes a directive to turn off power , then power to the pgsp unit is shut down in the stop state and no electrode stimulation current is applied to the host patient . if a “ calibrate ” signal is received from i / o device 2106 , processor 2100 transmits a “ calibrate ” signal to rf transceiver 2102 , which in turn sends the “ calibrate ” signal to pgsp 1950 . the system enters “ calibrate stimulation ” state 2311 in which parasthesia levels are optimized in certain patient positions and stimulation current calibrated for the host patient . processor 2100 returns to wait state 2305 after calibration is complete . fig2 shows calibration table 2440 for the stimulation system . the table is stored in memory and includes optimal electrode settings for each patient position . in a preferred embodiment , column 2442 includes four patient positions : forward ( prone )— 0 °, right lateral — 90 °, back ( supine )— 180 °, and left lateral — 270 °. each row in calibration table 2440 is associated with one of the patient positions . in an alternate embodiment , additional physical positions are included . in the preferred embodiment , column 2444 stores values for the roll , pitch and yaw orientation for the patient . column 2446 stores values for the current measured for each photodetector . column 2448 stores values for the electrode stimulation pulse amplitude which produces the optimal paresthesia ( or stimulation ) in that patient position . column 2450 stores values for the electrode stimulation pulse width . column 2452 stores values for the electrode stimulation pulse frequency . fig2 shows an alternate preferred embodiment of a calibration table 2500 . in a preferred embodiment , column 2510 provides a row index . column 2511 provides a location to store patient positions comparing to the row index . each row in calibration table 2500 is associated with one of the row indices . column 2512 stores values for the minimum photocurrent provided by the photodetectors at the patient positions . column 2513 stores values for the corresponding maximum photocurrent delivered by the photodetectors . column 2514 stores values for the minimum stimulation current amplitude for the right electrodes . column 2515 stores values for the maximum stimulation current for the right electrodes . column 2516 stores the values for the stimulation current amplitudes for the left electrodes . column 2517 stores values for the maximum stimulation current for the left electrodes . the maximum and minimum stimulation current amplitudes are provided to set the stimulator in a range of current amplitudes between a minimum , where no response is felt , and a maximum where the stimulation is noxious . the maximum and minimum values are determined during electrode pulse stimulation calibration , as will be further described . referring to fig2 , an embodiment of a method of operation of the stimulation system is described . in a preferred embodiment , method 2600 is implemented by a computer program which is resident in onboard memory 2072 of cpu 2070 of pgsp 1950 . at step 2631 , rf transceiver 2071 is polled for a change of operation code signal received from scs controller 1953 . the system maintains its current operational state until a change of operation code is received . in a preferred embodiment , a change of operation code signal is initiated by an interrupt generated by a handware timer . in an alternate preferred embodiment , the change of operation code can be initiated by a button press . at step 2633 , if operation change code “ run ” is received , the method moves to step 2642 . at step 2642 , a stimulation routine is performed to adjust the electrode stimulation current for the patient based on photocurrent measurements . this step is further described below . at step 2657 , the cpu determines if the patient is at rest . in this step , the physical orientation of the patient is monitored by reading changes in values of roll , pitch and yaw that have occurred during a predetermined time interval . if the values are unchanged for a minimum arbitrarily defined duration , then the patient is assumed to be at rest and the method moves to step 2668 . at step 2668 , the optical source is calibrated based on the patient &# 39 ; s position , as will be described more fully below . the method then returns to step 2631 . if , at step 2657 , the patient is determined not to be at rest , then the method returns to step 2631 . if , at step 2633 , the operation change code is not “ run ”, then the method moves to step 2635 . at step 2635 , the cpu determines if the operation change code is “ stop ”. if the change code is “ stop ”, then the method returns to step 2631 . if , at step 2635 , the operation change code is not “ stop ”, then the method moves to step 2637 . at step 2637 , the cpu determines if the operation change code is “ calibrate .” if , at step 2637 , the operation change code is not “ calibrate ”, then the method returns to step 2631 . if , at step 2637 , the operation change code is “ calibrate ”, then the method moves to step 2638 . at step 2638 , the cpu transmits historical data to the calibration and programming unit where it is stored . the historical data comprises a copy of the current calibration table , a value of optical source current , orientation sensor calibration data and a time series of electrode stimulation settings as they were performed by the stimulation routine since the previous calibration . at step 2639 , the cpu performs a calibration of stimulation current levels for the patient as will be described more fully below . the method then returns to step 2631 . referring to fig2 a , method 2700 for performing the stimulation routine 2642 is described . the method starts at step 2742 . at step 2743 , a photocurrent value is measured for each photodetector with the ir emitter in the “ off ” state . at step 2744 , cpu 2070 activates optical modulator 2068 , which in turn activates emitter driver 2066 to generate an optical pulse from the ir emitter . at step 2746 , photocurrent values for each photodetector are measured with the ir emitter in the “ on ” state . at step 2747 , the ir emitter is turned off . at step 2748 , corrected photocurrent values are derived by subtracting the “ off ” photocurrent value from the “ on ” photocurrent value for each ir detector . in a preferred embodiment , this step employs the equation : where pd meas is the “ on ” photocurrent value , pd dark is the “ off ” photocurrent value and pd corr is a corrected photocurrent value . the corrected photocurrent values are stored in memory . at step 2749 , the cpu determines the electrode stimulation pulse amplitudes . in one preferred embodiment , the electrode stimulation pulse amplitudes are interpolated from the calibration table based on the photodetector current . for example , referring to fig2 , if the corrected photocurrent value of pd corr has a value between pd 2 and pd 3 , then a stimulation amplitude a is determined from a linear interpolation according to : a = a 2 + δ ⁢ ⁢ a δ ⁢ ⁢ pd ⁢ ( pd corr - pd 2 ) ( eq . ⁢ 4 ) in another preferred embodiment , a spline interpolation is used . other interpolation methods as known in the art can be employed . at step 2750 , the cpu optionally sets values of electrode stimulation pulse width and electrode stimulation pulse frequency . in the preferred embodiment , electrode stimulation pulse width and electrode stimulation pulse frequency are constant . in another embodiment , electrode stimulation amplitude is constant and electrode stimulation pulse width is varied as a function of photocurrent . in another embodiment , electrode stimulation amplitude is constant and electrode stimulation pulse frequency is varied as a function of photocurrent . at step 2752 , the cpu optionally activates the pulse modulator to create a waveform which is impressed on the pulse trains sent to the electrodes and then activates the pulse generator to deliver the pulse trains . at step 2754 , the cpu stores the corrected photocurrent values , the electrode stimulation pulse amplitudes , the electrode stimulation pulse widths and the electrode stimulation pulse frequencies in memory . at step 2755 , the method returns . referring to fig2 b , alternate method 2775 of determining electrode stimulation pulse amplitudes of step 2749 , is described . the method starts at step 2789 . at step 2790 , the cpu interpolates an electrode stimulation pulse amplitude from the calibration table . at step 2792 , the interpolated electrode stimulation pulse amplitude is stored in memory in a time series of interpolated stimulation amplitude values . the time series of interpolated simulation amplitude values is a historical record of the stimulation amplitudes applied to the electrodes over a predetermined past period of time . at step 2796 , the cpu performs a moving average over the time series of interpolated stimulation amplitude values to determine an electrode pulse amplitude . the calculation of the electrode pulse amplitude is made using the following equation : a ave = w k · a k + w k - 1 · a k - 1 + w k - 2 · a k - 2 + … w k + w k - 1 + w k - 2 + … , ( eq . ⁢ 5 ) where a ave is the pulse amplitude applied to the electrode , w k is a predetermined weight for value a k , in the time series of stimulation amplitude values , at the current time k , value a k - 1 at the previous time ( k − 1 ) and so forth for earlier times ( k − 2 ), ( k − 3 ), . . . , etc . for example , the predetermined weights are predefined to fall off exponentially where w k = w 0 e − ak and the sum in eq . 5 is capped to include n terms . at step 2798 , the method returns . referring to fig2 a , method 2800 to calibrate the optical source of step 2668 is described . when the optical source degrades , generally the photocurrent levels will decrease for a given patient orientation . degradation of the optical source occurs for many reasons , for example , changes in the position of the surgical lead , growth of scar tissue , and fracturing of optical components and fibers , among other causes . the optical calibration method detects and corrects for long term degradations in performance of the optical components of the system . at step 2845 , the method starts . at step 2852 , the ir emitter is turned “ on .” as a result , light from the ir emitter is reflected from the spinal cord and received by the photodetector . at step 2854 , the resulting photocurrent is measured . at step 2856 , the patient orientation is measured . in a preferred embodiment , the patient orientation is measured by polling the orientation detector for absolute roll , pitch and yaw coordinates . at step 2860 , the roll , pitch and yaw coordinates are then compared to those recorded in the calibration table . if a match is determined within a predefined confidence interval , such as ± 10 %, then that patient position is reported as the instant patient position . then the method moves to step 2862 . if a match is not determined within the confidence interval , then the method returns at step 2883 . at step 2862 , the instant photocurrent is measured and stored . at step 2864 , the average photocurrent is calculated for a predetermined period of time past . at step 2864 , the average photo current value for the instant patent position is determined . the average photocurrent value is determined for a predetermined past period of time for that patient position and reported as the average photocurrent value . at step 2870 , the average orientation and the average photocurrent values are stored . at step 2872 , an optical degradation factor is determined . in a preferred embodiment , the optical degradation is a ratio between the average photocurrent value and the instant photocurrent value . at step 2876 , the optical degradation factor is compared to a threshold value . if at step 2876 , the optical degradation factor is not more than the threshold value , then the method returns at step 2883 . if , at step 2876 , the optical degradation factor is more than the threshold value , then the method moves to step 2878 . at step 2878 , the photocurrent value in the calibration table for the instant patient position is multiplied by the optical degradation factor . if , at step 2880 , the optical degradation factor is greater than an alert threshold , then an alert is sent at step 2882 . for example , the alert can be a periodic audible sound or a displayed message on an lcd or led display included with the scs controller . the method then returns at step 2883 . if , at step 2880 , the optical degradation factor is not greater than an alert threshold , the method returns at step 2883 . referring to fig2 b , an alternate method of calibrating the optical source is described . according to method 2802 , the optical source is only calibrated if the patient is in a desired position . in the preferred embodiment , the desired position is the prone position . in the prone position , the spinal cord is farthest from the optical emitter and optical collector of the stimulation system . hence , the optical source current determines the minimum detectable photocurrent level . in a preferred embodiment , method 2802 is called in step 3089 during calibration of the optical source . method 2802 starts at step 2884 . at step 2885 , patient position is determined . the patient position is determined by referencing the patient position in the calibration table which corresponds to the running average of corrected photocurrent value . in an alternate embodiment , the patient position is determined by polling the orientation detector . at step 2886 , the patient position is compared to a desired patient position . if , at step 2886 , the patient is not in the desired position , then the optical source is not calibrated and the method returns at step 2895 . if , at step 2886 , the patient is in the desired position , then the method moves to step 2887 . at step 2887 , the optical source current is stored . at step 2888 , the source current is turned “ off ” at step 2889 , the optical source current is turned “ on ” and the current to it is increased by a predetermined amount . at step 2890 , the photocurrent from the photodetectors is measured . at step 2891 , the photocurrent is compared to a predetermined minimum value . in a preferred embodiment , the predetermined minimum value is between 1 . 5 and 4 . 0 times the current value measured from the photodetectors when the optical source is “ off ” if the photocurrent level is not greater than the minimum value , then the method returns to step 2889 . if the photocurrent is greater than the predetermined minimum value , then the method continues to step 2892 . at step 2892 , a final optical source current is set . at step 2893 , a ratio of the final optical source current to the initial optical source current is determined . at step 2894 , the photocurrent values in the calibration table are adjusted based on the ratio . in a preferred embodiment , all of the calibrated photocurrent values in the calibration table are multiplied by the ratio . referring to fig2 a , method 2900 for calibrating electrode pulse stimulation amplitude , at step 2639 , is described . at step 2910 , the method starts . at step 2940 , the orientation sensor is calibrated . in a preferred embodiment , the orientation sensor is calibrated to read a roll of 0 °, a pitch of 0 ° and a yaw of 0 ° when the patient is in a known position . at step 2942 , the optical source is calibrated as has been described . at step 2950 , the rf transceiver receives a signal indicative of a request to move the patient to a prone position and passes the request to the cpu . at step 2952 , the patient is physically positioned in a prone position . at step 2954 , electrode pulse stimulation amplitude is adjusted based on patient feedback to optimize the level of paresthesia experienced by the patient while in the prone position . this position is used to set the right and left maximum electrode pulse amplitudes . at step 2956 , the photocurrent level and corresponding electrode stimulation pulse amplitude for the position is stored in the calibration table . at step 2960 , the rf transceiver receives a signal indicative of a request to move the patient to a right lateral position and passes it to the cpu . at step 2962 , the patient is positioned in a right lateral position . at step 2964 , electrode pulse stimulation amplitude is adjusted based on patient feedback to optimize the level of paresthesia experienced by the patient while in the right lateral position . at step 2966 , the photocurrent level and corresponding electrode stimulation pulse amplitude for the position is stored in the calibration table . at step 2970 , the rf transceiver receives a signal indicative of a request to move the patient to a supine position and passes it to the cpu . at step 2972 , the patient is positioned in a supine position . at step 2974 , electrode pulse stimulation amplitude is adjusted based on patient feedback to optimize the level of paresthesia experienced by the patient while in the supine position . this position is used to set the right and left minimum electrode pulse amplitudes . at step 2976 , the photocurrent level and corresponding electrode stimulation pulse amplitude for the position is stored in the calibration table . at step 2980 , the rf transceiver receives a signal indicative of a request to move the patient to a left lateral position and passes it to the cpu . at step 2982 , the patient is positioned in a left lateral position . at step 2984 , electrode pulse stimulation amplitude is adjusted based on patient feedback to optimize the level of paresthesia experienced by the patient while in the left lateral position . at step 2990 , the photocurrent level and corresponding electrode stimulation pulse amplitude for the position is stored in the calibration table . in other embodiments , the order in which the patient is positioned may be changed . also , additional and / or different patient positions may be added . referring to fig2 b , alternate method 2900 for calibrating electrode pulse stimulation amplitudes , at step 2639 , is described . at step 2909 , the method starts . at step 2911 , the optical source is calibrated as has been described . at step 2912 , the patient is physically placed in a known position . in a preferred embodiment , the known position corresponds to one of the 0 °, 90 °, 180 ° or 270 ° positions , previously described . at step 2915 , the minimum electrode pulse stimulation amplitude for the given patient position is obtained from the calibration table . in this embodiment , the calibration table 2500 may be employed . at step 2917 , the pulse generator is directed by the cpu to send a train of pulses to the electrodes at the minimum electrode stimulation pulse amplitude . at step 2920 , paresthesia feedback is solicited from the patient in order to determine if the level of parasthesia is optimal . if the level of parasthesia is not optimal , then the method moves to step 2923 . at step 2923 , the processor increases the electrode stimulation pulse amplitude by a discrete amount . if , at step 2924 , the electrode pulse stimulation amplitude reaches a maximum level , step 2925 is performed . at step 2925 , an alert is sent to the physician . the alert may take the form of an audible sound or a text display . the method then returns at step 2932 . if , at step 2924 , the electrode pulse stimulation amplitude has not reached a maximum level , the method returns to step 2917 . if , at step 2920 , the level of paresthesia is optimal , then the method moves to step 2928 . at step 2928 , the optical signal processor measures the photocurrent for the photodetector . at step 2930 , the amplitude levels are stored in the calibration table . at step 2932 , the method returns . referring to fig3 a , a preferred embodiment of method 3010 for performing a stimulation routine , step 2642 , is described . the method starts at step 3011 . at step 3014 , an “ off ” photocurrent is measured from the photodetector while the ir emitter is turned off . at step 3016 , the ir emitter is turned “ on .” at step 3018 , an “ on ” photocurrent is measured . at step 3020 , the ir emitter is turned off . at step 3022 , a corrected photocurrent value is calculated by subtracting the “ off ” photocurrent value from the “ on ” photocurrent value . at step 3024 , the corrected photocurrent value is stored in the second data buffer . at step 3025 , the oldest photocurrent value from the second data buffer is shifted into the first data buffer when the second data buffer is full . at step 3026 , a time differential value of photocurrent is determined . the time differential value is determined in order to “ smooth ” transitions from one stimulation value to another . in a preferred embodiment , the values of photocurrent in the first data buffer are averaged . the values of photocurrent stored in the second data buffer are averaged . then a difference is taken between the first average value and the second average value according to the equation : where diff is the time differential value , pd ( t 0 ) is the first average value and pd ( t 1 ) is the second average value . at step 3028 , a sampling rate is adjusted based on the time differential value . a method for the adjusting the sampling rate is described in more detail below . at step 3029 , the system delays for a predetermined cycle time . the cycle time is adjusted to increase or decrease the sampling rate to conserve power when the patient is at rest . at step 3030 , the optical source is calibrated , as has been described . referring to fig3 b , method 3040 for adjusting the cycle time is described . the cycle time is increased when the patient is at rest in order to reduce power consumption . in a preferred embodiment , method 3040 is called at step 3028 of method 3010 . method 3040 starts at step 3041 . at step 3042 , a time differential value is compared to the threshold value for patient movement to determine if the patient is moving or at rest . if the time differential value is greater than the threshold value then it is assumed that the patient is moving and the method moves to step 3044 . at step 3044 , the cycle time is decreased so that the position of the patient is more frequently determined when the patient is active . if the time differential value is less than the threshold value then it is assumed that the patient is at rest and the method moves to step 3056 . at step 3056 , the cycle time is increased by a predetermined cycle time increment , up to the maximum cycle time . the cycle time is increased so that the position of the patient is less frequently determined when it is changing less , when the patient is at rest . the method then returns at step 3059 . referring to fig3 c , method 3070 is described for accelerating calibration of the optical source . in a preferred embodiment , method 3070 is called in step 3030 of method 3010 . the method starts at step 3071 . at step 3072 , the time differential value is compared to a predetermined threshold value . if the time differential value is greater than a predetermined threshold value , then the patient is assumed to be moving . the method moves to step 3089 . if the time differential value is less than or equal to the predetermined threshold value , then the patient is assumed to be still . the method then moves to step 3074 . at step 3074 , the patient position is determined . a running average of corrected photocurrent values , pd avg , is compared to the photocurrent values in the calibration table to determine the patient position . in an alternate embodiment , the patient position is determined by reading the orientation detector . at step 3075 , the patient position is compared to a desired position . for example , the supine position or prone position . if the patient is not in the desired position , then the optical source is not calibrated and the method continues at step 3089 . if the patient is in the desired position , then the method continues with step 3076 . at step 3076 , the running average of corrected photocurrent values is updated based on the most recent corrected photocurrent value measured for the patient position . at step 3078 , the measurement count is incremented . at step 3080 , the measurement count is compared to a predetermined count threshold . step 3080 ensures that the running average has been averaged over a sufficiently large number of measurements to accurately calibrate the optical source and to ensure the patient has been motionless for an adequate period . if at step 3080 , the measurement count does not exceed the predetermined count threshold , then an optical calibration cycle is not performed . the method then returns at step 3091 . if at step 3080 , the measurement count exceeds or equals the calibration threshold then the method moves to step 3082 . at step 3082 , a drift amount is calculated from the running average . for example , the drift amount is calculated according to : drift = pd avg ⁡ ( s ) - ( p min ⁡ ( s ) + p max ⁡ ( s ) 2 ) ( eq . ⁢ 7 ) where s is the row index of the calibration table of the patient position , p min ( s ) is from the calibration table in row s and p max ( s ) is from the calibration table in row s . at step 3084 , the calibration table is updated . in a preferred embodiment , the sum of drift and p min ( s ) replaces p min ( s ) in the calibration table and the sum of drift and p max ( s ) replaces p max ( s ) in the calibration table . at step 3089 , the optical source is calibrated as has been described . at step 3090 , the measurement count is reset to zero . the method returns at step 3091 . while the present disclosure has been described in terms of specific embodiments thereof , it will be understood in view of the present disclosure , that numerous variations upon the disclosure are now enabled to those skilled in the art , which variations yet reside within the scope of the present teaching . accordingly , the disclosure is to be broadly construed and limited only by the scope and spirit of the claims now appended hereto .
a positionally sensitive spinal cord stimulation apparatus and method using near - infrared reflectometry are provided for automatic adjustments of spinal cord stimulation . the system comprises an electrode assembly with an integrated optical fiber sensor for sensing spinal cord position . the integrated optical fiber sensor , comprising a pair of optical elements for emitting light from an ir emitter and for collecting reflected light into a photodetector , determines a set of measured photocurrents . as the spinal cord changes position , the angles of incidence for light from the ir emitter and the measured optical intensities change . electrode pulse characteristics are adjusted in real time , based on the set of measured optical intensities , to minimize changes in stimulation perceived by the patient during motion . the system includes automatic calibration of the optical fiber sensor when the patient is at rest , and a patient orientation detection .