Welcome to X26A
Information For Users
APS Sector 13
BNL Visitor's Guide
The Prosilica GC 1350C CCD Camera
Doesn't it seem these days that whichever way you turn there's this mad push to move away from analog devices towards more digital ones? We at X26A, being the shameless conformists we are, certainly don't wish to buck this trend (although I personally prefer the original Bugs Bunny to Buzz Lightyear). So in true sheep-like fashion, on your next visit to the beamline you'll notice a distinct difference in our sample viewing optics. We have put our old Toshiba CCD camera with its NTSC analog output to rest and replaced it with a brand spanking new Prosilica GC 1350C ethernet camera. Now yes...both are digital cameras...but the Toshiba, being bound to conform to NTSC standards, only had an analog output and was restricted to a resolution of 760 x 480. The new Prosilica GC series of CCD cameras are ultra compact, high-performance cameras that interface to the beamline through a Gigabit Ethernet interface. The GigE interface allows for very fast frame rates and long cable lengths (up to 100 meters) using a standard CAT5e network cable. The model we purchased provides a resolution of 1360 x 1024 pixels, roughly twice that of our older camera. More importantly, Mark Rivers has written an EPICS driver for these cameras which allows them to be fully controlled via his areaDetector software implementation by all systems on the beamline LAN. The really neat thing is that by interfacing the camera control and output through EPICS, this will allow us in the (very near) future to write applications (for example as part of our IDL scanning routines) to get the detector image data through channel access, receive the detector data at a lower-level for very high performance, and provide a mechanism for device-independent real-time data analysis such as regions-of-interest and statistics. Now like anything we implement, at the early stages we need to work out the details of how it will work best at the beamline and we will need to write some code to get it to do all the fancy things we'd like. The biggest issue right now is that it takes a bit of configuration when we start a run to get it set up properly. We will do that for you at the beginning of your run but, as is prone to happen, occasionally software crashes or is accidentally closed (rest assured I am more prone to doing this than you). So my goal here is to give you the basic instructions in getting it up and running and how to do some very basic tasks using ImageJ and the areaDetector plugin. This web page will evolve quite a bit over the next few weeks, but I wanted to at least get these basic tasks written down so I'd minimize the number of late night calls (not that I don't love chatting with all of you but hey...)
Starting up the soft-IOC and configuring the MEDM screen
In the worst case scenario you'll need to get the Prosilica camera up and running from the start. The camera is always connected so what I mean by not "on" is that somehow we've closed the Prosilica Camera adl screen (the MEDM screen you see to your right) and you don't see an icon on the task bar labeled "Start Prosilica". If this indeed is the case, then alas yes...the soft EPICS Input Output Controller (or IOC) has closed up shop. Let's restart it. To do this look on the desktop for an icon labeled "Start Prosilica", the icon will look like a little camcorder (digital of course). Double click on that sucker and that should fire up the IOC. Now we need to get the camera configured properly...most of the parameters are saved automatically so there shouldn't be much to do here, but the most critical thing is to put the EPICS driver for the CCD in an acquire mode. You'll always need to do this if you restart the IOC, so go to the X26A Beamline Control adl screen and you should see that the 2nd button down on the list is "Prosilica CCD". If you press that button a screen looking remarkably similar to the one to the right should open up. We'll discuss some of the options you can set here in a moment, but let's focus on getting the camera viewable right now. We need to get the EPICS driver streaming the images from the CCD. To do this go to the Prosilica Camera adl screen that just opened and under the section labeled "Collect" there will be a label that says "Acquire" and a button next to that labeled "Start" beckoning to be pressed. If the CCD isn't streaming images the text area above these buttons will read "Done" in green. Once you press the Start button (go ahead...it's OK) this will read "Collecting" in yellow and the detector state will read acquire. You'll also see the image counter streaming the frame number. If you want you can close this adl screen for now, we'll come back to it again in a minute.
With the IOC streaming images from the Prosilica CCD the next thing we need to do is get ImageJ started, that's what we'll be using to view the images through an EPICS plugin Mark wrote. There should be an ImageJ icon on the desktop to start it up.
ImageJ and the EPICS areaDetector plugin
ImageJ is a public domain Java image processing program inspired by NIH Image for the Macintosh. It's very widely used in the analysis of images collected using various types of microscopes so has a number of built in tools that are well suited to what we do with the optical CCD we use at the beamline. I'll let you browse the ImageJ website to get a full flavor for all it's capable of, but for our purposes let's go over how we use it to view the Prosilica image stream using Mark's areaDetector plugin. If you successfully launched ImageJ using the desktop icon you should be presented with a toolbar like the one shown right up above, the top one...yeah...the one that says "ImageJ". To launch the areaDetector plugin select the menu option that says "Plugins" -> "EPICS_areaDetector" -> "EPICS AD Viewer" . This will launch the plugin toolbar, the bottom toolbar shown in the picture above. To get the image stream going click on the "Start" button, which will open up the display window. Voila! You should be viewing a Technicolor movie of your sample. The magnifying lens on the ImageJ toolbar lets you zoom in (left mouse button) and out (right mouse button), you can draw a crosshair with the cross-shaped tool, draw lines with the line tool, etc.
Mark has also written a companion plugin that will display a dynamically updated line profile. This is handy, for example, if you want to observe the beam profile on the YAG or ZnS phosphor in real time during focusing. To use this, draw a line through the object you want profiled then select "Plugins -> EPICS_areaDetector -> Dynamic profiler". This will open a new window that will display in real time the intensity in each pixel under the line that was drawn in the image stream.
Using ImageJ to mark the beam and calibrating the image scaling
One of the most important things we use the optical image for is to tell you where the beam is on your sample. With the old Toshiba CCD we did this with a manually adjustable X-Y crosshair. But alas...it requires an analog signal. In ImageJ this is easily done with the crosshair button. You select the tool, click on the image where the beam is, and tada...all done. The crosshair will remain in the same position even if you zoom in and out of the image. We will mark the beam position for you when we set up your experiment, but I have a feeling there will be instances where we will accidentally close the image window or erase the crosshair mark. But that's OK, it turns out that ImageJ let's you save the coordinates of the crosshair as an roi. So after we mark the beam, we we will do is save the position in your data director under the file name "Beam.roi" . If you accidentally lose the crosshair all you'll need to do is open this file using "File -> Open -> Beam.roi" and it'll return to where it was marked.
Another useful aspect of ImageJ is that it allows for scale calibration. Once an image is calibrated you'll be able to measure distances and areas in micrometers. The easiest way to do this is to open an image that has been precalibrated. Again, we'll do this for you before you start, but in case you need to reapply the scaling, simply get the image stream running as described above. Once running, open our calibrated image in ImageJ, it'll be called "X26A_Scale.tif" and it will open in a separate window. Now with this window selected choose Analyze -> Set Scale... from the ImageJ menu. A window will pop up showing the scaling for this image (basically microns per pixel), just check the box labeled "Global" and select "OK". This will apply this scaling to all open windows including the video stream. Once you've done that you can draw a line using the line tool or an area using the freehand roi tool and measure the distance or area you've defined by selecting Analyze -> Measure. You can even save an image from the video stream for posterity with a scale bar attached for future reference. To do this you'll first need a snapshot. This is actually really easy to do by simply going to the areaDetector plugin toolbar (which is most likely minimized on tha taskbar) and clicking the Snap button. With this snapshot you now have a couple of ways to get a calibrated scale bar on the image before saving it. The option I like best is to use ImageJ's scale bar tools. You can access these if they aren't open alreadey by clicking on the >> button at the rightmost side of the ImageJ toolbar and selecting Scale Bar Tools for Microscopes. This will change the set of tool buttons displayed and one of these should be a little icon that looks like a teeny weeny microscope. If you select this you'll see an option labeled X26A. Go ahead and select this and then click on the icon that looks like a scale bar with um next to it. This will pop up some menu boxes. In the first menu there's a listing for "current spatial calibration" in which you should select 5X from the drop down list. This is the objective lens we use most often. Select OK and another menu pops up asking you how big a scale bar you'd like on your image. The default is 100 um and once you've chosen you'll see a modified image with a scale bar at the bottom and various bits of information about when the frame was collected, etc. The second way to insert a scale bar is a bit simpler, simply go to "Analyze -> Tools -> Scale bar".
Using Stage_Widget to mark the beam and save JPEG of sample
ImageJ provides staff a convenient real-time method of interfacing with our Prosilica CCD. But for users it can be inconvenient to interface with during a run. We have simplified this somewhat by providing you an IDL routine that lets you rapidly accomplish several tasks in saving a record of current stage motor positions on a sample. The Stage_Widget IDL program will let you:
To run the program simply type "Stage_Widget" at the IDL> prompt. The widget displayed to the right should open. The top of the widget contains a menu option called "Image Directory". By default the images are saved on the PC that is running the soft-ioc for the Prosilica, mapped as directory I on the control PC. This lets you change the directory to which the images are saved. Next there is a "Save position as" field. The idea is to enter text...a name, for this position that you would like to have saved and recall at a later time. In the example to the right, we've entered "point1". You have to hit ENTER after you've typed the name in order to get this to take, and when you do you will get a little acknowledgement at the bottom that it was saved. What this does is read all the stage motor positions and create a small text file in X:\stagexyz with the name, in this case, point1.dat. It's best to avoid long file names, keep it simple, avoid punctuation. What you will also notice is that as soon as you hit ENTER you will also get a visual display of the CCD in the bottom window of the widget. If you also go and look in the directory you defined as your Image Directory, you should also now find a file called point1.jpg, which is a screen capture of this point. If you ever want to move back to this position, you just put "point1" in the "Move stage to:' field, hit ENTER, and away it goes. You'll also see a response at the bottom of where it is moving the stages to.
You also see two checkboxes in the widget labeled "Mark Beam" and "Show Beam". The Mark Beam option is intended to be used at the beginning of a run to mark the beam position on the screen. When the checkbox is selected, clicking in the display window (you'll note a crosshair) will mark the beam with a red "L". The lower left corner or the L should mark the pixel where the beam is. This also creates a file in your image directory labeled beam.sav that contains the pixel value of the beam. This file is used for visible image capture using our scan routines, so ONLY do this if you absolutely know what you're doing! A backup file is created to prevent overwrites, but my recommendation is just leave this option to the beamline staff or talk to them about redefining the beam position first. It will save you headaches down the road.
When the Show Beam option is selected the L beam marker is always displayed along with a view of the sample.
Changing image gain and frame rateOkees, let's go back to the Prosilica adl screen for a moment. In the Readout section of the adl there are some options for adjusting the size of the image that's shown and whether the image is monochrome or RGB color. You'll notice in the example shown above that the sensor size is listed as 1360 X and 1024 Y and that the region Start and Size are shown as 0,0 and 1360,1024 respectively. These settings will output the full active area of the CCD. We could specify that only a small region of interest (yes...ROI) be output instead by changing these values accordingly. Usually, though, you'll want to output the full active area but you do have an option of having this be displayed smaller image by binning the CCD. Changing the X,Y binning to 2,2 will give a full image that's half the pixel size. You'll also notice that you'll get a bit faster response from the CCD in doing so, but there's a downside in that a binned image can only be displayed monochromatically. For a full 1360 x 1024 image we can switch between color and black & white by changing the Color mode between RGB1 and Mono. In monochromatic mode you'll be able to apply some odd psychadelic color schemes to your image using LUT's. This can be useful both for giving you some googlyeyed entertainment at 3:00 am in the morning and for enhancing the intensity variations in objects. We use this, for example, in better visualizing the beam shape on a YAG phosphor. To do this once you have a monochromatic image, go to the ImageJ toolbar and using the >> button select the Lookup tables toolbar menu. The LUT button will give you a listing of various color tables that can be applied.
The Readout frame also provides control for the CCD gain (for our purposes let's consider this the image brightness). This can be varied between 1 and 22. The other area of interest I wanted to pint out here is the Collect frame from which we can adjust the image frame rate. We'll do this by adjusting the Exposure time and Acquire period. Both will affect how fast the frames update, but in general it's best to keep the exposure time as low as possible. For the GC 1360C this is 0.05. The Acquire period can then be considered the direct inverse of the frame rate and can be adjusted accordingly depending on your needs.
|Beamline X26A receives support the following organizations:|