Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
CONTENTS DELETED
The author has deleted this message.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
35 posts
|
Hi Gonzalo,
Are you making sure that the file you open is an RGB image (rather than an 8 or 16 or 32 bit gray image)? On Tue, Jul 31, 2012 at 7:23 PM, Gonzalo Bouchet <[hidden email]>wrote: > Hello! I've downloaded a macro to quantify the are occupied by Sirius Red > staining. When I applied, an error appears: '''Coneverts stack to images' > requieres a stack". I'm just begging to use the ImageJ so I don't > understand > many things! > > Thanks for you help! > > The macro is this: > > // Macro for calculating percentage of fibrose componnent compared to > cardiomyocyte component > // taking into account the lumen part or not. > // > // The colour thresholding algorithm used by this macro is based on an > algorithm written by G. Landini (version v1.8) available at: > // http://www.dentistry.bham.ac.uk/landinig/software/software.html > > // > // Note: This only works with Black background and White foreground! > run("Colors...", "foreground=white background=black selection=yellow"); > run("Options...", "iterations=1 black count=1"); > > // > // All image calculation using logical operators take zero values as zero > and 255 as "one" in the case below > // So inverted luts only change black to white and white to black but zero > stays zero meaning black was zero and after > // inverting the LUT white is now zero. > // Anything measured needs to have value 255 > // So 255 or '1' is the object > > // Creation 17-07-2007 J.A.M. Belien > // Update history: > // Small modifications with respect to version updates: > // - last modification: modified to operate correctly with latest version > 1.43u, dd 19-07-2010 > > var ExclusionImage, OriginalImage, LumenImage, > FibrosisImage,CardioMyocyteImage; > var exclude_high_th,lumen_low_th,fibrosis_high_th; > var totarea_lumen,totarea_fibrosis,totarea_cardio,totarea_exclusion; > var image_name; > > macro 'Assess lumen, fibrosis and cardiomyocyte components' { > > // Required ImageJ version > requires("1.43u"); > > // Initialisation based on emperical analyses of test data set > exclude_high_th=72; > lumen_low_th=240; > fibrosis_high_th=130; > > // Call open() to let user choose which image to open and analyse > open(); > > image_name = File.name; > OriginalImage = getImageID(); > > // Create duplicate and determine if green marked areas can be > detected as > areas to be excluded > run("Duplicate...", "title=exclude_area"); > > // Obtain (possible) exclusion area > ExclusionImage = getImageID(); > selectImage(ExclusionImage); > min=newArray(3); > max=newArray(3); > filter=newArray(3); > a=getTitle(); > run("RGBtoLab "); > run("RGB Stack"); > run("Convert Stack to Images"); > selectWindow("Red"); > rename("0"); > selectWindow("Green"); > rename("1"); > selectWindow("Blue"); > rename("2"); > min[0]=0; > max[0]=255; > filter[0]="pass"; > min[1]=0; > max[1]=exclude_high_th; > filter[1]="pass"; > min[2]=0; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Make Binary", "thresholded remaining"); > if (filter[i]=="stop") { > run("Invert"); > } > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding------------ > run("8-bit"); > run("Fill Holes"); // Detected area inside green demarcated area > has > value 255 > run("Invert"); // So invert (not invert LUT): Needed to exclude > this > area from calculations; > > // Now obtain lumen part from image > selectImage(OriginalImage); > run("Duplicate...", "title=lumen_area"); > LumenImage = getImageID(); > selectImage(LumenImage); > a=getTitle(); > run("RGBtoLab "); > run("RGB Stack"); > run("Convert Stack to Images"); > selectWindow("Red"); > rename("0"); > selectWindow("Green"); > rename("1"); > selectWindow("Blue"); > rename("2"); > min[0]=lumen_low_th; > max[0]=255; > filter[0]="pass"; > min[1]=0; > max[1]=255; > filter[1]="pass"; > min[2]=0; > max[2]=125; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Make Binary", "thresholded remaining"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding------------ > run("8-bit"); > imageCalculator("AND", "lumen_area","exclude_area"); > > //Now obtain fibrosis component > selectImage(OriginalImage); > run("Duplicate...", "title=fibrosis_area"); > FibrosisImage = getImageID(); > selectImage(FibrosisImage); > a=getTitle(); > run("RGBtoLab "); > run("RGB Stack"); > run("Convert Stack to Images"); > selectWindow("Red"); > rename("0"); > selectWindow("Green"); > rename("1"); > selectWindow("Blue"); > rename("2"); > min[0]=0; > max[0]=lumen_low_th-1; > filter[0]="pass"; > //Based on discussion with Noura and Nynke > min[1]=fibrosis_high_th; > max[1]=255; > filter[1]="pass"; > min[2]=0; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Make Binary", "thresholded remaining"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding------------ > run("8-bit"); > > // Obtain the remaining tissue compartments, in this case > cardiomyocytes > selectImage("fibrosis_area"); > run("Duplicate...", "title=cardiomyocytes_area"); > CardioMyocyteImage = getImageID(); > selectImage("fibrosis_area"); > imageCalculator("AND", "fibrosis_area","exclude_area"); > selectImage("cardiomyocytes_area"); > run("Invert"); > // Invert lumen and get rid of lumen in cardiomyocyte image > selectImage("lumen_area"); > run("Invert"); > imageCalculator("AND", "cardiomyocytes_area","lumen_area"); > selectImage("lumen_area"); > run("Invert"); > selectImage("cardiomyocytes_area"); > imageCalculator("AND", "cardiomyocytes_area","exclude_area"); > > // Now estimate percentages and present to user > // Everything with value zero will be measured as object! > run("Set Measurements...", "area limit redirect=None decimal=3"); > // > General settings > // First Exclusion area > selectImage("exclude_area"); > // We need the size of the exclusion part > totarea_exclusion=0; > run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 > show=Nothing clear"); > for (i=0; i<nResults; i++) { > totarea_exclusion = totarea_exclusion+ > getResult("Area",i); > } > // lumen > selectImage("lumen_area"); > run("Invert"); > totarea_lumen=0; > run("Analyze Particles...", "size=0-Infinity > circularity=0.00-1.00 show=Nothing clear"); > for (i=0; i<nResults; i++) { > totarea_lumen = totarea_lumen+ > getResult("Area",i); > } > // Fibrosis > selectImage("fibrosis_area"); > run("Invert"); > totarea_fibrosis=0; > run("Analyze Particles...", "size=0-Infinity > circularity=0.00-1.00 show=Nothing clear"); > for (i=0; i<nResults; i++) { > totarea_fibrosis = totarea_fibrosis+ > getResult("Area",i); > } > // Cardiomyocytes > selectImage("cardiomyocytes_area"); > run("Invert"); > totarea_cardio=0; > run("Analyze Particles...", "size=0-Infinity > circularity=0.00-1.00 show=Nothing clear"); > for (i=0; i<nResults; i++) { > totarea_cardio = totarea_cardio+ > getResult("Area",i); > } > run("Clear Results"); > setResult("Total area excluded (pixels)", 0, > totarea_exclusion); > setResult("Total area Lumen (pixels)", 0, totarea_lumen); > setResult("Total area rest including cardiomyocytes > (pixels)", 0, totarea_cardio); > setResult("Total area fibrosis (pixels)", 0, > totarea_fibrosis); > updateResults(); > selectWindow("Results"); > run("Text..."); // File>Save As> > }// End of macro > > > > -- > View this message in context: > http://imagej.1557.n6.nabble.com/Sirius-Red-staining-Macro-tp4999623.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
CONTENTS DELETED
The author has deleted this message.
|
Free forum by Nabble | Disable Popup Ads | Edit this page |