ImageJ Basics Tutorial

You might also like

Download as pdf
Download as pdf
You are on page 1of 46
Image J Tutorial -- Basics By Christine Labno University of Chicago Confocal Light Microscopy Facility Table of Contents Opening .TIF or .STK files Adjusting brightness and contrast Adjusting gamma (like Photoshop's “curves”) Subtracting background with rolling ball Subtracting background with BG_Subtraction_from_ROI macro. Applying color to images Merging multiple color channels (not DIC) Merging color channels with DIC Cropping images or image stacks Adding a scale bar Creating time or z-stacks from individual TIFFs (Leica users) Splitting Leica stacks to make color merges, etc. Pulling individual images out of TIFF stacks Maximum intensity projections of a z-stack Creating a 3D projection from a z-stack Creating a movie of a 3D projection (AVI or QuickTime movie) Creating a movie of a time series Opening .TIF or .STK files There are two ways to open TIFF or TIFF stack (.STK) files: 1) Select File > Open and find the file to be opened (as with Photoshop or other software). OR 2) Grab the image icon with the mouse, drag and drop onto the top of the Image J taskbar (blue stripe). Adjusting brightness and contrast 1) Choose Image > Adjust > Brightness/Contrast 2) Anew window will appear with four sliders for brightness and contrast. 2) fi Adjusting brightness and contrast cont. Neeratn Auto| Reset set_|_ Ase To decrease background or haziness, slide the top slider to the right. To increase brightness, slide the second slider to the left. Adjusting either of the bottom two sliders will change the top two sliders accordingly. Your adjusted image will preview in the image window. To start over, click “Reset.” To make changes permanent, click “Apply.” If your images are in a stack, the changes will be applied to all images in the stack unless told “No” after “Apply” Adjusting gamma (curves) value 1-50 [OED ok | cancel Gamma works like the “Curves” function in Photoshop in that it can increase or decrease brightness values in the middle of the image's range. There is no way to preview, so you should make sure your raw data is saved before you make changes. You can use Edit > Undo to step backwards. To increase brightness without pegging out the brightest areas, choose a value <1. To decrease the brightness of background without losing image pixel values, choose a value >1. 1) Subtracting background with a rolling ball File Edit Image ‘Analyze Plugins Window Help alalol~ sno onesies 5 2) Sharpen Find Ege coreahiner Enhance Contrast Noige Shadows Bina Math FFT Fitors mage Caleulatr a Rolling Ball Rauivs: [50 ive Backaroung) ox | caret Pty ty 2 3 l=) 1) Choose Process > Subtract Background A new window will appear with a place for a “rolling ball radius.” The radius of the rolling ball should be less than or equal to the radius of the smallest Object in your image (in microns). DO NOT check the “white background” box unless you want a white background for your image. The rolling ball can be used multiple times on the same image for greater cleaning power. Subtracting background with an ROI 1) Go onto the IMR server (either ADM or SRF-1007 Cummings) and find the ~|lmageJ folder near the beginning of the list 2) Go in the ~ImageJ folder and open the Macros folder. 3) Find the macro called BG_Subtraction_from_ROl. txt. Copy this text file to your desktop. To open it, drag and drop the txt file icon onto the ImageJ toolbar as you would to open an image. Subtracting background with an ROI cont. 4) Use a shape drawing tool to draw a region of interest (ROI) on your image were there are no objects. If you are subtracting background from a stack, make sure there are no objects in this ROI in any plane. 5 Once you have drawn your ROI and checked it for objects, go to the macro window and choose Macros > Run Macro. Entera scaling factor of 3 (default) for the first run. The macro will subtract an ease ee average of the pixel facie snge sce fancy a sy set Se _ intensities in the ROI from ae every pixel in the image or mean standard reared ! stack of images. Adding color to single color images If your images have been saved Lookup Tables > color of choice (here it is Green). Fire, Ice, and Spectrum are “hot’ LUTs; they assign different color values to different pixel intensities and can be fun/informative. Invert LUT flips the order of the colors in a hot LUT. Adding color to single color images cont. j 2) Once you have selected your color LUT, choose Image > Type > RGB Color. This will change the file type so that the color information goes along with the file. Now the file can be opened in color in Photoshop, PowerPoint, Word, etc. Adding color to single color images cont. 16-bit gray RGB color An 8- 12- or 16- bit grayscale with a color LUT is NOT the same as an RGB image! If you do not convert your colorized image to RGB it will not open in color in any other Program (i.e. Photoshop, PowerPoint, etc.). Merging multiple colors (not DIC) Fle cot EERE) Process taayas Pugine Wow He DIQ|a\ nee EE ctowine. Coen stzckto ROS ow spit LUT ati ColorPiker._ctesninek cusenneo seal, cme Folate Zoom 1) Open the images or stacks 2 you wish to merge. These files should all be the same size (in this case 512x512) and the same type (in this case &-bit grayscale). The original images do not need to be in color for this to work, Choose Image > Color > RGB merge. Merging multiple colors (not DIC) cont. 4) =] 3) Anew “RGB merge” window will open. Use the photo Cya.tit =) photo Cy3.tt > pulldown menus to assign [photo FITC. photo FITC.ti 1 an image to each color. photo OAPI =] note DAPI =] Jy Check “Keep source images" to keep the original single color files open. Useful when making montages. 5) Click “OK” and your merged image will appear. Co-localized channels will appear in the correct color (Le. red+green=yellow, red+blue=purple, etc.) This file is automatically an RGB type file and can be saved with File > Save as > TIFF without loss of color. fohoto Cyst Johoto FITC tf None (OK Cancel Merging colors with DIC — 1) Open the images or stacks ri ca mee Pees ae i Seas you wish to merge. These Moco aisait © files should all be the same size (in this case 512x512) and the same type (in this case 8-bit grayscale). The original images do not need to be in color for this to work, 2) Choose Plugins > 0 RGB Stuff > RGB Gray Merge Deatee Desointer Dep coves sae Depoekiwasne ea Tol Peano oom tra coun ae Frastoa cere let vragti0 5) Merging colors with DIC cont. 3) Anew “Gray-RGB Stack 3) Gray Stacke fimage003_cna2 it =) Red tack: fisge003_enoi ¥] Green take age D03_chOt Blue stake faze003_ch02.i A) |r Keep souce stacks 0K | cancel 4 5 merge” window will open. Use the pulldown menus to. assign an image to each color. Check “Keep source images" to keep the original single color files open. Useful when making montages. Click “OK” and your merged image will appear. Co-localized channels will appear in the correct color (ie. red+green=yellow, red+blue=purple, etc.) This file is automatically an RGB type file and can be saved with File > Save as > TIFF without loss of color. Cropping images Image J makes it easy to crop individual images to exactly the same size in exactly the same place. 1) Open the images you wish to crop. 2) Using one of the shape tools, draw a region of interest (ROI) on one of the images. It doesn't matter which image you choose. Cropping images cont. Fle BEDE rome Process Annan Popes. Wow Hao fi re wz L +A) [Qo 3) Click on another image in the group you wish to crop. This image should be blank, with no ROI 4) Choose Edit > Selection > Restore selection. An ROI will _ appear that is the same size and ‘tone . shape and in the same place as the first ROI you drew. 5) Repeat steps 3 and 4 until you have ROls drawn on every image in the group. Cropping images cont. Prpenes., cHanRe 6) When you have an RO! in place on every image, choose Image > Crop. This will crop the current image. Repeat this step for all images in the group. Cropped images can be saved as is, colored and saved as RGB, color merged, etc. like any other TIFF file Open the cropped images in Photoshop or PowerPoint for montage making. Adding a Scale Bar 2/1) Open the image. 4/2) Choose Image > Properties 3) Input the correct pixel (voxel) size information for your image. Pixel size will depend on magnification and zoom. This info is usually found in the “properties” section of the collection software or in the Leica SP2 txt file that comes with the images. Hen channels Slices i [i Frames: [I UnitetLengte [am Paoiwware [O7s227 Poi Feige Voxel Dest Frome interat origin pines) [0.0 F oowat Adding a Scale Bar cont. 4) Once the properties have been adjusted, choose Analyze > Tools > Scale Bar. Adding a Scale Bar cont. seat um Pantene Fon szo color foie =] Backaraurd: [None =] Locaton [Toverreart =] Pole Tea T Hide Tee P setirFont 5) Adjust the width, height (thickness) and other properties of the scale bar. You will be able to preview changes in the image window. ICAUTION — Once you click “OK” the scale bar becomes a permanent part of the image and cannot be erased!! If you want to change something about the bar, you will have to open another copy of the image and start over. Creating a time or z-stack from TIFFs (Leica) Leica stack files are saved as individual .TIFF files, one for each color channel at each z-slice and/or time point. These types of stacks must be imported into Image J in order to be recognized as a stack. This folder contains three stacks: Corn, Dandelion and Pine. We will open the Dandelion stack. Tie Yow favor Tak tp —— Ht > eee Shrtkes GS x | Prt semen brdnac oleh soe bender ez OL rts pron x04 SPletasanen)fanen Oslo aoe Pots son enone AO parece aarp ost Siete fun so st Aare co anh 5 Prtsenmnaraentznl swat Sytetsan .panun sosleteam ‘Rlpatesosen son er M0tt rss bron Ot Pe ssn 9 Denn 7 10.AF ports ses rns SiO re sso ena 9008 presen 3raen_siezui Sete fun so i8 nn seen it Prtisenn3 bratenrct 00 Syletsomm Pan soc sie tcad ‘RYatooon 3 bkon Oe Ante Petsson baton xo.s01eF S¥etssanand fanantic gel RYPote sabe nin HD 10.0F Creating a time or z-stack from TIFFs Raw. tut. ‘Text image. (Leica) cont. 1) Select File > Import > Image sequence and find the file to be opened (as with Photoshop or other software). Creating a time or z-stack from TIFFs (Leica) cont. Per PMenety S}Pants essen Dod mex proved tt Pants session 9_Danion 40> BR rts sessen 2 Dandcn 40x 2000.c008F “Bl ants sessn -Dendlon > Barts seein 9 Doren 40x 3000 c01.eF Pans sen 3 Denton 4; B) Pars sesen9.Daren 40x 3003 crn. Pans sero 9 Deon 4 Pars sessen’ Darien AOx 2001 01.8 Plants seston 9_Dandon 40> Parts sesen 9 Dorion 40x 3002 e100. Pans ses 3 Denton 4 ores sexs Denier 0s 3002 01.2 “A nes sezaen9_Dendon a> Parts sexs Dendicn 0x 2000 c00.F “Bl Pants sesaen 2 Dendlon Bi) rts session 3_Dardiicn 40x 2009_cO1.tF ‘Plants session 9_Danc if Flerame: [Pla seesen 3. Flesofipe: fanfics = 2) Find your file in the appropriate directory (desktop, server, CD, etc.). Click on an image in the series (doesn't matter which image) and copy (Ctr + C) a part of that filename that is common to all images in the sequence. In this example, | have copied “Dandilion 40x_z”. Then click Open. Creating a time or z-stack from TIFFs (Leica) cont. =n» Number otimanes: [208 Staring image: ft Increment: [t File Name Contains: [Pancilion 40) Scalelmages: [100 % TF Convert io 8-0it Grayscale F convertto R6B 912x512 2240 (2240.0MB) oul feasesi| 3) Once you click “Open” a new window titled “Sequence options” will appear. Paste (Ctrl + V) the part of the filename copied in the previous screen into the “File Name Contains” box. The other boxes should not need changing for most applications. 4) There will be a pause while the stack is created. During this pause, the Image J toolbar should show a progress bar like this one, letting you know how many images there are in the stack and how many there are left to open. Creating a time or z-stack from TIFFs (Leica) cont. lolx 5) You should now have a stack window that looks like this on your desktop. This particular stack contains 80 images, and we are currently looking at image 1. This stack can be saved using File > Save as > TIFF and opened with drag-and-drop just like an .STK file, or it can be processed into a 3 color merge image, or a 3D image, etc. with the techniques below. Navigate through the stack with the slider bar at the bottom Creating a time or z-stack from TIFFs (Leica) cont. Common problems with building stacks: + Lonly geta single image or part of a stack, not the whole stack. Check to see that you have copied part of a filename and not the whole thing. For example, if we had selected “Dandilion_200_ch01, we would end up with just that one file because that is the only fle whose image contains all of that. Choose instead Dandilion or Dandilion_z and all the files with that in their names will appear * I get an error message saying the images are the ‘wrong size.” This could mean that a Leica snapshot TIFF was included in the stack. Check to see that you have copied a part of the filename that is unique to the stack and is not found in the names of other images. For example, if| had a snapshot from my imaging session titled Dandilion_snapshot, and a stack titled Dandilion_stack, choosing “Dandilion” as my file name contains would bring up the snapshot as well as the stack images. I would be better off choosing “Dandilion_stack? + The images in my stack are out of order. This happens frequently with FRAP and FRET data collected with the built-in Leica SP2 applications. This is because Image J will stack images in exactly the order they appear in the folder, i. alpha numeric order by filename (A1, A2, B1, B2). When the Leica software saves FRAP or FRET data, each sequence is given a name, such as “Bleaching” or “Pre-bleach.” Since “Bleaching” comes before “Prebleach’ in the alphabet, “Bleaching” is first in the folder and “Bleaching” gets put first by Image J. The easiest way around this is to rename your files so they show up in the correct order. For example, you could call the stacks “Before bleaching” “During bleaching’ “Recovery_1” *Recovery_2”. You can do this before saving them in Leica or with “rename’ after your session. Creating a time or z-stack from TIFFs (Leica) cont. Common problems with building stacks continued: + My stack contains lots of images that | co not want as part of the stack. Check to see that you have copied a part of the filename that is unique to the stack and is not found in the names of other images. For example, if | had another stack from my imaging session titled Pine stem_stack, and a stack titled Dandilion_stack, choosing “stack” as my file name contains would bring up Pine stem images as well as Dandelion images. | would be better off choosing “Dandilion_stack.” + My stack contains just a few images that | do not want as part of the stack. There are a couple of ways around this. You can delete individual images from a stack by going to the image to be deleted and selecting Image > Stacks > Delete slice. IF there are many slices that are all in one block, you can also use Plugins > OStacks > substack maker and input a range of slices for only the images you want to keep (10-30 for example). You can find the number for each image in a stack in the upper lefthand comer of the stack window. Splitting stacks into single color channels j] Image stacks come with jaa aes | all the colors together tae "1 in one file. In order to ce make color merges, you ee must first split the stack into one stack per color. ; 1) Open or import the cent stack. sams oN 2) For Leica SP2 stacks choose Plugins > 0 Stacks > Hypervolume shuffier. For other aa = stacks, skip to step 6. see tne , 3) Anew “Hypervolume , shuffler” window will appear. Use the pulldown menu to select “unshuffle. Splitting stacks into single color channels youre gore [EF 4) Anew “Unshuffle hypervolume” window will appear. For volume depth, enter the number of color channels in the stack. For example, a stack with blue, green, red and DIC images would have 4 channels and a volume depth of 4. In this case we have red and DIC, so 2 channels. Anew image window will appear that is titled “unshuffied image name.” All of the images of one color will be grouped together. Splitting stacks into single color channels cee 6) If you have MetaMorph or Huss ra Fluoview stacks, or unshuffled Leica SP2 stacks, Choose Plugins > 0 Stacks > Stack Splitter. 7) A new window will appear asking for a number of substacks. This will be the number of colors in your stack. For example, DAPI, FITC, TexRed, DIC is 4 colors. Input this number and click “OK.” ) = ~ Number of substacks (disor of 80): [2 Splitting stacks into single color channels ie =] New image windows Will appear, one for each color in your stack. You can save these individual stacks (File\> Save as > .TIF) or you can color them or merge them as you would a single image. Channel information is in the header of each image. Pulling individual images out of TIFF stacks et Clare ses =a] There are two ways to pull an individual image out of a stack. 1) For smaller stacks, you can choose Image > Stacks > Convert stack to images and then just save the image you want as a TIFF. 2) For larger stacks like this one, find the number of the image you are looking to split out, in this case 1 Then choose Plugins > OStacks > substack maker and input that number ("1") as your substack. Yes, it’s ok that it is only one image. Maximum intensity projections from z-stacks —— A maximum intensity projection collapses all of the planes in a z-stack into one. projecting the brightest voxel from each point in the stack. This can be useful when imaging structures that cover many z-planes (i.e. neuronal processes) 1) Open the stack you wish to make the projection of, either by dragging and and dropping (Meta Morph Fluoview) or importing (Leica) » Choose Image > Stacks > Z Project. Maximum intensity projections from z-stacks cont. 3) Change the projection type to Max intensity using the pulldown menu. Start slice and stop slice will be set automatically to contain the whole stack. b E Maximum intensity projections from z-stacks cont. 4) Anew image window will appear with the maximum intensity projection. This image can be saved and worked with like any single plane TIFF file. Making a 3D image from a z-stack = Another option for displaying 3D (xyz) data is to make a 3D projection of the object. This allows the image to be rotated and viewed from different angles. It is also the best way to get a sense of the depth of an object. 1) Open the z-stack you wish to make the projection of, either by dragging and and dropping (Meta Morph Fluoview) or importing (Leica). Xs Set the image properties under Image > Properties, otherwise slice spacing of your image will be off. Making a 3D image from a z-stack cont. Height Shannte: Slices @): [20 Frames ¢ Unitof Lena Poot wat Pinel Height: \orel Der Frame Itena: ttn (aust: F ctobat ok | cance! Lalni=| 3) Change the unit of length to um (microns) and input the correct values for pixel (voxel) width, height and depth Pixel size will vary depending on objective magnification, zoom, and z-slice step size. This information can be found in the “Properties” section of the image collection software (MetaMorph, etc.), or in the txt file that comes along with Leica SP2 files. Making a 3D image from a z-stack cont. 4) Once the image properties are properly set, go to Image > Stacks > 3D Project Projection Met pois ot oxaton: Slee Spacing ur Inia anale (368 cearees: “ola! Rotation (0-259 degrees) Rotation Analo nsromont Lower Transparency Bound! Upper Transparency Bounds pees (0-100 Suace Depih-Cueing (0-100). trsonor Dopmn- cueing (0-100% F interpolate = fe Ee i fF foo — 5 6 Making a 3D image from a z-stack \ like to set projection method to brightest point. You can rotate around whichever axis you like best (in this case the y-axis). The initial angle sets the beginning angle (default is 0, straight on) and total rotation sets how far the image will turn (default is 360, one full rotation). The rotation angle increment sets how many degrees the image will rotate between frames, Checking the interpolate box will fillin gaps between slices, but will also slow down the stack making, so get a projection you like and then re-make it with the box checked. Making a 3D image from a z-stack Image J will build the 3D projection for your image and display it in a window like this. This image can be saved and re-opened like a TIFF stack (File > Save as > TIFF). The object can be rotated using the slider at the bottom of the image. This rotation can also be animated and displayed as a movie (see the following slides). Making a movie of a 3D F Loop Backand Forth 7 statanimaton projection Once you have created a 3D projection of your image, you can animate the rotation and save it as a Windows Media Player (PC) or QuickTime (Mac) movie. 1) Choose Image > Stacks > Animation options 2) Anew window will appear. Enter the speed in frames per second (fps) here. The larger the number, the Making a movie of a 3D projection 3) PC users save movies by choosing File > Save As > AVI Mac users save movies by choosing File > Save As > QuickTime Movie. Making a movie of a 3D projection cont. Now you have a movie that can be shown with Windows Media Player (PCs) or QuickTime (Macs) or inserted into a PowerPoint presentation and played from there. Double click on the movie to the right to play the animation. Making a movie from a time series Making a movie from a time series is the same procedure as making a movie from a z-stack, so see the instructions above. You probably will not want to check the “loop back and forth” box in step 2. If this box is checked, your movie will run forwards and then backwards.

You might also like