Category: programming

  • Starlyte Nebula Driver FAQ

    TL:DR

    Live Debugging

    Get a Full list of Supported Drivers

    Testing a Specific Driver File

    Testing Host and Sub Devices

    Live Debugging

    Due to the open nature of our driver system, it’s relatively straightforward to write a new driver file for almost any imaginable device in Nebula. However, driver development can be a pain, so I though I’d share some debugging tricks.

    For all commands, we will navigate to the command line using windows Command prompt or powershell. Here I show command prompt syntax. Nebula is commonly installed under program files. So in the windows start bar type “cmd” and press enter. This should open the command prompt. The commands below navigate to the install location.

    cd\
    
    c:\>cd "Program Files"
    
    c:\Program Files>cd Nebula
    
    c:\Program Files\Nebula>

    First, is the use of logging to the command line. When Nebula is launched from the command line, a series of optional switches can be used to report logged output. By opening this alongside the app, it’s very fast to figure out what or where something is going wrong. To see log output, use –printlog.

    c:\Program Files\Nebula>Nebula.exe --printlog

    This launches the app, but shows a live log output on the console at the same time.

    Get a full list of Supported Drivers

    This command will return a complete list of drivers found in the Nebula supported list. To print this list, use:

    c:\Program Files\Nebula>Nebula.exe --listdrivers

    Here is live example of that command and the expected result. A list of drivers is shown, press enter to close the listing.

    Testing a specific Driver File

    Next, let’s load up one of these drivers in the test utility. Now, this is where things get cool! The test utility can load a host device driver, inspect it’s shown devices, attempt to connect them, and even test every sub-device!

    So, let’s assume we have a new camera driver we want to work on. The camera should do things like snap an image, show various properties etc. In my example I use a real UVC (web) camera, and inspect the driver. The driver actually pulls the real camera info and even snaps a test image. The goal of this function is twofold, first to validate a given driver, and second to validate the device itself.

    For this command we will use –testdriver *drivername* and optionally –port *portname*, for example, COM5

    c:\Program Files\Nebula>Nebula.exe --testdriver --driver UVC_Camera

    Here we can watch the expected output in real time. Note a new window is spawned to show us the results for these tests.

    Testing Host and Sub Devices

    Let’s say we have a controller, for example, an ASI or Marzhauser box, which has a Z motor attached. In Nebula, the controller can be thought of as the Host (the resident controlling brain), and the device can be considered an appendage attached to the host. So all drivers must have a Host, but a Host may only have one device. In this example, we use a demo Focus device. First the host is loaded and analyzed, and then, you ca select to test any device provided by that host. I choose option # 1 (focus) and the test runs, even showing my driver has a small error I missed!

    Obviously, if you have a driver which isn’t behaving, please contact us – yet I hope these options provide a first-line of interface for power users, so simple things can be corrected and analyzed quickly!

    -Austin

  • Starlyte Nebula Adds Drag+Drop Merge Captures

    Tool simplifies manual capture

    We had a recent customer asking to solve a rather standard but annoying problem. If I have a manual filter turret, and still want to overlay images, how easy is it to do?

    To solve this, we added the ability to drag+drop any image from our capture sidebar into our main view. By adding a demo filter turret to the system config, we captured the real ex, di and em filter settings from the image, insuring metadata is transferred with the images collected. The resulting view is a true multi-dim architecture, saved as an OME set or RGB combined view. Our team made the addition, ran bug testing and edge case validation, pushed the changes and compiled the application in 1 business day.

    Being able to react to our customers’ needs in a short timeframe is one of the best parts of working with my team. Nice work!

    -Austin

  • Mac OSX Serial Terminal for ARC

    I’ve long wanted to build a terminal and testing application for my products. Using the exceptional QT Creator, I was able to cook one up in a relatively short period of time!
    This application was built using the QT Terminal example program, so it will work for the ARC Triggerscope 2, 16, and Triggerscope 3 products, as well as the ARCLED.
    In addition, anyone using an Arduino or other serial-based device may find it useful. You can find the program on my Github.

    I am aware that the vast majority of end users rely on Windows for control of devices, so if you read this and have an interest in a compiled x64 version, I’d be interested to know.
    Over time I plan on expanding this application to include full configuration over delay timing, sequencing, and other functions.

    Quick Demo of the program

  • LED, laser, or other PWM control using Triggerscope

    It appears that more and more people want to use PWM control for illumination devices from Micro-Manager and other imaging software. PWM may be used for any number of applications, from high speed pulsing of an LED, or a laser, in order to reduce phototoxicity or just to control brightness, or to drive a DC motor at a varying speed, or to drive a device like a spinning disk to set the PRM. I figured I’d address this using the Triggerscope system controllers. rIn order to support PWM drive over an external device, I wanted a few useful functions to work in MM:

    • PWM duty cycle should be controlled form presets
    • PWM should be called to “off” from a TTL or other “shutter” style command
    • Once off, a similar “ttl on” type command should re-enable PWM at the alst used duty cycle
    • multiple output lines should be supported at different duty cycles.

    Version 407 of the Triggerscope firmware now supports this, and uses the existing driver available for these devices. I’ve made a short demo video showing how this works on an oscilloscope output. I’ll place an option for this on the store. Please get in touch with any questions or post here – thanks!

  • Computational imaging continues to grow in microscopy

    The Waller Lab recently had a demo announcement of their awesome implementation of computational imaging. They have some examples on their lytro page, which look really cool! This got me thinking about the last 10 years or so, and how the combination of image capture with control over input and output image fields, has grown into a new force in microscopy today.

    It’s interesting to consider what techniques fit into the field of computational imaging. Optical microscopy has pushed into an ever smaller domain of resolution, to the point that Abbe’s laws need to be avoided in order to pull resolution out of an image. Consider the initial techniques used for this – phase, DIC, confocal, TIRF, and the like are contrast enhancement techniques of enhancing an image’s contrast, by either increasing the signal intensity, or by reducing the surrounding noise/background intensity.  Beginning with the Apotome, and maybe earlier, with deconvolution, a combination of using multiple image samples with post-capture image processing, to gather more information than can be obtained by a single image, started to emerge.

    Building on these first techniques, we can see further sampling methods in the optical domain, like STORM/PALM, where optical control over emission is coupled with high sampling rates, and back-end processing, to statistically avoid Abbe’s laws. I’d imagine FLIM falls into this category as well, using time and multiple images, again to extract more data than may be obtained by a single sample. Non-microscopy applications for yet another method in this domain, the employment of coded apertures, similar to this work from MIT,  are growing in a number of imaging fields.

    This combination, of computing power + controlled image fields, can be employed to do all sorts of as-yet untouched things with a conventional microscope. I can imagine that very soon, we will see a few of the following products available for use:

    • phase contrast, and fluorescent, multi-capture resolution enhancement systems, all built into an “off the shelf” microscope
    • angular changes to fluorescence excitation, used to improve resolution
    • wavelength-based restriction inside an image field, to eliminate the potential for crosstalk in emission
    • multiple excitation power sampling, to pull greater dynamic range from images
    • multiple cameras used with restricting apertures, used to pull focus information, or multiple focal fields, from a single position in a sample

    These are only a few ideas where this can go, but the general path I can see in the future is lower cost components, which are leveraged to do better and better work, which gives more imaging power to a greater number of researchers. At least – that’s a future I’d like to see 🙂

    -Austin

     

     

     

  • Shutter Configuration of TTL devices in Micromanager

    I made this video to show how to use both a state device shutter object and a group shutter object in micro-manager. Hopefully others can make use of it!

     

  • Build a Stratux in 10 minutes! (ADS-B)

    As the 2020 FAA mandate for ADS-B comes upon us, more aircraft are using the ADS-B system. Additionally, weather transmission via towers is a major free source of in-flight weather info. Having recently picked up a new iPad, and subscribing to FireFlight, I decided it was time to add the ability to see ADS-B traffic, and snag weather.

    Having done a bit of homework, I knew there were some open source solutions available, so of course that’s the way I was going to go. Heck I even considered repurposing one of my other rPi’s for the job, but meh, better to dedicate a box for it!

    With a flight coming up where I wanted the weather, I decided I wanted to get something to use NOW. Amazon same-day-delivery to the rescue! Here’s what I bought:

    All in I was @ $120 for the setup. Consider that the closest commercial product runs 3 or 4x more!

    ready for the build!

    So this must be trouble to set up, right? Anything but! Upon recieving the components, I had the system working in ~ 8minutes! The work required is to:

    • install heat sinks on rPi IC’s
    • install rPi into case
    • insert microSD card
    • insert USB tuner(s)
    • insert power supply USB
    • plug in
    • connect on the iPad.

    Unbelievably simple! This couldn’t be any easier for a “maker” project.  In the pic below you can see the antenna I hung in the window, the case and tuner, and the iPad with the Stratux host page open. I experimented with using both receivers, and each receiver solo, and found that using 2 receivers really improved the # of detected 978Mhz signals. Not sure why, but I’ll take it!

    completed build working

    -Austin

     

     

  • Dynamic Mirror Reflection Angles using Fusion360

    SO I’ve been working with AutoDesk’s Fusion360 for a while now, and have found it to be an exceptional tool for diving into CAD. If you’ve considered CAD before, but have been scared off by the learning curve, I recommend checking it out. One of the important functions of a truly parametric CAD program is the need to reference objects to other objects, and to reference measurements to variables or other object measurements. I knew Fusion360 could handle parametric work, but hadn’t been able to figure out a solution to my particular problem, so, here’s a video on how I did it. Not sure if this is an accepted method conventionally, but it worked for me!

    The problem I had was how to set up a reflection line, which was dependent on 2 inputs, the angle of an input source, and the reflection angle of a mirrored surface. I wanted to be able to drive these 2 input values, and have either of them affect the resulting reflection line. Here’s how it worked out.

    [youtube width=”600″ height=”365″ video_id=”hVRhyYDPGr8″]

    -Austin

  • Optical Design comes to the iPad!

    Over the past 5 years, almost every project I’ve worked on has required some level of optic design. In many cases, simple designs suffice. For example, projecting an LED can be accomplished at a basic level with an aspheric condenser. But when designs require flat fields, especially corrective elements, or apochromatic performance, it’s time to leverage commercial tools like Zemax. Luckily, I have one of the best Zemax gurus on the planet on hand for such work. But there is a middle ground where I want to work on designs I’d call basic+. This is where there has never been a clear solution. In such cases, the best compromise is to buy experimental grade lenses, and test them empirically.

    Obviously this presents 3 problems:

    • shipping time + setup time = a long iterative design process.
    • when issues are found, the only solution is to snag a few more lenses and test, vs.  modeling a solution.
    • The end result is “good enough” , but it’s unknown as to where other improvements may be found.

    So imagine my surprise when I found an app for ray tracing and modeling, in the App store! Too good to be true – has to be a joke, right? Nope – Check out this short example, showing the Nikon 105mm SLR lens.

    [youtube width=”600″ height=”365″ video_id=”KPwETNTQfFI”]

    You can read more about RayLab here – http://www.raymak.com/wp/  or can download it on the app store here.

    The basic app is ~ $2.00. Adding all of the features will run just under $30. Considering that the cheapest alternative runs ~ $1500, this is an amazing deal. Anyway – I hope others find this as useful as I have!

    Oh one more example – here’s the optical design for a Zeiss 40x objective! Cool huh?!?!

    Zeiss_40_Raylab

    -Austin

  • Experimental FM transmitter using Raspberry Pi 2

    If you have an extra Raspberry pi around and want to try something fun, you can use the GPIO on the pi to transmit at FM frequencies. For the rPi v1 you can use this link for instructions. For Raspberry Pi2 I found a great application which can be run from the command line, called PiFmRds . Not only will this broadcast audio from a number of sources, but it will also broadcast text, and can issue the station ID info! Really a neat experiment.

    To use the Raspberry Pi 2 with PiFmRds follow these steps:

    1. Configure an SD card with Raspbian or other linux distro.
    2. Connect an antenna wire of appropriate length (or none for low range!) so as not to violate local laws
    3. For the next work, we’ll use the Terminal.
    4. To play any file format other than wav or ogg, install Sox
       sudo apt-get install sox 
    5. Install the sndfile library using
       sudo apt-get install libsndfile1-dev 
    6. Install pifmrds with the following 4 commands
      git clone https://github.com/ChristopheJacquet/PiFmRds.git
      cd PiFmRds/src
      make clean
      make
    7. Now you are ready to run the program ***when in operation, if you click on anything outside the terminal it will freeze the rpi. I recommend stopping the play service using CNTL+C before attempting to even use the mouse!
    8. for a list of commands on playing a file and setting a frequency, see the pifmrds page.

    Here’s what you should see from PiFmRds, if everything works correctly:

    Example output from
    Example output from PiFmRds

    *Bear in mind that running this in a way so as to provide signal @ 200ft from your location can violate FCC regs! (see this FCC notice ). Obviously, for a number of reasons, I recommend you take extra care to comply with regs.

    Pi2 all hooked up!

    -Austin

  • Acquisition Speed Comparison of MetaMorph, NIS Elements, Micro-Manager

    How fast can a typical imaging system really run? What factors affect this? While most research might not require rapid sequential capture, almost all experiments can benefiet from tight exposure/illumination timing, yet few microscope users are aware of timing delays injected into experiments by the control software they are using. So how much delay is caused by software? I’ve long wanted to look into this, and finally got the chance!

    In order to accomplish this, I programmed a microcontroller to accept commands from the Lumencor Spectra-X. This high power/high speed LED engine is popular for fluorescent excitation, as a result, almost every available software application can control it. I set up my code to measure the time in which a known shutter, or known wavelength command was received on the serial line (well, USB serial).

    The team at Technical instruments were kind enough to loan me the use of their equipment, so a generous thanks to Reese Allen and the entire Technical instrument staff!

    Experimental conditions were as follows:

    • All software packages were installed on a clean OS install of Win7/x64
    • Test machine was a Dell Precision series
    • Tests were performed by configuring the camera to run ~100fps. This was accomplished using a 4×4 binning, and an exposure of 9.8mS.
    • All software applications were set to send at minimum one shutter and one wavelength change per acquisition cycle. (i.e. 1 picture from the camera, + 1 wavelength change + open shutter, then switch wavelength and cycle shutter).
    • All applications were first tested in a “free run” mode, to confirm the camera configuration was capable of 100fps at minimum.
    • No other devices were installed for these tests.

    The results were quite interesting:

    Software
    NIS Elements V4.30
    Micro-Manager V1.4.22
    Metamorph V7.8.12
    Metamorph Streaming
    Average Overhead
    60mS
    71mS
    65mS
    11mS
    Max FPS
    16
    14
    15
    90

     

     

     

    Here are some videos showing each of the programs performing. You can see some timing variation (likely caused by my capture device) but the averages are easy to resolve, and they correlate to the speed seen on the captured image stacks.

    NIS Elements

    Micro-Manager

    MetaMorph

    What becomes quickly apparent is the influence of asynchronous device control using metamorph’s “Stream” function. This is making use of a patented computer-based device sequencing technique. This technique waits for a camera “event flag” (interrupt) to fire, and when it does, a pre-defined set of events occur which control devices. This is similar to what many external trigger devices do, such as a configured national instruments card , or a pulse oscillator, or the triggerscope. The key difference here is that an external card and/or device isn’t needed, this occurs within the PC itself.

    Some further thoughts:

    • Micromanager is a great open-source competitor to other pay-for solutions. Good speed performance for a low up-front cost! (the cost of setting it up!)
    • It’s interesting that this never really seems to come up for 90% of customers who purchase “high speed” devices. Either the exposure times needed for acquisition of dim signal are so long as to never reach the speed thresholds shown here, or the capture frequency needed for a given study doesn’t require these speeds, or some other cause, but in my experience this is rarely a complaint on behalf of clients. Why isn’t this a bigger problem?
    • Many, many devices can’t reach the speeds shown here. In my tests I was using an LED driver. LED’s should have a switch time in the <5mS range. The slowest components usually found on a common automated microscope are the filter wheels and turrets, which usually run at the 50ms range when fully loaded with filters. (that’s on the fast side). So is this the reason the problem isn’t exposed more often?
    • By far, the slowest components you’ll find for microscopy are found on automated microscopes. Shutter open/close times on a common scope (i.e. big 4 name brand scope) can be in the upwards of 100ms! Moving a big filter turret usually takes 200mS. Again, this begs the question of how important speed really is for the common researcher….
    • For those who want the fastest possible speeds, have no fear! I’ll be announcing some major improvements to my triggerscope soon, to include programmable high speed sequencing capability!

    -Austin

     

     

     

  • Sub $2 microcontroller solution

    I’ve been working with Arduino boards a lot lately, and they are great. But some elements of the arduino can be even better.

    What is an Arduino?

    An Arduino is a breakout board for the Atmel “ATMega” series of microcontrollers. These microcontrollers allow for high speed measurement of analog and digital signals, as well as high speed output of analog and digital signals (well, quasi-analog using PWM, which is another post). So, the arduino houses one of the ATMega Chips at heart, and provides things like a voltage regulator, Serial – USB adapter, 1mm pin connections for several of the chip’s pins, and other nice to have or required-for-operation items one might want or need for these chips.

    Now, there are large Arduino boards with a great number of pin connections, like the Mega2560. This board has a ton of capability,

    Arduino Mega2560 pinout Diagram from Pighixxx

    with a great array of connection options. On the other hand, there are super small but capable boards like the RedBearLabs Blend Micro – which includes BOTH an ATMega ship and a BLE transciever!

    But each of these options has drawbacks, cost being one. The Mega is around $45, and the nano or tiny boards even without BLE are ~ $11. Yes, this is cheap, amazingly cheap considering the capability they provide, but if you want to integrate these into several projects, this cost aggregates rather quickly. So, can we go cheaper? In many cases, the answer is yes, and it can be found in the excellent little ATTINy series of controllers.

    ATTiny pinout

    The ATtiny85 is excellent for sensing a few lines on input, and driving a few outputs, like an LED, or speaker. For powering the IC, I prefer using a USB cable, which usually provides a clean source of 5V power.

    Now, to program the IC, you’ll need a programmer. The folks at Arduino have conveniently included an option for “Arduino as ISP”. Basically, you use the communication lines on an existing arduino to program your Attiny. I’ve found that a homemade shield makes this easy, as when you need to program an IC, you take any arduino laying around, drop the shield + chip on, program, and then continue using the arduino board for whatever project you’ve got. An example of a shield for an Arduino mega can be seen below. It took maybe 15 minutes to get this wired up – not a pretty solution, but fast and easy to use.

    IMG_4253

     

    Of course, you don’t need a shield to program the IC’s, a breadboard and some jumper wires will do.

    Once you have the IC programmed, it’s a matter of popping it out of the socket (or breadboard), and placing it into whatever socket you use for your project!

     

    There are numerous examples online of how to program these chips, a few of which I’ve used as guides. I like the one here, and there’s a nice video showing the general process here:


    Anyway – if you do plan to tackle this, just make sure to follow the directions for your specific version of Arduino IDE – there’s a big difference between v1.6 and the earlier version(s). ***IMHO, V1.6 is WAY easier to set up.

    -Austin

     

  • Countdown to a Revolution in Microscopy – Day 3

    Every so often I will get the chance to cook up some code for one of the usual software scope control packages. But these days, I spend most of my time in programs like Fusion360, Fritzing, and the like. So I guess this is how I feel when using the typical scope control software. How about you?

    I’ve used Elements, imagePro, MetaMorph, for years. It’s all good software. It’s powerful, and can do all sorts of crazy things that are super awesome. But what if I just want to obtain a 3 channel fluorescent image? Here’s what I end up looking at for a simple capture.

    Screenshot from NIS Elements – Lots of options, but lots of buttons!

    But this must be only one program, right? Surely other more capable systems have a current style of user interface, right? Here’s an example of the most capable (and IMHO fastest) software around, the venerable MetaMorph.

    Another example of great software, Metamorph, that includes a large array of buttons….

    For the typical person who just wants to snap an image, this is overkill. Now – I don’t intend to bash on these great software applications. For multi-dimensional timelapse, or other advanced work, there are few better tools available, and these do a great job of providing any feature one could want. But what percentage of labs have such complicated instruments, vs. the great number of simple, multichannel fluorescent microscopes around in every biology facility? How can it be that all these users must learn these behemoth software packages to capture some cultures? Other industries seem to have moved to workflow-based designs. You can find apps that perform full MIDI mixing on a tablet, heck, even airplanes have touchscreen controls now!  Yet the microscopy industry seems to be locked into a slightly improved version of windows XP button mashup.

    With all of the consumer products finding ways of simplifying control over hardware, isn’t there another way of doing this?

    Good software design can perform a specified job, and provide users the controls they need to do that job, but excellent software does so without requiring any training. An example of this can be found below, showing a unified interface for shuttering, attenuation and capture. This is a very limited example of what’s coming up, but just from this clip I think the differences in design philosophy are evident.

    Modern design for microscope components makes control simple and efficient.
    Can this simple control drive shuttering, attenuation and capture?

    I think Scotty wasn’t annoyed at the keyboard because he had to use it. He was annoyed because of what it represented: A barrier to getting his work done. Microscope time isn’t free time. There’s a lot of other, far more important work to be done than collecting the results of actual research. Cumbersome software results in less time to do the important stuff.

    Complex software will always be required for highly complex jobs, but for everyone else, I’m happy to say that the days of “software training” will soon be behind us. My guess is that most people will have a hard time going back to click and hunt, after using the next generation of control software. I know my perspective has changed. I guess that’s why these days, when I sit down behind a button-crowded screen, all I can think of is Scotty cracking his fingers 🙂

    -Austin

     

  • Arduino Mega 2560 Comparator

    So I needed to set up an Arduino Mega as a signal processor. I had a sawtooth signal coming from a device, and I wanted to convert that signal to a 0/5V TTL signal. Now, with something like a sine or sawtooth wave, the question becomes, “At what point do I want to consider this signal to be “ON”?” This is where a comparator comes in. Basically, a comparator references a different voltage you supply, and compares your supplied voltage to the measured voltage. There’s a detailed example of how this works using an Arduino in this instructable.

    Now, that ‘ible is nice, but note it’s written using an UNO, and unbelievably, the Mega 2560, a more capable board, DOESN”T have the AIN0 pin connected to a breakout line!!!

    Mega 2560 Pin Mapping

    Looking closely at this pinout, we’ll see that indeed, AIN1 is mapped to D5, but AIN0 is just out there with no love!!

    So what to do?

    Well, I considered just soldering a tap directly to the pin, but I was afraid of thermal issued in doing this, and it’s a small pitch, so instead I looked around a bit more at the functions used for the cmparator (ACSR Command) in the Atmel docs. It turns out, there’s an on board reference (1.1V) which can be used w/ AIN0. This is called using the ACSR command, and I went ahead and used that, as for my needs it worked great. BUT, Your mileage may vary.

    Here’s an example of the code I used:

    
    void setup()
    {
    pinMode(5,INPUT);
    pinMode(40,OUTPUT);
    digitalWrite(40,HIGH);
    //Serial.begin(9600);
    ACSR = B01011000; // comparator interrupt enabled and tripped on falling edge.
    }
    
    /*ACSR =
    (0<<ACD) | // Analog Comparator: Enabled
    (0<<ACBG) | // Analog Comparator Bandgap Select: AIN0 is applied to the positive input
    (0<<ACO) | // Analog Comparator Output: Off
    (1<<ACI) | // Analog Comparator Interrupt Flag: Clear Pending Interrupt
    (1<<ACIE) | // Analog Comparator Interrupt: Enabled
    (0<<ACIC) | // Analog Comparator Input Capture: Disabled
    (1<<ACIS1) | (1<ACIS0); // Analog Comparator Interrupt Mode: Comparator Interrupt on Rising Output Edge
    */
    
    volatile boolean sOn=false;
    unsigned long timer;
    
    void loop()
    {
    if(sOn)
    {
    digitalWrite(40,!digitalRead(40));
    sOn=false;
    delay(10);
    }
    
    }
    
    ISR(ANALOG_COMP_vect)
    {
    sOn=true;
    }
    

    Here’s the output generated from this code against my source wave, the red channel shows the behavior of my output pin.  I’m happy with the result, and it’s fun to learn (another) cool thing that the Arduino can do!

    Evernote Camera Roll 20150330 140755-Austin

     

     

  • ImageJ Counting Macro for Known Field Values

    Here’s a simple method to deal with varying intensities in a large run of images, assuming you have a known number of cells in a field. If I assume I should see, say, more than X cells per area, I can adjust my threshold to slowly increase it’s aggressiveness until that minimum counted value is met. The code can be downloaded as an imageJ macro here. but here’s a walk through of this simple script. My comments are preceded by a *.:

    rnum = 0; *this creates a new variable, or container, for our # of regions
    
     tval = 2000; *this is the starting object threshold value. 
     while (rnum<500) *this is a "while" loop. The loop runs until the argument is satisfied.
     { 
     setAutoThreshold("Default"); 
     setThreshold(tval, 4095); *note that tval = the minimum threshold value
     run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Nothing display clear add"); 
     rnum = roiManager("count"); 
     tval = tval - 100; *tval continues to become more aggressive in counting objects until the argument is met. 
     }

    Simple routines like these can reduce your headache factor by a large margin if you learn how to harness the power of macros!

    -Austin

     

     

     

     

  • WHY YOU SHOULD ATTEND THE UCSF/QB3 Microscopy Course

    Over the course of my career, I’ve flown across the US to attend a variety of imaging related instructional courses, all on the eastern seaboard. We are all familiar with the Woods Hole courses, the AQLM course, and so forth. What has boggled my mind is that here I am in the SF Bay area, surrounded by arguably the most densely populated and diverse centers of biological science innovation on earth, and there’s no major course?

    I started pestering the owners of Technical Instruments about this one night, and they admitted the same question had long been on their minds. A few months later, we asked the NIC team at UCSF about it, and found to our surprise that they were already cooking something up. We offered to help as needed, and have been doing what we can to help support the course ever since.

    So, UCSF/QB3 has just published their official webpage for the inaugural Microscopy and Imaging Course for 2012. (They let me design the website, I hope you like it!)

    If you are a regular reader of my blog, I’ll assume you’re involved enough in imaging that you would stand to gain much from attending the course. This won’t be a “sit in classes all day” kind of deal. The course has been designed around a kinesthetic approach, with lectures taking roughly 50% of the time, and the other 50% being hands-on bench work.

    If you live far away, or are having a rough funding year, please apply for a stipend for either the course tuition and/or travel. One of the initial course goals is to host the most geographically and vocationally diverse student group possible. So if you are thinking, “my work doesn’t fit the norm for the life science community” or “I’m not from one of the major research centers”, then you should apply!

    I’ll be attending to support the course along with most of our outside team from TI. I hope to see you there!

    -Austin

  • The CNC Machine is done!

     

    System completed, ready for a spindle.

    So after 6 months of watching the guys at mydiycnc complete their manual, and roughly 4 months of building, I’m happy to post that I’ve finished the machine. I’ve written an extensive post on the last few days of building, on the build log here.

    I couldn’t have completed this project without the major helping of patience by my wife. Thanks Jenny! (I think the boys are happy that the “robot” is all done).

    Thanks to my business colleagues (Carey and John) and friends at Sutter and ASI for your advice and support.   It’s amazing how much I’ve learned from you! Of course, thanks Stephen for coming up for this project and for your email support and advice!

    -Austin

  • Lumencor Spectra Driver Available

    Spectra

    I’ve written a Lumencor Spectra Driver that works with NIS Elements B3.2+. (AR or BR + Advanced Interpreter) The driver provides integrated control into elements for both intensity of lines and channel. These appear as a shutter and two filter wheels, offering full integration into Elements’ Optical configurations. We are selling it for $750, including online install on your system. Please contact me if you’d like to try it out!

    Screenshot of Filter & Shutter Interface

    -Austin

     

  • Voltage output from NIS Elements, MetaMorph or uManager for under $200

    USB-6008 connected to my multimeter

    I posted briefly about this a while back, in my explanation of the demise of the parallel port. I finally got my hands on a National Instruments USB-6008 box, and have found the unit to be 100% compatible with any NI-DAQ controlling application. What follows is an example of how to set this up using NIS Elements.

    First – what types of devices could be controlled with this?

    • AOTF Controllers (Spectral, Neos, Etc.)
    • Single Shutters (Uniblitz Etc)
    • Piezo Z Controllers (ASI, MCL)
    • Directly driven 0-5v lasers
    • Monochromaters
    • LED Light Engines (Lumencor/89 North)

    So – this thing is great when compared to the PCI cards normally used for numerous reasons:

    • Cost – This is ~$160 USD, vs. the PCI/PCIe cards running $1,500+
    • Size – This box is quite small, doesn’t require a huge cable or breakout box, and doesn’t occupy a slot on the PC
    • Portable – this will work on a mini form factor PC, or a laptop (which is what I used for this post), instead of requiring a full size tower

    Installation:

    Install is a snap. The only hard thing to do is place the pin indication stickers in the correct orientation on the box. If you mess this up you can always refer to the manual, but the little sticker strips included with the box make field-modification much easier. After this run the NI installer and reboot. Finally, connect the USB cable. The box will appear, and if you like, you can launch one of the NI test apps to run the device.

    In Elements, we’ll re-run the installer and check the “National instruments” hardware group, then select “NI DAQ”.

    Next, open Elements, open the devices window, and add the NI Device.

    Once we add the device, and click configure, we can define what each of the inputs and outputs do. Here I’ve selected a 2 line AOTF.

    After you’ve dialed in the settings you want, close the window(s) and if you don’t see the new device control panel, right click and select “acquisition controls” to find it. In my case the AOTF Settings window popped up after closing the device window.

    I also  made a short guide to using this box in elements via the Youtube video below. ***In the video I mention this thing costs $130, which is incorrect. It’s listed on the NI site as $168 as of today. Also I have yet to test more than 1 unit, but will be doing so shortly…

    httpv://www.youtube.com/watch?v=poKZjRgWdhQ

    One point of discussion is devices that require a 0-10v range. I’m looking into using a small powered op-amp chip and maybe packaging it into a small box for sale, or at least I’ll write up a how-to on using one, for people that need this voltage range. Luckily most of the devices out there can accept 5v or 10v input. Overall I’m happy to see NI is moving beyond PCI and PCIe bus cards. USB based boxes like these lower the acquisition cost for the customer, provide everything we need in the life science world concerning speed, and open up access to a wide array of devices. I’m looking forward to using this box on future systems!

  • Proper RGB Conversion of Multichannel Images

    When acquiring images in NIS Elements, it is possible to acquire each image with a color over that is approximate to the wavelength used for acquisition. This is the easiest way to view and relate multi-channel data, but when converting the images for export to other programs, it cam become a problem.

    In the image below I have two channels acquired – DAPI and FITC. If you note the overlay each of the two channels are completely independent.

    Original 2 Channel Image

    If I now use the Image -> Convert -> Convert to RGB command, some of the green and blue signal will be mixed within each other, and some of each channel will mix into the red channel:

    Image Converted to RGB and now color mixed

    So what causes this? If you note the channel data in the original image, the color is not a pure green. The 488nm and 405nm alexa dyes actually emit in blue-green hues and green-orange hues. So if we were to attempt to measure signal intensities in the RGB image using another program, our measurements would be invalid. In order to avoid this, you can  modify and use this macro, which will force the channels to pure Blue, Green and Red colors. With these color settings no color mixing will occur in the conversion.

    – Austin

  • Determining background sources in fluorescence

    For microscopy engineers and suppliers like me, the background produced in an image is of importance, if that background is created by the imaging system itself. What so many of us on this side of the scope (vs the user side) forget to train on and talk about is the specimen side of the background. So, how can you figure out where the background is coming from in your image?

    Example of two noise sources, one distributed and the other localized.

    Background Sources

    Usually background sources mentioned are those produced by the imaging system. I’d like to cover instead those produced by the specimen and the imaging system. These can be:

    System Background Sources

    • Fluorescent filter crosstalk/performance limitations
    • Objective and other optical limitations (aberration/convolution etc.)
    • Camera measurement noise (A/D Read Noise)
    • Camera-produced background noise (heat that the camera sees as signal)

    Specimen Background Sources

    • Auto-fluorescence produced by cells and/or media
    • Refraction/reflection of excitation light by specimen container (think plastic multi-well plate)
    • Ambient light in the room where the microscope is located
    • Byproduct remaining from sample preparation protocol (stain that remains after a rinse, etc.)

    Identification and Removal

    Instead of reviewing each noise source type and it’s cause, let’s instead perform a gross identification scheme to determine where the greatest noise source exists.

    Method 1: System vs. Specimen Measurement
    1. Configure your microscope and imaging system, and place your specimen on the scope.
    2. Focus on your specimen.
    3. Acquire 2-3 images of various locations of the specimen.
    4. Remove the specimen from the microscope entirely, not changing the scope at all (don’t drop the focus or change filters).
    5. Acquire 2-3 images with the scope in this state.
    6. Using either the ROI tools, or other tools available in your software of choice, measure the average intensity value, for the non-exciting area of your 2-3 specimen-present images, that we acquired in step 3.
    7. Measure the entire image field of the  2-3 images we acquired in step 5.
    8. We now have an intensity measurement of the amount of background for the imaging system + specimen, and the imaging system only.
    • If the image intensities remain relatively unchanged between the two image groups, the source of noise is in the imaging system.
    • If the intensities from the images in step 5 are significantly lower than those from step 3, noise is being produced by the specimen, or specimen container.

     

    In my next post I’ll cover how to further pinpoint noise sources, and how to eliminate them.

    – Austin

     

     

  • Photometrics LVDS cards on Win7

    I recently slogged through a tough install with a customer (Thanks Sean!!) in an attempt to run an older Photometrics camera using a PCI card in windows 7/xp. What we found was that the latest driver, (as of this post v. 2,7,10) is not working with PVDS cards! The solution for now is to roll back one version earlier, then things should be OK.

    You can basically tell if you’ll be affected by looking at the cable attached to your camera. an LVDS cable looks like this:

    LVDS Connector

     

    – Austin

     

     

  • I’ve moved to Bluehost – Notice?

    So after experiencing extremely slow delays (page load times) with my old hosting provider, I decided to move to Bluehost. For those of you interested in running your own wordpress site, it turns out that some companies don’t host wordpress and it’s database usage well, due to it’s reliance upon css to generate content to the viewer. Other companies host wordpress very well. The cool thing was the amazing lack of trouble regarding my move. Here’s what I had to do:

    1. Bought an account from Bluehost for a whopping 2 cups of coffee per month ($6.99).

    2. Followed this guide.

    3. Called Tech support – they figured out a few problems with my admin file, but nothing major.

    4. Updated my nameserver info on godaddy following this guide.

    5. Now the site, as you are reading it, is on bluehost and is MUCH MUCH faster. I wish I had done this a long time ago.

    * I am not compensated for advertising these guys, I’m simply a happy customer!

    -Austin

  • Fix for Elements v 3.2 and ASI Stages

    As anyone who is running NIS Elements v 3.20 + is aware, the ASI stage controllers of any MS-2000 series will not be usable once elements issues a connection command to the controller. Elements will control the stage properly, however the user will not be able to position the stage using the manual joystick. So, the guys at ASI have found the cause of the problem and have issued a series of firmware updates that will fix a variety of controllers.

    ***DISCLAIMER*** –

    These files MUST be used on the correct controller. If you use the wrong file it could cause some serious problems for your controller/stage/software. So, call ASI or shoot me an email if you have any doubt whatsoever about this. Basically, if you had any custom option on your stage (inverted axis, non-standard lead-screw or other modification) CALL ASI and give them your serial # so they can make sure everything will work for you.

    Or, better yet: make your direct or dealer rep do the patch. That way they can take the blame if they screw things up 🙂

    Required Items:

    First, you’ll need ASI’s firmware updater, which can be found here.

    Second, you’ll need one of these files:

    Standard XY Controller Firmware

    Standard XYZ Controller Firmware

    Piezo Enabled XYZ Controller Firmware

    Installation of the Patch:

    – Install the Firmware5 updater on your computer.

    – Restart the computer and restart the ASI controller. This just makes sure no other program is controlling the stage.

    – Run the Updater5, and select the appropriate firmware files.

    – apply the update.

    – You should see a “firmware update complete” message when the update has finished.

    – Power-cycle the controller, and check that the system responds to joystick commands etc. Check that the firmware version on stage start-up reads “8.8f”. This indicates that the patch was successfully applied.

    – Run Elements – everything should work now, including the joystick.

    Thanks to Gary at ASI for working on this and for providing a solution so quickly! This customer support is why you are on my Blogroll as the “favorite stage”! – Austin

  • Merging multiple channels in Fiji

    I had this question asked at my recent Bio-X training, and wanted to provide a thorough answer to it, as this is a common need:

    Assume we have multiple images, or multiple stacks, and we want to analyze something like the intensity through stack A vs. stack B. We don’t want to convert the stacks into an RGB image, as this loses flexibility and image resolution. Here is a step by step example of how to do this:

    Create a Demo Image Set

    1. We will be working in Fiji, which can be found here.
    2. Select File -> Open Samples -> Fly Brain. This will give us a 2 channel stack image, that we will convert into an example image to import.
    3. Select Image menu -> Color -> Split Channels. We now have Red, Green and Blue channels. Close the Blue channel as no blue data exists.
    4. We are left with two z stacks of red and green, that are 8 bit. To prove our processing later on works in 16bit, let’s convert the two images into 16 bit and adjust their intensity values.

      Step 4 – Two Channels Open
    5. Select the Green image, then Image menu -> Type – 16 Bit. Next we will increase the numeric value of the image data, so that we can later confirm our measurement results are in 16 bit space.
    6. Select Process -> Math -> Multiply – set the value to 255 and click OK. When prompted click OK to process all images in the stack.
    7. Repeat this process for the Red image stack. Save both files as Green and Red.
    8. We now have two stack files that are ready to be used as examples for color merging. Hopefully this also shows some use of the math and bit depth controls.

    Merge Multiple Channels

    1. Open both Red and Green stacks if you have closed them.
    2. Click Image -> Color -> Merge Channels. You now have a multi-Z data set, with two 16 bit channels. The top slider controls the channel that you are working on or are measuring on.

      Merged Two Channel Image
    3. Note the intensity values reported in the main toolbar reflect the active channel selected.

    Image 5-D

    1. You may note that in the image stack we have created, the threshold tool doesn’t work. In order to threshold this image we will move it into the “Image 5-D” plugin. (included with Fiji)
    2. With the Merged stack set open, select the   Plugins Menu -> Image5D -> Stack to Image5D. Note the resulting image can be altered for each color and scaled for display.

      Image 5-D Convert Window
    3. There is now a active-channel selection radio button, available on the right side of the 5D stack. Click on the channel you’d like to threshold, then try adjusting the threshold for the image.
    4. Note you can adjust the threshold for channel A and then adjust for channel B.
    5. Try an analysis using Analyze Particles. Note that the measurements provided for the active channel are in 16 bit values!

    Analyze particles on Image5D Stack

    Multi-channel visualization tools available in Fiji do require a few more operations than commercially available software, however the method used in Fiji is very straightforward. One can imagine the ease of script development using these tools, which is the optimum means of analysis. I am planning to explore other tools available in Fiji as time allows, and I encourage anyone using this version of imagej to do some thorough exploring of the menus, as it is extremely comprehensive and well thought out!

    – Austin

  • BioX Training at Stanford

    Welcome Bio-X Course Attendees!

    Due to it’s utility and ease of providing common tools in a variety of operating system choices, I’ll be running this course using the FIJI build of ImageJ. You can find Fiji here.

    Please bring the following to the course:

    1. Your laptop, with an installed copy of Fiji.

    2.  The Presentation and a set of demonstration images, available Here (19mb File).

    3. Your own images, so you can test the methods we cover on your own data!

  • Instensity Calibration using a Photostable Light Source

    Camera Calibration Source

    I’m very excited to announce Technical Instruments’  first ever camera-specific calibration product! At left is an image of the CC-560, or Camera calibrator, which emits photons at 560nm.

    All of the cameras in the microscopy world rely upon a single defining point that (theoretically) justifies the price premium we pay for them. That defining point is reproducible, quantitative linearity of intensity. Put simply, if I acquire some number of images, using the same camera settings, over a long period of time (days, weeks months etc), my camera should give me image intensities with the same brightness values, when provided the same amount of input light.

    Note that linearity, as well as quantitative accuracy, are expected minimum specifications on camera info sheets. Some examples can be found here:

    Nikon DS-Qi1

    Andor Clara

    How does this quantitative/linear capability translate into real-world data for the end user? With difficulty! Upon purchasing a new camera, most new owners of a quality camera will find a unique set of conversion tables for their serial number camera.  These tables note in part the individual electron to ADU conversion rates for each A/D readout speed, and Gain setting. This data can be used to discover how many electrons the camera collected for a given image. For instance one could have a  3.05 e/adu conversion rate at 10Mhz, as well as a 2.54x gain setting. Using these conversions we would find that a reading of intensity in an image, say with a value in the image of 100, would convert to ((100/adu)/gain) or (100/3.05)/2.54 = 12.9 electrons collected. Note this basic calculation does not include bias offset, which is another value provided in each camera’s specification sheet. The take home point here is that each camera manufactured will have it’s own, unique, set of values. You can use these values to convert your ADU’s (Analog to Digital Units) which are what you see as intensities in your image, back into electrons collected on the camera. This is especially useful when comparing images collected between multiple gain settings, or where camera speeds were changed and a corresponding change in image intensities was noted.

    For some people, these series of calculations and corrections, as well as others, may be a required, however tedious, fact of life. On the other hand there are a vast majority of researchers who want answers to simpler questions, such as:

    • What is the comparative sensitivity difference between the camera I used to work with in the lab down the hall, and this new camera I am now using?
    • How do changes to my camera, such as binning, really affect my data?
    • What do the detailed controls do on my camera? (Such as changing “Clearing” settings, or Parallel Clock speeds and voltages)

    Customers using EM-CCD cameras may have additional questions, such as:

    The simplest answer for these questions was to have the customer find some photo-stable light source, and use that light source on the microscope to find the answer. The tough part was actually finding a useful photo stable source! As an answer to these challenges, a few colleagues and I have created this product, available from my employer, Technical Instruments.  This calibrator is designed to give people simple and direct answers to these types of intensity based questions, with a minimum of hassle or headache. The product will work on ANY C-Mount camera, and can be used either for dedicated-use calibrations (i.e. install – calibrate – remove) or can be placed in between the camera and the microscope in a permanent installation (See example image of Andor camera and Nikon Ti-E microscope with CC-560 installed at right). I’ll be posting more soon on what this product can be used for, however I’m certain there are numerous uses for this that we haven’t considered. Please take a look at our new CC-560 Camera Calibrator.

  • Micro-Manager 1.3 and Velleman Boards

    If you are running micro manager and need to control a device via TTL or voltage, there is a nice driver written for umanager along with an inexpensive A/D card. The Card I used for a recent project was the Velleman K-8061. I’ve written up a simple how-to on connecting the board to a windows PC and getting umanager to run it.

    Setup instructions for the Velleman Board and uManager 1.3

    uManager Wiki on the K-8061 board

    Velleman Board Link

    -Austin

  • Elements 3.1 Released

    Nikon has released it’s major revision of Elements in version 3.1. (Build 587). There are several new features in this build and from what i’ve seen it’s quite stable. You can download the build here.

    – Austin

  • What can programming macros do for me?

    I’ve been running into a lot of programming applications lately. The fun part about using the Elements (or other) programming system is the amount of utility and flexibility it can offer to end users. Most people think about programming in our industry only as it relates to image analytics. I wanted to point out some other things macros can do for you:

    Acquisition & Device Automation

    Do you have a stimulus device or method you want to trigger from your acquisition software? Almost every device on the market (FRAP illumniators, Profusion systems, heating systems, electrical signaling systems) can accept a command input from TTL. You can use Elements (or other software) to control the parallel port on your computer – giving you control of the device you already have. A macro can tell the device to start, stop, adjust a setting and can then record that command into elements (i.e. at what time point in a timelapse the command was issued).

    User convenience

    Are you always pressing the same buttons in software to control the microscope? You can use macros to assign keyboard keys to run special functions. For instance when you press the “0” key on the number pad you can make the microscope load a “DAPI” illumination setting and acquire an image.

    User interaction

    Do you only run a few experiments over and over? You may be working harder than needed by re-configuring your software to image with a specific protocol. You can use a macro to configure all of the settings you want in one operation, and then dial in specific changes you may want to adjust before acquisition.

    In general any button you press, number you enter or menu you click can automatically be performed inside of a macro. Keep this in mind any time you are repeatedly clicking on the same things and slowing down your work!!

    EXAMPLE DOWNLOAD
    You can find an example macro for use in Elements here. Open Elements, open the Macro menu and click Edit (or press F8) and copy the code from this page into the empty macro. Then just save and run it!

Social Media Auto Publish Powered By : XYZScripts.com