From 5c08213bd087cc849023e0e1096698516fa6784e Mon Sep 17 00:00:00 2001 From: "Shao-Chun, Peggy, Hsu" <67047201+peggyscshu@users.noreply.github.com> Date: Wed, 25 Nov 2020 18:00:03 +0800 Subject: [PATCH] Add files via upload --- Batch assy in oil red.ijm | 140 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 Batch assy in oil red.ijm diff --git a/Batch assy in oil red.ijm b/Batch assy in oil red.ijm new file mode 100644 index 0000000..9289a19 --- /dev/null +++ b/Batch assy in oil red.ijm @@ -0,0 +1,140 @@ +//Set Batch + dir = getDirectory("Choose a Directory "); + Table.create("Oil red analysis"); + setBatchMode(true); + count = 0; + countFiles(dir); + n = 0; + processFiles(dir); + + function countFiles(dir) { + list = getFileList(dir); + for (i=0; i1){ + c = n-4; // c = AP no + nmean = n-4; // where the mean value locates + a = getResult("Area",nmean); + b = getResult("IntDen", nmean); + OrAreaSum = a * c; + OrIntSum = b *c; + } + else{ + a = getResult("Area",0); + b = getResult("IntDen",0); + OrAreaSum = a; + OrIntSum = b; + } + + /* + print("APno " + c); + print("APno + statistics " + n); + print("mean index " + nmean); + print("OrAreaMean " + a); + print("OrIntDenMean " + b); + print("OrAreaSum " + OrAreaSum); + print("OrIntDenSum " + OrIntSum); + */ + roiManager("Save", dir2+File.separator+"oilred.zip"); + roiManager("Delete"); + selectWindow("Oil red"); + close(); + run("Clear Results"); + //Measure tissue area + selectWindow("Tissue"); + run("8-bit"); + setThreshold(0, 237); + run("Analyze Particles...", "display summarize add"); + run("Summarize"); + n = nResults(); // n = AP no + 4 statistics + if (n>1) { + c = n-4; // c = AP no + nmean = n-4; // where the mean value locates + d = getResult("Area",nmean); + TsAreaSum = d * c; + } + else{ + TsAreaSum = getResult("Area",0); + } + /* + print("APno " + c); + print("APno + statistics " + n); + print("mean index " + nmean); + print("TsAreaMean " + d); + print("TsAreaSum " + TsAreaSum); + */ + roiManager("Save", dir2+File.separator+"tissue.zip"); + roiManager("Delete"); + selectWindow("Tissue"); + close(); + run("Clear Results"); + //Give result + OrPerTs=OrAreaSum*100/TsAreaSum; + //print(tifName + ";" + OrPerTs+ ";" + OrIntSum); + selectWindow("Oil red analysis"); + Table.set("File Name", i, tifName); + Table.set("Oil red in Tissue area (%)", i, OrPerTs); + Table.set("Oil red intensity sum", i, OrIntSum); + } + \ No newline at end of file