23
Aug
Well, first of first, read the following introduction carefully
http://rsbweb.nih.gov/ij/developer/macro/macros.html (google cache)
There is a workshop going on right now. I sit through half of it and realized that all I need to know is what functions she used (Macros.zip). Because, I use ImageJ macro a lot (one example).
Here are my notes from her code.
- ImageJ 2 is coming, combined effect of BioFormat, Fiji, ImageJ
- in macro window, highlight the rows then command+r / ctrl+r will only execute part of the code, perfect for debugging
- start from recording your own macro (menu: macro - record), and understand its code
- nSlices for the slice number of an image stack (z stack or time lapse)
-
exist1 = File.isDirectory(pathToSaveTo + "max"); if (exist1 != 1) { File.makeDirectory(pathToSaveTo + "max"); } -
for (i = 1; i <= n; i ++) { // looping code} -
for (n = 1; n <= nSlices; n ++){ setSlice(n); // go to slice n run("Measure"); } -
for (n = 1; n <= nSlices; n ++) { setSlice(n); getStatistics(area, mean, min, max, stdev); if (mean > maxMean) { maxMean = mean; //if it is larger than maxMean, then mark this slice as the new maxMean frameToDup = n; } } -
orig = getImageID; newImage("cropped", "16-bit Black", 300, 300, nSlices); final = getImageID; setBatchMode(true); for (n = 1; n <= nSlices; n ++) { selectImage(orig); setSlice(n); run("Copy"); selectImage(final); setSlice(n); run("Paste"); } setBatchMode(false); //find the frame with the maximum intensity, go to that frame and reset brightness/contrast maxmax =0; setBatchMode(true); for (n = 1; n <= nSlices; n ++) { setSlice(n); getStatistics(area, mean, min, max); if (max > maxmax) { maxmax = max; nofmax = n; } } setBatchMode(false); // now go to slice with the maxmax and use that to reset intensities in the stack setSlice(nofmax); run("Brightness/Contrast..."); resetMinAndMax(); //convert the new stack into 8-bit, which is required for 3D volume projection selectImage(final); run("8-bit"); //run the 3D projection viewer. Do a "record macro" to get your settings right. Make sure to enter the appropriate xy to z pixel ratio //for example, 200nm steps with 61nm/pixel in x,y is a ratio of 3.28 run("3D Project...", "projection=[Brightest Point] axis=Y-Axis slice=3.28 initial=0 total=360 rotation=9 lower=1 upper=255 opacity=0 surface=100 interior=50 interpolate"); - resetMinAndMax(), With 16-bit and 32-bit images, resets the minimum and maximum displayed pixel values (display range) to be the same as the current image's minimum and maximum pixel values. With 8-bit images, sets the display range to 0-255. With RGB images, does nothing. I usually do "Enhance Contrast", which actually will have over-expose problem, not ideal. I need to check for a 0-1000 range 16-bit image, what's the final 8-bit value will be using resetMinAndMax() - 8bit, or using "Enhance Contrast" - 8 bit
Now, you are ready to dig deeper - familiar with all built-in macro functions and use them!
- 作者:cail
- 版权声明:署名-非商业性使用-禁止演绎 CC BY-NC-ND 3.0
- 原文网址:http://en.dogeno.us/?p=7728
- 最后修改时间:2011年8月23日 15:42 PDT
Previous:
Weekly Tweets for 2011-08-22
Next:
US Permanent Resident (green card) application examples
2 Responses to “Use ImageJ macro to facilitate and automate image processing”
Leave a Reply
blog by cail
- » the Paper Link - my latest Creation for PubMed users
- » How to use ImageJ to analyze images?
- » 2shRNA - design oligos for RNAi
- » Play background music
- » about this blog
- » about me
New in 'Experiment'
- 饶毅文《科研经费申请不能有偿代写》之补充说明
- Haploid stem cells fertilize oocytes to generate live mice
- How to use ImageJ to quantify fluorescent distribution?
- Two fluorescence protein from Atsushi Miyawaki group
- Use ImageJ macro to facilitate and automate image processing
- Spot detection from noise images: averaging, filtering, fitting
- Batch extract PubMed ID from EndNote database, and else...
Hot in 'Experiment'
- zz: Human egg makes accidental debut on camera - 15,263 views
- synchronize cell cycle in culture - 13,901 views
- Finding another transcription factor that regulates metastasis in mice using orthotopic animal model - 10,623 views
- Caution: Cre recombinase can be overtly toxic to mammalian cells - 9,145 views
- A Comeback, lentiviral-mediated gene therapy corrected ALD defect in hematopoietic stem cells and provide clinical benefits - 8,230 views
Hot in 'How-To'
- analog - analog/digital - digital, VGA - DVI - HDMI - 74,652 views
- Ez-12 windsurfer antenna - 54,068 views
- Import custom ringtones to iPhone via iTunes (no jailbreaking required) - 47,113 views
- How to add new ringtones to iPhone - 42,519 views
- Use GParted to align partitions on a SSD hard drive for better performance - 41,027 views
put your ads here? contact me

resetMinAndMax() is a better choice than enhance contrast
in another word, direct run("8-bit") is OK, because the scaling is adjusted according to the min and max pixel intensity of an image