Difference between revisions of "Initial Testing of Assembled Miniscopes"

From UCLA Miniscope
Jump to: navigation, search
(Testing the Stability of the DAQ Software)
(Testing the Stability of the DAQ Software)
 
(19 intermediate revisions by 6 users not shown)
Line 17: Line 17:
 
*#If the video stream is still present (not Red Screen of Doom) your system should not have any driver or OS issues.
 
*#If the video stream is still present (not Red Screen of Doom) your system should not have any driver or OS issues.
 
*'''Streaming video frame rate:''' The default frame rate of your Miniscope system is 30FPS but can be adjusted using the drop down 'Frame Rate' box in our DAQ software (labeled with a red '1' in the picture to the right).  
 
*'''Streaming video frame rate:''' The default frame rate of your Miniscope system is 30FPS but can be adjusted using the drop down 'Frame Rate' box in our DAQ software (labeled with a red '1' in the picture to the right).  
*#Connect a cope to the DAQ Box and then the DAQ Box to the computer.
+
*#Connect a scope to the DAQ Box and then the DAQ Box to the computer.
 
*#Open up the DAQ software and connect to the Miniscope.
 
*#Open up the DAQ software and connect to the Miniscope.
*#Observe  
+
*#Observe the current frame rate (labeled with a red '2' in the picture to the right). It should be stable within 1 FPS from the expected value. This is just an approximate measure of the frame rate, the frame rate of the recorded video should be extremely stable.
*'''Write speed of video data:'''
+
*#You can also connect to a behavioral camera to add strain on your system. Generally the behavioral camera will have larger fluctuations in the displayed frame rate.
 +
*'''Write speed of video data:''' You want to make sure your computer is able to write the uncompressed video data to your HDD or SSD as quick (and hopefully much quicker than) as the rate at which you are acquiring it. Slow or encryted hard drives can be a source of problems here.
 +
*#Connect a scope to the DAQ Box and then the DAQ Box to the computer.
 +
*#Open up the DAQ software and connect to the Miniscope.
 +
*#Click 'record' and observe the 'Write Speed (fps)' (labled with a red '3' in the picture to the right). This box displays the current write speed of your data. The number displayed will fluctuate but should stay above the acquisition frame rate of your Miniscope. If the write speed falls below the acquisition frame rate, video frames will be written into a circular buffer which is 256 frames long. If the write speed stays low for too long the software will begin to overwrite frames in the circular buffer. The 'timestamps.dat' file created during recording keeps track of the buffer size and is an addition place you can look when evaluating the write speed of your computer.
 +
<br clear=all>
  
 
== Imaging Your Surroundings ==
 
== Imaging Your Surroundings ==
 +
[[File:ImagingWithoutGRINLens.png|right|500px]]
 +
An assembled scope can image your surrounds when a GRIN lens is '''not placed''' into the hole in the base of the scope. Connect the scope to your computer and then point the base of the scope toward objects that are illuminated with room or sun light.
 +
*The scope has a green bandpass filter sitting before the CMOS imaging sensor. This means you will only be collecting light between 500nm and 550nm.
 +
*Most objects in the environment will not fluoresce under the blue excitation LED. This means most object will not show up unless being illuminated by a light source that contains green wavelengths such as room light or sunlight.
 +
*Adjust the focus slider to adjust the focal plane of your Miniscope. Most object will appear to be "infinitely" far away from the CMOS imaging sensor. Your focus slider will need to be placed close to its highest point in order to focus on these objects. This focusing slider position is equivalent to imaging at the bottom surface of your GRIN lens if a GRIN lens was mounted into the base of the scope.
 +
 +
<br clear=all>
 +
 
== Checking for Light Leakage ==
 
== Checking for Light Leakage ==
 +
[[File:LightLeakage.png|right|500px]]
 +
When assembled correctly, no excitation light from the LED should leak onto the CMOS imaging sensor in your scope. The following steps will walk you through testing a scope for such light leakage. If you do find that your scope leaks light the most common sources of the leak are the excitation or emission filter being scratched, placed in the wrong orientation, or significantly misaligned.
 +
#Connect a scope to the DAQ Box and then the DAQ Box to the computer.
 +
#Open up the DAQ software and connect to the Miniscope.
 +
#Place the opening in the base of the scope (you can do this with or without a GRIN lens) against a black surface that won't fluoresce. You may be surprised at what materials weakly fluoresce green when blasted with blue excitation light.
 +
#Turn the exposure and gain of the scope to their maximum values.
 +
#Slowly turn up the excitation LED power from 0% to max power. Depending on your scope and DAQ software version the LED will likely max out at around 40%.
 +
#As you increase the LED power watch the video stream for large increases in pixel brightness across large regions of your image. A small overall increase in pixel value of ~20 (the pixel values range from 0 to 255) is expected. You may also notice at max gain that some pixels become noisy. This is also normal but care should be taken in experiments to minimize this noise by limiting the gain or by correct these noisy pixels during offline processing of your data.
 +
 +
<br clear=all>
  
 
== Imaging Calibration Slides ==
 
== Imaging Calibration Slides ==
 
+
[[File:ImagingTestSlide.png|right|500px]]
 
[[File:MiniscopeCalibrationSlide.png|thumb|right|500px|Image of a calibration slide with 9.8μm line spacing (superimposed red boxes are 10px x 10px)]]
 
[[File:MiniscopeCalibrationSlide.png|thumb|right|500px|Image of a calibration slide with 9.8μm line spacing (superimposed red boxes are 10px x 10px)]]
  
[http://www.thorlabs.us/navigation.cfm?guide_id=2332 Test Slides]
+
This is probably the most important initial test you can do with your Miniscope system. Not only can it uncover issues in your system but will also give you a good sense of how the optics, imaging, and focusing slider work. The figure to the right shows a modified test/calibration slide (left), optional GRIN lens holder (middle), and example configuration for imaging a test slide (right).
 +
*The modified test/calibration slide is a [http://www.thorlabs.us/navigation.cfm?guide_id=2332 resolution test slide] with [http://www.amazon.com/JVCC-Stage-Set-Spike-Tape-Fluorescent/dp/B000QDVNH0/ref=sr_1_12?s=industrial&srs=2529683011&ie=UTF8&qid=1461180753&sr=1-12 green fluorescing tape] attached to the underside of the glass. It is important that the printed surface of the test slide be the side that is closest to the GRIN lens. Different thicknesses of cover glass can be used between the test slide and GRIN lens to get a feeling for imaging at different depths.
 +
*The middle picture shows a simple GRIN lens holder we had made. This holder is a block of Delrin plastic with different diameter holes drilled into it. a GRIN lens can be placed into the holder and then set on top of the modified test slide. A Miniscope can then be set onto of the holder to image the slide. The holder does a nice job keeping the surface of the GRIN lens co-planer to the surface of the test slide.
 +
*The right picture should an example configuration to image a test slide. This picture is of a scope that has been modified, [Imaging With Thin GRIN Lenses], to hold a GRIN lens in its base. While the picture shows the scope being held by hand, one could easily mount the scope in a clamp for more stable imaging. If using a GRIN lens holder as described above, a similar configuration would be used except the GRIN lens and holder would be in place of the bare GRIN lens.
  
[http://www.amazon.com/JVCC-Stage-Set-Spike-Tape-Fluorescent/dp/B000QDVNH0/ref=sr_1_12?s=industrial&srs=2529683011&ie=UTF8&qid=1461180753&sr=1-12 Green Fluorescing Tape]
+
The image on the bottom right is of a calibration slide with 9.8μm line spacing (superimposed red boxes are 10px x 10px).
 
<br clear=all>
 
<br clear=all>
  
Line 37: Line 63:
 
{{#ev:youtube|https://youtu.be/lxEUkP-YI8g|640|right}}
 
{{#ev:youtube|https://youtu.be/lxEUkP-YI8g|640|right}}
 
Similar to imaging test slides, you can use your Miniscope to image brain slice slides expressing GFP or slides with other fluorescent sources. A few key points for imaging slides are listed below:
 
Similar to imaging test slides, you can use your Miniscope to image brain slice slides expressing GFP or slides with other fluorescent sources. A few key points for imaging slides are listed below:
*Your scope has a green bandpass filter (500nm to 550nm) in front the the CMOS imaging sensor. This means only will only be able to see green fluorescence.
+
*Your scope has a green bandpass filter (500nm to 550nm) in front the the CMOS imaging sensor. This means you will only be able to see green fluorescence.
 
*Take note of the thickness of your cover slip, usually around 170um thick. You will be imaging through the cover slip to reach the fluorescing sample. If you are using less than a 15mm focal length achromatic lens, you will likely not be able to focus past the bottom of the cover slip. Even a 15mm focal length achromatic lens will generally just reach about 50um below the bottom of the cover slip with the focusing slider pushed to its lowest position.  
 
*Take note of the thickness of your cover slip, usually around 170um thick. You will be imaging through the cover slip to reach the fluorescing sample. If you are using less than a 15mm focal length achromatic lens, you will likely not be able to focus past the bottom of the cover slip. Even a 15mm focal length achromatic lens will generally just reach about 50um below the bottom of the cover slip with the focusing slider pushed to its lowest position.  
  
The video to the left is of a TetTag GFP slide being imaged with a 15mm focal length achromatic lens and 0.25 pitch GRIN lens. A few notes:
+
The video to the right is of a TetTag GFP slide being imaged with a 15mm focal length achromatic lens and 0.25 pitch GRIN lens. A few notes:
*Their are some compression artifacts present due to YouTube's compression of the video.  
+
*There are some compression artifacts present due to YouTube's compression of the video.  
 
*The disk of light near the center of the field of view is due to reflection of the fluorescent light between the cover slip and bottom of GRIN lens... you should not see this disk when imaging in vivo.  
 
*The disk of light near the center of the field of view is due to reflection of the fluorescent light between the cover slip and bottom of GRIN lens... you should not see this disk when imaging in vivo.  
 
*The left and right portions of the field of view are dimmer than what you should expect to see with your own system. The outer dimness was greatly reduced in the newer versions of the Miniscope main body.
 
*The left and right portions of the field of view are dimmer than what you should expect to see with your own system. The outer dimness was greatly reduced in the newer versions of the Miniscope main body.

Latest revision as of 15:43, 11 October 2017

This page is a work in progress.

Once your Miniscope system is up and running, it is important to be able to test, and debug, all aspects of the system before moving to imaging in vivo. The sections below will discuss the procedures we use to validate Miniscopes we build before using them in experiments. As you become more comfortable with using Miniscopes some of the sections below can be skipped.

Testing the Coaxial Cable Connection

In our experience, the connection of the coax cable, either to the CMOS Imaging Sensor PCB or SMA connector, is by far the most common point of failure when building a Miniscope System. Take care when soldering these connections not to short the inner conductor to the outer shield. It helps to cover the solder joint as well as ~1cm of coax cable extending from the solder join in a semi-flexible epoxy, silicone, or glue (hot glue works well) to take the strain of cable movement off of the solder joint.

Once assembled, connect the Miniscope system to your computer and run the DAQ software. With the video streaming from the scope, move/twist/wiggle the coax cable with greater intensity that what you would expect an animal to apply, especially at the ends of the cable. If soldered correctly, the video stream should not drop out even with excessive movement and twisting of the cable.

Testing the Stability of the DAQ Software

SoftwareTests.png

When running your Miniscope system on a new computer it is important to check the following

  • Stability of video stream: We have found some combinations of USB drivers, computer hardware, and Window's OS can lead to the video stream failing a few minutes after the software has connected to the scope. This seems to mainly be an issue with Windows 8 and is independent of if you are recording the video to disk. To test the stability of your system,
    1. Connect a scope to the DAQ Box and then the DAQ Box to the computer.
    2. Open up the DAQ software and connect to the Miniscope.
    3. Leave the system running for 5 minutes. Do not click the 'record' button.
    4. If the video stream is still present (not Red Screen of Doom) your system should not have any driver or OS issues.
  • Streaming video frame rate: The default frame rate of your Miniscope system is 30FPS but can be adjusted using the drop down 'Frame Rate' box in our DAQ software (labeled with a red '1' in the picture to the right).
    1. Connect a scope to the DAQ Box and then the DAQ Box to the computer.
    2. Open up the DAQ software and connect to the Miniscope.
    3. Observe the current frame rate (labeled with a red '2' in the picture to the right). It should be stable within 1 FPS from the expected value. This is just an approximate measure of the frame rate, the frame rate of the recorded video should be extremely stable.
    4. You can also connect to a behavioral camera to add strain on your system. Generally the behavioral camera will have larger fluctuations in the displayed frame rate.
  • Write speed of video data: You want to make sure your computer is able to write the uncompressed video data to your HDD or SSD as quick (and hopefully much quicker than) as the rate at which you are acquiring it. Slow or encryted hard drives can be a source of problems here.
    1. Connect a scope to the DAQ Box and then the DAQ Box to the computer.
    2. Open up the DAQ software and connect to the Miniscope.
    3. Click 'record' and observe the 'Write Speed (fps)' (labled with a red '3' in the picture to the right). This box displays the current write speed of your data. The number displayed will fluctuate but should stay above the acquisition frame rate of your Miniscope. If the write speed falls below the acquisition frame rate, video frames will be written into a circular buffer which is 256 frames long. If the write speed stays low for too long the software will begin to overwrite frames in the circular buffer. The 'timestamps.dat' file created during recording keeps track of the buffer size and is an addition place you can look when evaluating the write speed of your computer.


Imaging Your Surroundings

An assembled scope can image your surrounds when a GRIN lens is not placed into the hole in the base of the scope. Connect the scope to your computer and then point the base of the scope toward objects that are illuminated with room or sun light.

  • The scope has a green bandpass filter sitting before the CMOS imaging sensor. This means you will only be collecting light between 500nm and 550nm.
  • Most objects in the environment will not fluoresce under the blue excitation LED. This means most object will not show up unless being illuminated by a light source that contains green wavelengths such as room light or sunlight.
  • Adjust the focus slider to adjust the focal plane of your Miniscope. Most object will appear to be "infinitely" far away from the CMOS imaging sensor. Your focus slider will need to be placed close to its highest point in order to focus on these objects. This focusing slider position is equivalent to imaging at the bottom surface of your GRIN lens if a GRIN lens was mounted into the base of the scope.


Checking for Light Leakage

When assembled correctly, no excitation light from the LED should leak onto the CMOS imaging sensor in your scope. The following steps will walk you through testing a scope for such light leakage. If you do find that your scope leaks light the most common sources of the leak are the excitation or emission filter being scratched, placed in the wrong orientation, or significantly misaligned.

  1. Connect a scope to the DAQ Box and then the DAQ Box to the computer.
  2. Open up the DAQ software and connect to the Miniscope.
  3. Place the opening in the base of the scope (you can do this with or without a GRIN lens) against a black surface that won't fluoresce. You may be surprised at what materials weakly fluoresce green when blasted with blue excitation light.
  4. Turn the exposure and gain of the scope to their maximum values.
  5. Slowly turn up the excitation LED power from 0% to max power. Depending on your scope and DAQ software version the LED will likely max out at around 40%.
  6. As you increase the LED power watch the video stream for large increases in pixel brightness across large regions of your image. A small overall increase in pixel value of ~20 (the pixel values range from 0 to 255) is expected. You may also notice at max gain that some pixels become noisy. This is also normal but care should be taken in experiments to minimize this noise by limiting the gain or by correct these noisy pixels during offline processing of your data.


Imaging Calibration Slides

ImagingTestSlide.png
Image of a calibration slide with 9.8μm line spacing (superimposed red boxes are 10px x 10px)

This is probably the most important initial test you can do with your Miniscope system. Not only can it uncover issues in your system but will also give you a good sense of how the optics, imaging, and focusing slider work. The figure to the right shows a modified test/calibration slide (left), optional GRIN lens holder (middle), and example configuration for imaging a test slide (right).

  • The modified test/calibration slide is a resolution test slide with green fluorescing tape attached to the underside of the glass. It is important that the printed surface of the test slide be the side that is closest to the GRIN lens. Different thicknesses of cover glass can be used between the test slide and GRIN lens to get a feeling for imaging at different depths.
  • The middle picture shows a simple GRIN lens holder we had made. This holder is a block of Delrin plastic with different diameter holes drilled into it. a GRIN lens can be placed into the holder and then set on top of the modified test slide. A Miniscope can then be set onto of the holder to image the slide. The holder does a nice job keeping the surface of the GRIN lens co-planer to the surface of the test slide.
  • The right picture should an example configuration to image a test slide. This picture is of a scope that has been modified, [Imaging With Thin GRIN Lenses], to hold a GRIN lens in its base. While the picture shows the scope being held by hand, one could easily mount the scope in a clamp for more stable imaging. If using a GRIN lens holder as described above, a similar configuration would be used except the GRIN lens and holder would be in place of the bare GRIN lens.

The image on the bottom right is of a calibration slide with 9.8μm line spacing (superimposed red boxes are 10px x 10px).

Imaging GFP Slides

Similar to imaging test slides, you can use your Miniscope to image brain slice slides expressing GFP or slides with other fluorescent sources. A few key points for imaging slides are listed below:

  • Your scope has a green bandpass filter (500nm to 550nm) in front the the CMOS imaging sensor. This means you will only be able to see green fluorescence.
  • Take note of the thickness of your cover slip, usually around 170um thick. You will be imaging through the cover slip to reach the fluorescing sample. If you are using less than a 15mm focal length achromatic lens, you will likely not be able to focus past the bottom of the cover slip. Even a 15mm focal length achromatic lens will generally just reach about 50um below the bottom of the cover slip with the focusing slider pushed to its lowest position.

The video to the right is of a TetTag GFP slide being imaged with a 15mm focal length achromatic lens and 0.25 pitch GRIN lens. A few notes:

  • There are some compression artifacts present due to YouTube's compression of the video.
  • The disk of light near the center of the field of view is due to reflection of the fluorescent light between the cover slip and bottom of GRIN lens... you should not see this disk when imaging in vivo.
  • The left and right portions of the field of view are dimmer than what you should expect to see with your own system. The outer dimness was greatly reduced in the newer versions of the Miniscope main body.