Posts tagged with imaging

0 comments

GIMP 2.8

GIMP is an open source image editing program. You can use it for a lot of the same things Adobe Photoshop is used for.

They just released version 2.8 (release notes).

In addition to GIMP, be sure to keep up with Inkscape, an open source vector graphics/illustration program. You might be able to do without Adobe Illustrator better than you think.

You can even typeset math equations using TeX. (link)

Both GIMP and Inkscape are available for Windows, Mac OSX, and Linux.

Light field imaging is a very interesting approach to imaging. The idea is to use an array of microlenses in order to capture light coming from many different angles. By storing this data, it is possible to bring different focal planes into focus in post-processing offline. It has been implemented for wide-field microscopy.

The Stanford Computer Graphics Laboratory has released some Mac OSX software for trying this yourself. Their website includes information on how to build the imaging rig out of Thorlabs parts. It’s open source (GNU).

It’s not new technology. In it’s current form it dates back to at least the 1990′s. However, just recently (started shipping in February) it has been commercialized into a consumer camera by Lytro, a company started by an alumnus of the Stanford group.

Below is an example of output from the Lytro camera. Single click on a part of the image to bring it into sharp focus.

Labrigger is currently waiting for their Lytro camera to arrive.

To recap the previous post on axial resolution and numerical aperture in two-photon microscopy:

For excitation deep in scattering tissue, higher NA can actually be detrimental because the light cone at the periphery has to travel a longer distance through the scattering tissue compared to moderate NAs. In addition, spherical aberration is more of a problem at higher NAs.

To increase axial resolution, first ensure that you’re overfilling the back aperture of the objective before trying a higher NA objective. A 0.8 NA objective’s axial resolution is only about 50% broader than a 1.0 NA objective. By contrast, underfilling the back aperture significantly makes the axial resolution broader by 200% or more. So before buying a higher NA objective, ensure that you’re actually using all of the NA in your current objective.

For collection, high NA is good, but so is low magnification. For example, a 16x 0.8NA will collect more scattered fluorescence signal than a 63x 1.0NA. A rough image brightness factor can be computed to compare among objectives: average transmittance of visible light * (NA^2/mag)^2

The figure at the top of this post summarizes the brightness factor for a range of different NAs and magnifications*. Several objectives are noted on it as well. At the bottom is the relationship between NA and axial resolution (theoretical best, ref).

Optimal: So what has been recommended for years is to use a high NA objective and underfill it a bit.

In two-photon population calcium imaging, the neuropil response can contaminate neuron responses. This happens when the axial resolution is poor, such that the excitation volume extends out of the soma. This often occurs when the back aperture of the objective is underfilled, resulting in a lower effective NA.

Here’s the relationship between numerical aperture and neuropil contamination.

The influence of neuropil contamination is partially dependent on the signal-to-noise (S:N) of the somatic spike-associated calcium transients. If S:N is high, then a small amount of neuropil contamination can be negligible.

More info:
Part I of axial resolution and numerical aperture
High NA, low mag objectives

* I’ve omitted the transmission characteristic in these calculations. Although IR transmittance varies considerably among manufacturers, in the visible range transmission is consistently around 85% for water dipping, low mag, high NA objectives. Thus the relative measures are unaltered.

Recently, microscope manufacturers have been releasing ever higher NA objectives for multiphoton imaging. Although higher NA objectives should give better axial resolution, they might not be ideal for imaging deep into the brain compared to more moderate NAs.

I think the perception that higher NAs always improve images arises when people try out new, high NA objectives that have smaller back apertures than their old objectives (e.g., an Olympus 20x/0.95 NA or a Nikon 16x/0.8 NA). If the back aperature on the 25x, 1.0+ NA objective they’re trying is smaller, then suddenly they’re overfilling more than before and their axial resolution and S:N are improved. They chalk it up to the NA and swear never to go back to 0.8 NA objectives. However, their old objective might actually be better, and what they really need to work on is their scanning optics.

The key issue is this: high NA objectives bring a large portion of their light in at a high angle. This high angle results in longer paths for the excitation light to take, and this results in more scattering events. The end result is that excitation intensity decreases. This has been shown theoretically and empirically. So if you’ll be imaging deep, consider moderate NA objectives.

By contrast, underfilling the back aperture is a great way to destroy one’s axial resolution. Since the lateral resolution is relatively unaffected, this problem often goes unnoticed (see figure below, its link, and this review). If the excitation beam is less than half of the diameter of the back aperture of a 20x/0.95 NA, then the axial FWHM could be 3x what it should be, or roughly the equivilant of a 0.60 NA objective (theoretical FWHM 5.6 microns), or worse.

Even many commercially available scopes fail to overfill the large back apertures of today’s low magnification/high NA objectives. The major microscope manufacturers need their objectives to fit onto their existing microscope bodies and systems, and this is a major engineering constraint in their design for new imaging systems.

Thanks go to commenter ybot for this one. They pointed out this handy iPhone-to-Microscope mount iPhone case.

From the pictures, it looks like the prototype was printed on a Makerbot, which isn’t terribly high resolution as 3D printing goes. Hopefully the files can be printed as-is by Quickparts, Shapeworks, or Ponoko and still fit correctly. I double check the measurements, particularly for the eye pieces, before I sent this out. Regardless, this is a great idea.

By the way, there’s also this similar device. It’s not as elegant as the above iphone case, but it a bit more flexible and should work with an array of different eye piece sizes.

Perhaps the best-looking one right now is the SkyLight, which was funded via Kickstarter in January. It looks thoughtfully engineered, and can accomodate and array of eye piece sizes and many different smartphones.

Roger Tsien’s lab recently published the new generation voltage sensitive dye they were presenting at SfN: VoltageFluors. As often when then Tsien Lab takes on a new field, they start by taking a completely new approach. Instead of designing an indicator based on the previously used voltage detection mechanisms – Stark shift for electrochromic dyes or FRET for hybrid voltage sensors – they use a mechanism found in most commonly used calcium indicator dyes, such as Fluo-4 and OGB-1: photo-induced electron transfer (PET).

In PET an excited fluorophore (e.g. Fluorescein in Calcium Green) is quenched by transfer of an electron from a donor group (e.g. BAPTA in Calcium Green). In calcium indicators, this quenching is only possible if the “ionophore” (BAPTA) has not bound a calcium ion. Binding of calcium shifts the electronic energy levels, making PET unfavorable, ultimately leading to increase in fluorescence. In place of BAPTA, VoltageFluors use an electron rich group connected to the fluorophore via a “molecular wire”. Once the fluorophore is excited, an electron is transfered via the “wire” to the fluorophore, quenching the fluorescence. But (and this is the important part), the electron can only be transfered along a correctly oriented voltage gradient: if the electron donor is in a more negative environment than the fluoropore, electrons can “flow” along the “wire”, quenching via PET occurs, the fluorophore emits dimly. If the voltage gradient is inverted, PET becomes unfavorable leading to an unquenching of the fluorophore, the dye emits brightly.

The advantage of using PET is that the signal to noise ratio is much higher than for both electrochromic dyes and hybrid sensors. Also in VoltageFluors capacitive loading (a big problem with hybrid sensors) doesn’t occur. A further advantage is that VoltageFluors don’t appear to be (photo)toxic, a big problem that has made the use of voltage sensitive dyes difficult in many situations.

No doubt, VoltageFluors are a first generation indicator with lots of room for improvement — this is of course both a strength and a weakness. I for one can’t wait for them to become commercially available.

Post by Christian Wilms. Second figure is also by CW.

Intrinsic signal optical imaging is a functional imaging modality where the reflectance of red light indicates active portions of cortex. It is used for many applications, including imaging individual barrels in rodent somatosensory cortex, maps in visual cortex, and the tonotopic organization in auditory cortex.

Here is a prior Labrigger post with tips for intrinsic signal optical imaging. One of the key things is to use a high quality scientific camera.

Recently, a friend pointed out that newer digital SLRs have absolutely fantastic specs and could maybe be substituted for a scientific camera. The advantages would be that digital SLRs can be cheaper (especially second-hand) and can be used with off-the-shelf software.

So why not use a newer digital SLR instead of a scientific camera?

Short answer: For paradigms that rely on a lot of averaging, it could probably work. But for Fourier analysis-based paradigms, it probably won’t work.

Long answer: Here are the key issues to overcome:

1. Can the camera see the light?

700nm light is often used for intrinsic imaging. This report says that there is massive roll off around 700nm. The Bayer filter may contribute to this, but often there is a separate IR filter. Astrophotographers remove these filters to get results like this:

There are tutorials all over the web. For example, this is the source for the above image and it’s a good place to start. Also, plenty of people use wavelengths below 700nm for intrinsic imaging, so this is not a limiting factor for everyone.

2. Getting the raw data

Digital SLRs do all kinds of tricks to make the photos look nice. All of which will screw up your data. Fortunately, many cameras offer the option of reading the raw data off of the camera, in a format helpfully called RAW.

Special considerations for Fourier analysis

The amplitude of intrinsic signals are typically about 1 part in 10,000. Since most cameras, even the latest scientific cameras, top out around 12 bits (i.e., values range from 0 to 4095), it’s almost impossible to detect the signal without some amount of averaging.

There are two main paradigms for intrinsic imaging:
1. Averaging like hell in the temporal domain. This is what most people do. Just average a whole bunch of frames at rest, and then a whole bunch of frames during stimulation. Subtract the two images. Declare victory.
2. Averaging like hell in the frequency domain. This is a trick from fMRI. Kalatsky & Stryker implemented it for intrinsic signal optical imaging. It’s harder, but is typically much faster and can yield much more information.

For paradigm 1, any decent camera will work. But paradigm 2 has some special requirements:
1. Digital SLRs still typically have rolling shutters rather than global shutters. This means that the top of an image is captured over a different time than the bottom of an image. This can distort the phase of signals, which is important for this paradigm.

2. Image quality. Let’s start with pixel size.
The Nikon D3 and D4 sensors are about 3x the size and pixel count of a Dalsa 1M30, the classic choice for Fourier analysis intrinsic imaging. The Nikon FX chip’s pixels are smaller than those of the 1M30.. it’s also a CMOS chip rather than a CCD. (Though that distinction means less these days.)
pixel size:
8.45 x 8.45 µm (Nikon)
12 x 12 µm (Dalsa)

Now let’s talk about dynamic range:
I’m guessing the 66dB dynamic range of the Dalsa 1M30 is still better than most digital SLRs.
For example, the Sony Alpha 900 and Canon EOS 5D both top out at less than 40dB. (ref 1, ref 2) Consumers typically don’t need to pick a 1/10,000 signal out of their images.

3. Output
Can you commonly get 30fps of uncompressed, RAW data at 1 megapixel resolution out of consumer dSLRs? I have the impression that you can get RAW stills, but video is still typically compressed. “Unfortunately there are no HDSLR cameras on the market that will give you a clean (non-overlay), uncompressed 1080p HDMI output.”

If you decide to go the scientific camera route, sCMOS and CCD are solid choices. If you are operating in a light-limited regime (e.g., flavoprotein fluorescence imaging), EMCCDs are the way to go.

The main factor that limits how deep we can image into tissue is the scattering of light. Multiphoton imaging partially mitigates the problem by using infrared light, which scatter less, and by using an excitation process that drops off nonlinearly with intensity. However, it only partially mitigates the problem. Light scattering is still the main factor limiting how deep we can image.

If scattering is such a problem, why not address it directly? Scattering is due to mismatches in the index of refraction at the borders of structures. In biology, this is typically between lipid membranes and aqueous intracellular and extracellular fluids. If the aqueous solution is replaced by something with the same index of refraction as the lipid membranes (or the lipid membranes are replaced), then there should be less scattering and we should be able to image much deeper.

Well, this idea has been around for quite some time. Dating back to the 1950s.

Recently, there has been somewhat of a rediscovery of the technique. Starting with a paper from Dodt in 2007, a paper from Miyawaki’s lab in 2011 (the Scale paper), and then another paper from Dodt this year. There has been some criticism that the earlier work didn’t get cited much by the recent papers.

Importantly, microscope manufacturers have started releasing objectives specifically for cleared tissue. These objectives offer a unique combination of low magnification, high numeric aperature, very long working distances, and are designed for the refractive index of the clearing agents. (e.g., Olympus, Zeiss)

In two previous posts I shared some MATLAB code to help design collection optics in 2p scopes.
Collection optics for 2p scopes, post 1
Collection optics for 2p scopes, post 2
It was just brought to my attention that I didn’t include the command locateVal in the code I posted. It’s a very simple little shortcut I use. Here it is:

function [pos difference] = locateVal(val,data)
[difference pos] = min(abs(data - val));


Yes, you could have guessed that. But I wanted to correct the oversight.

ScanImage is an excellent software package for controlling 2p scopes. It’s free and open source. It’s been actively developed and released to the public since its inception. RIght now they personnel involved are trying to renew their funding. To help keep this resource actively developed and free, please fill out their survey. It’s very, very short. Don’t take the resource for granted. It takes a lot of salaried time to keep the development going and adding in new features.

By the way, ScanImage 3.8 (new features) and 4.0 (for ThorLabs scopes) are out now (3.5 and 3.6 are no longer supported; 3.7.1 is the current stable release) (link). If you haven’t already tried a new version of ScanImage out, you should. It doesn’t take too long and the feedback is very helpful. Don’t assume that everyone else is already sending in the same feedback.