Adobe Photoshop Tips and Microscopy Tips George McNamara, Ph.D. Childrens Hospital Los Angeles - Image Core 4650 Sunset Blvd, MS 84, SRT 1016 Los Angeles, CA 90027 323-669-2548 voice 323-251-8878 cell 323-668-7921 fax gmcnamara@chla.usc.edu February 27, 2003 Note: this originally came from a tutorial I wrote for Spectral Karyotyping (SKY™) customers of Applied Spectral Imaging Inc. (www.spectral-imaging.com). Adobe Photoshop Tips: I use a small number of commands in Adobe Photoshop to optimize image contrast. If you have other favorites, e-mail your procedures to me for inclusion in this note. DAPI: ctrl-I is the shortcut for Invert Contrast. This results in an “inverse-DAPI image” that if it has decent banding I will refer to as a pseudo-G-banded image. The best inverse-DAPI banding will never be as good as the best G-banding, but inverse-DAPI banding is often good enough to identify chromosomes by. Unbanded images are probably worth re-acquiring with heat filters, better focus, longer exposure time, and/or resuscitation by fresh DAPI + anti-fade (see above for DAPI acquisition tips). Spectral Karyotyping customers will be able to use SkyView 1.2 software to do a very nice "Band Enhancement" method to enhance their G-banded or DAPI images without needing Photoshop. Our Enhancement routine is a clever combination of the sharpen and Gamma adjustments that are separate commands in Photoshop (i.e. if you understand Photoshop, imaging, sharpening and gamma, Photoshop should be sufficient). Sharpening: Filters-Sharpen has four sub-menu items. I tend to use Unsharp Masking, but you may be satisfied by the effects of one (or more) of the Sharpen items. Unsharp Masking: Start with settings of Amount=50%, Radius=4.5 pixels, Threshold=0 levels, and then play with the Amount and Radius settings (leae Threshold=0). "Edge Overlay" using Filter … Other … Custom: Use a three row plus (+) filter of: 0 -1 0, -1 4 -1, 0 -1 0 to create single pixel wide edges of the classification color image or classification karyotype table icons. (Note: You may want to "erase" the table's blue and white borders first). A nifty use for this is to then superimpose the classification outlines on the spectral color image to highlight in the overlay image each chromosome region as determined by the SkyView spectral analysis algorithms. See "color merging" below for generic overlays. You will have to play with the color merge option that works best (this will depend on the image or karyotype table icons that you use for the spectral or band image and whether you "keep" any of the spectral color information). I find that using the classification colors for the edges to be useful to help me see what chromosome pixels are each chromosome. However, you may want to start with white (or gray) classification edges superimposed on the spectral color image. This will hopefully keep you from getting confused by the massive amount of information being shown. Another neat "dynamic display" method is to put the edges in one layer and the spectral color (or banded image or both) in other Photoshop Layers, than then toggle them off and on using the Layer Options panel (click on the eye icon on the left of the layer row). Gamma/Brightness/Contrast: These are found in the Image…Adjust sub-menu. Gamma is great! This is a non-linear intensity adjustment. You can access this from the Curves or Levels dialogs. In Levels, the middle of the three numbers at the top of the dialog is Gamma. In the Levels histogram, the middle of the three arrows is the Gamma. For G-banded images, try a Gamma of 1.5, 2.0 or 2.5 (you will rarely need >2.5). In Curves, press on the line in the graph and change it from a straight line (Gamma = 1.0) to bow upwards (Gamma > 1) or bow downwards (Gamma < 1). On an G-banded image you usually need to bow upwards, to lighten up the dark bands. Usually Gamma and Brightness/Contrast are adjusted iteratively. Tweak gamma, then play with brightness/contrast, and repeat until you have a satisfactory result. The usual goal is optimized G-banding. By going to extreme settings you can make pseudo-Cbanding images or non-Banded Giemsa stained images. Levels, Curves and Auto-Levels (Gamma/Brightness/Contrast) are among the few (only?) commands in PhotoShop 4.0 that work with 16-bit TIFF images. You might want to experiment with saving some G-banded or DAPI images as 16-bit TIFF images (Spectral Imaging application, Export…TIFF command), and playing in PhotoShop. You will need to change the image depth to 8-bit for use with SkyView 1.1. John MacKenzie (supervisor@emc.ncsu.edu) has several PhotoShop tips. To paraphrase his “The Key to Digital Imaging or Breaking the Brightness and Contrast Habit is the following (John’s exact instructions in single quotes): 1. Start with an 8-bit grayscale (John used a SEM micro-graph, you can use a G-banded or an inverse contrast DAPI image). 2. Print the image on a laser printer (i.e. HP LaserJet). It will probably have poor contrast 3. PhotoShop: Image – Adjust – Levels command. This will open a dialog with an “Input Levels” histogram, and “Output Levels” grayscale slider, and a Preview checkbox. 4. Turn on the Preview checkbox. 5. ‘Move the left, black arrow under the histogram until it matches the first black portion of your histogram.’ 6. ‘Repeat this process with the right arrow on the right nder the histogram so it matches the first white area.’ 7. ‘THE CENTER ARROW IS YOUR GAMMA ADJUSTMENT. Move it to adjust your gamma.’ (the middle edit box next to “Input Levels:” is the numerical gamma value. You can also edit that by typing in a new number, i.e. 1.5). 8. ‘I like to do a series like 1.2 on the first pass. Then print. Repeat with 1.2 and print. Repeat until too light.’ (i.e. Set gamma = 1.2, print, inspect the image. If the print is not contrasty enough, increase gamma by 0.2, print, inspect, repeat as necessary). 9. Please note that on some images you may want to decrease gamma, i.e. try gamma of 0.8, 0.6, etc. if gamma 1.2, 1.4, 1.6, etc do not work well. 10. ‘If you apply a fairly large gamma correction you will need to readjust the contrast. I usually adjust the contrast up by +5 to +7 and reduce the brightness by –3 to –5. Then I readjust the gamma two or three times until the image looks right.’ 11. ‘Do not fall into the brightness and contrast trap. My [John’s] students always print with too little gamma and then start using B and C again.’ 12. ‘Gamma values usually end up around 1.8 to 2.0, but it is not unusual to hit 3.0’ (for SEM prints). 13. ‘Remember the gamma values are LOG values. If you apply 1.2 [and press OK to close the Levels dialog and then re-open the dialog] and then apply 1.5 the next time, your total gamma us 1.2 times 1.5, or 1.8 total gamma correction.’ 14. ‘Remember: Every image will need a different gamma correction to be “right”. Every printer and printing condition change will require a new gamma.’ 15. Once you have practiced with gamma and printing you should get “a feel” for what you need to do to get very good contrast and especially good G-banding. Every printer behaves differently, especially as the black cartridge or toner runs low. The Codonics NP-1600 dye sublimation printer may have settings for gamma and for printing a series of gamma settings (read the printer manual). Ctrl-I is the shortcut for “Invert Contrast”, a useful feature for making DAPI-banded images (bright fluorescence on a black background) look like G-banded images (dark chromosomes on a bright background). Interaction between Sharpening and Contrast Adjustment: Image quality is in the eye of the beholder … you! As an experiment, compare doing Unsharp Masking and then Gamma 1.5 to doing Gamma then Unsharp Masking. Erasing the blue and gray borders and white text of the karyotype table: 1. Zoom up the karyotype table image (500% is good). 2. Double click on the Magic Wand tool (toolbar, second row, right side) to pop open its Options dialog. Set Tolerance = 1 (default is 32). Close the Options dialog. 3. Click on a blue border pixel. This should highlight that entire border. 4. Select menu … Similar, will then select all the pixels of exactly that blue color (note: hopefully no chromosomes use that color!). 5. Edit menu … Fill dialog, select Background (assuming the current background color, usually black, is what you want to use as the new color). 6. Click OK to replace all the blue pixels with the background color. 7. Repeat with the gray borders and/or white text if desired. Color Overlay (a.k.a. Color Merge) in Photoshop: We like to superimpose our color image on a grayscale image using the following procedure. We use as examples merging the Spectral Color image and the Band image, and of merging the Classified image on the Band image. 1. Export the Spectral Color, Band, and Classified image from SkyView. These should be saved as 24-bit TIFF images (right click on the image window, select Export, TIFF, 8 bpp, filename). Note: You may want to turn “contours” off before saving. 2. Start Adobe Photoshop 4.0. Open the three images. 3. Select the Band image (i.e. click on its title bar). If the Band image looks like a fluorescence image, use ctrl-I to invert the contrast to make it look like a bright-field Gbanded image. 4. Optional: Use sharpen, unsharp masking, and gamma/brightness/contrast (see above) to achieve optimal sharpness and contrast of the Banded image. 5. From the Layer menu, select Duplicate Layer. 6. Set the Destination Document to the Spectral Color image. Optionally change the “As:” field to “Band”. Click OK. (the dialog will close and the new layer will be added to the Spectral Color image). 7. Select the Spectral Color image (i.e. click on its title bar). 8. From the Layer menu, select Layer Options. 9. Optional (alternative to #8): From the Window menu, select Show Layers. (If you want to use the Layers window to select which layer you are working on). This opens the Layer options panel. 10. The band layer should be active (or make it active by typing in its name in the Name: field or clicking on its icon in the Layer Options panel). By the way, a neat "dynamic" trick is to toggle a layer on and off, similar to playing with "flip cards". 11. Change Mode from “Normal” to “Overlay”. I like “Overlay” best for merging the Band with the Spectral Color image). For the Classified image, I like using “Luminosity”. The “Luminosity” mode also gives an interesting result when merging the Spectral Color and Band images together. However, I also like "Hard Light" and "Soft Light" and other settings for some overlays. 12. Optional: Try playing with the other controls. I like to toggle the Preview checkbox off/on to inspect how the merged image compares to the original. 13. Click OK. 14. File menu, Save Copy As, TIFF, enter a filename, click OK twice, choose IBM PC format, click OK. 15. Note: you may want to change the chromosome 9 classification color from white to some hue, to add "color" to the chromosome. Some comments about overlays: The method works perfectly well on both metaphase images and the karyotype table. The quality of the alignment of the overlay image (i.e. classification image as a color layer on the DAPI band image in Photoshop, or my favorite the "edge" outline of the classification on the band) is simply a matter of how well aligned the images are in SkyView before you drag or copy/paste them. The current versions of SkyView (1.2.04 for SKY, 1.5 for Spectral FISH) for a very good job of aligning (in the absence of confusing landmarks like some interphase nuclei). When I originally SKYgeneticists the overlay method (late 1997), the feedback I got suggested the alignment was pretty good. By the way, both SkyView 1.2.04 and 1.5 have an alternative approach to marking where the translocation breakpoint is. The karyotype table right-click menu has "Display Centromere" and "tools -> Centromere Tools" (and analgous translocation tools). turning on the tool and display, tyhen clicking on a chromosome marks the chromosome. The mark is shown on EACH chromosome 'icon'. For example, the centromere mark is a thin white line. This should help line up the bands to the translocations. Other stuff: Rotate (by an arbitrary angle) a chromosome or image (from Photoshop help): Do one of the following: • To transform part of a layer, select that area of the layer. • To transform an entire layer, make the layer active and make sure that nothing is selected. Choose Layer > Transform > Rotate (or Scale, Skew, Distort, or Perspective). Drag the handles to achieve the desired effect. To apply additional transformations, repeat steps 2 and 3. Press Enter to apply the cumulative transformation. Press Esc to cancel the transformation. If the rotate results in background pixels being the wrong color (i.e. white on the black background of the Karyotype Table), you can select the white pixels with the “magic wand”, then do an “Edit menu … Fill” to change the pixels. Note that the Rotate command modifies pixel values (unless you use the 90 or 180 degree options). We recommend that you perform sharpen/contrast operations on your chromosomes before performing Rotate. To be honest, we like to "average" a gray and a color image, i.e. 24-bit images of a spectral (or classified) color image averaged with a phase contrast, DIC or bright-field image of a metaphase. Unfortunately, not of the standard image analysis software that is commonly used (Photoshop, ImageTool, Image Pro+ or IPLab) have an easy to use "average" command. Even better results are possible if you can adjust the "balance" (i.e. 70:30 instead of 50:50 average). The company I used to work for did have something like that (since they rudely "downsized" me, I won't mention them by name). Photoshop has many other interesting commands (see the 1997 ASI Holiday card for an example). I am not a Photoshop expert and usually “rediscover” how to use these as needed (if you want further Photoshop details buy a book for yourself or for me, or pay your or my tuition for a course. ASI’s graphics artist suggested “The PhotoShop Wow Book”). The main things I can say about Photoshop are: Find the time to play with your images in Photoshop. If you like your results be sure to write down what you have been doing. Otherwise you may forget how you reached a cool result. Save your results to new files (you can always delete the bad ones later), i.e. by using File->Save As. You may want to purchase additional plugins for Photoshop. We are currently investigating whether the “Image Processing Toolkit” CD-ROM from John Russ and Chris Russ would be of use to you. Price is approximately $250. See http://members.aol.com/ImagProcTK/ (if you do get the CD-ROM, be sure to download the update files from the web site). The Russ’s have a newer Photoshop add-in called Fovea Pro 2.0, that is well worth the approximately $600 because it lets you operate on 16-bit monochrome and 48-bit color images. It als adds many measurement and image math capabilities to Photoshop. Web site is http://www.reindeergraphics.com/foveapro2/ and several free filters are available, along with the manual. Additional tips on Photoshop can be found in many books or from the following microscopy articles: T. Weatherby (1999) More fun with Photoshop. Microscopy Today 99(5): 12-13. (June 1999). T. Weatherby (1997) Fun with Photoshop. Microscopy Today 97(9?): ?-?. (October 1997). Gerry Sedgewick’s Quick Photoshop for Research :A Guide to Digital Imaging for Photoshop 4x, 5x, 6x, 7x" (Kluwer Academic Press?). [Note: GM reviewed a prepublisher version of Gerry]. Wayne Fulton’s ScanTips book ($25) and web site (www.scantips.com). If you are a UNIX geek, you may find the "XV" X-Windows Visualization (image display) software useful. You'll have to hunt around on the Internet to find it ($25 registration fee is much less expensive than Photoshop). Free image analysis software ('you get what you pay for'): If you are a Mac weenie, you can download NIH Image; and masochistic PC users (or mouse G-banded karyotypers, who by definition are masochists) could download ImageTool from UTHSCSA's web site. Photoshop and PowerPoint: In PowerPoint, always use “insert picture from file” (i.e. save a JPEG or TIFF image in Photoshop, then switch to PowerPoint), not copy & paste. This is crucial to avoid “PPT Bloat”, because PowerPoint handles clipboard contents in a stupid way. Photoshop and RAM (displaying G-banded images in Photoshop for re-finding metaphases for SKY): I recently spent half a day acquiring SKY images from a previously G-banded slide. I was using Photoshop to display the G-banded images so that I could re-acquire the same metaphases. I kept encountering messages in our Spectral Imaging software saying that there was not enough ram to acquire the image and asking if I had Windows NT Administrator privileges (I did, this is set in Start... Programs ... Administrator Tools (Common)... User Manager). I could acquire spectral images whose peak memory usage was about 50 Mb when Photoshop was running, even though the PC had 256 Mb ram! Exiting Photoshop allowed me to acquire "full chip" images, but was not convenient since I then had to re-open Photoshop to look at the next metaphase. Today I found and eliminated the problem: Adobe Photoshop 4.0 (Windows) defaults to being a memory hog. This severely limits the size of a spectral image that can be acquired by our S.I. software. As installed Photoshop reserves 75% of physical memory for itself. This means that on a 256 Mb ram computer, only about 50 Mb are available for the Spectral Imaging acquisition software when Photoshop is running (256 Mb - 196 Mb for Photoshop - 10 Mb for Windows NT). To change this percent, go to File... Preferences... Memory & Image Cache Change Physical Memory Usage from 75% to a smaller value. I suggest 5% (12 Mb of a 256 Mb system). Then press OK, and exit and restart Photoshop so the new value will be used. Making this change allowed me to have several images open in Photoshop and still acquire a 640x480 pixel ("full chip") image with the Hamamatsu C4880-85 camera and standard SKY acquisition settings (35 steps, 128 frames, 256 virtual frames, 450 .. 800 nm) using our 256 Mb Micron computer. Incidentally, this computer also lets me keep SkyView open during acquisition sessions. This is useful because it makes it easier to take a quick look at a dataset before moving the slide to the next metaphase (one spectral image was out of focus, and I was able to re-acquire it after refocusing). As for the G-banded images I have several comments: 1. I encourage using "full image" instead of "live region" modes to save the G-banded images. This allows the use of more landmarks for re-finding the metaphase for SKY. 2. Photoshop's rotate command can be handy for rotating the G-band image to match what you see in the microscope. 3. Does anyone know of a high precision slide holder so that repeat placement of the slide on the microscope will give the same position with the 63x lens? Printing: Warning about laser printers and un-interruptible power supplies (UPS): Most computer UPS’s (i.e. the Back-UPS 600 from APS, specify that you should not attach a laser printer to the UPS. Check with your UPS manufacturer whether this also applies to your dye sublimation printer. What printer(s): We often use the Codonics NP-1600 dye sublimation printer for publication quality prints. We love our ~$400 Canon bubbleJet BJC-7004 (this was written in 1999 … in 2003 get yourself a 6-ink photo quality Inkjet printer or spend the big bucks for the Fuji Pictrography). The paper and ink cartridges are much less expensive than the Codonics (or any other) dye sub printer. Buy one per workstation! Ask your ASI salesperson how much memory you need in the Codonics (more is better). In the PowerPoint Printer Setup dialog use “Set to Letter, Print dialog “Scale to fit paper”. We use a Canon BJC-620 color bubble jet printer for internal use. Tom Deerinck (UCSD) told us that the Fuji Pictrograph [dry chemical?] printer produces superior blue colors to any dye sublimation printer he has ever seen. This printer may be more expensive than the Codonics NP-1600 dye sublimation printer we usually sell. Contact ASI if you are interested in trying this printer out. Network printers: In October 1997 we used a Codonics NP-1600 printer that was on a computer network. This printer used a web page or an FTP connection for the transport of TIFF image files to the printer. We found that we could not print TIFF’s exported from S.I. 2.1.2 or SkyView 1.1. We found the following work-around: Open the TIFF in Adobe Photoshop, select File menu - Save A Copy, select TIFF, then choose IBM PC format, and overwrite the TIFF file. (ASI is looking into correcting its TIFF files so that they can be transferred directly to the network printer). Prints and monitor displays are rarely the same! This is because different devices have different “Gamma” contrast settings. Professor John MacKenzie (supervisor@emc.ncsu.edu, North Carolina State University, USA) has excellent tips on image printing (he should have a web site but I have not found it yet. I received his Photoshop Tips at both the 1997 Microscopy Society of America meeting and by e-mailing a request to him). For gray scale images, try playing with Gamma in Photoshop [see Photoshop tips], then saving as TIFF, and printing. Check the Internet and books in print for other image analysis books. Un-interruptible Power Supplies (UPS’s): See Printing (above) for note about UPS’s and laser printers. Note that most computer UPS’s have only a small battery reserve (estimated 15 minutes), that may be even shorter if you have a power-hungry computer monitor. The UPS is intended to keep your system running during typical short power outages (seconds). If the building power goes out, please stop any acquisition, shutdown Windows NT, and turn off the devices. A UPS is not guaranteed to protect your electronics if you start an arc lamp. This is because the danger from the arc lamp is an electromagnetic pulse that travels from cable to cable through the air! Never set your arc lamp in “auto” start mode, or you will risk destruction of your electronics when the building power restarts and the arc lamp auto-restarts. For example, if you have an OptiQuip, OptiQuip can retrofit your OptiQuip arc lamp controller to disable the auto-restart feature if you want (OptiQuips’ turn-around time may not be good). Better yet, get an arc lamp from your microscope company that has the starter unit in the lamp, or buy a Sutter Lambda LS 175 W lamp + liquid light guide (LLG). Be sure to get the ozone free 175 W bulb. The LS has the advantage that once you get the liquid light guide installed (especially proper centering at the LLG microscope adapter), the users simply turn on or off the lamp – no daily alignment of the arcs. Changing the bulb takes about two minutes and the bulb housing can be handled without gloves (bulb is rated for 1000 hours, so it will be a while before you need to change it anyway). The LLG also homogenizes (aka scrambles) the light so you won’t see the arc. It is a Xenon lamp, so fluorescein and Texas Red won’t be as bright as a 100 W Hg lamp with Hg-optimized filters. The LS has a heat filter inside (actually a cold mirror) so Cy7 might not work (yes, you want the heat filter). The LLG is rated down to UV for Fura-2 work.