Changing results labels from ROI measurements

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing results labels from ROI measurements

LyleBabcock
I am trying to write a macro that analyzes muscle fiber cross sectional area and determines fiber type. The fiber areas are identified on one channel based on a membrane stain. This is the window where all ROIs are created. Fiber types are determined by specific fiber-type stains in the other channels. So I have 4 channels: membrane, type I, Type IIa and type IIb.

Determining cross sectional area is easy enough, but in order to determine fiber type I have to overlay each ROI from the membrane channel over each fiber-type channel, measure the grayscale intensity of each ROI, and if the mean intensity if high enough then the fiber qualifies as that particular fiber type and is named accordingly. The membrane stain generates about 100 ROIs in an image, each ROI is a fiber who’s fiber type is determined in the other channels. My end goal is to have a results section that lists each ROI’s fiber type and cross sectional area.

My problem is that I just can’t get the code to work. Below is a section of the macro where I am trying to overlay and measure the mean grayscale intensity on a fiber type channel (MHCI). When I run this code however, all area and grayscale measurements are taken accurately, but nothing is being relabeled. Help!

selectWindow("MHCI")
run("From ROI Manager");
run("Set Measurements...", "area mean display add redirect=None decimal=3");
run("Clear Results");
nCount = roiManager("count");
for (i = 0; i < nCount; i++) {
        roiManager("select", i);
        roiManager("measure");
        Mean = getResult("mean", i);
        if (Mean > 7500) {
        roiManager("select", i);
        roiManager("rename", "I");
        }
}
roiManager("update");

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Changing results labels from ROI measurements

Jeremy Adler
Hi Lyle,

Its a typo,
Look at the Results table, the column heading is "Mean" not "mean"
So Mean = getResult("mean", i); returns NaN because it tries to read from a
Nonexistent column.

Try
Mean = getResult("Mean", i);

Jeremy Adler
BioVis
Uppsala u

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Lyle Babcock
Sent: den 6 augusti 2019 17:05
To: [hidden email]
Subject: Changing results labels from ROI measurements

I am trying to write a macro that analyzes muscle fiber cross sectional area and determines fiber type. The fiber areas are identified on one channel based on a membrane stain. This is the window where all ROIs are created. Fiber types are determined by specific fiber-type stains in the other channels. So I have 4 channels: membrane, type I, Type IIa and type IIb.

Determining cross sectional area is easy enough, but in order to determine fiber type I have to overlay each ROI from the membrane channel over each fiber-type channel, measure the grayscale intensity of each ROI, and if the mean intensity if high enough then the fiber qualifies as that particular fiber type and is named accordingly. The membrane stain generates about 100 ROIs in an image, each ROI is a fiber who’s fiber type is determined in the other channels. My end goal is to have a results section that lists each ROI’s fiber type and cross sectional area.

My problem is that I just can’t get the code to work. Below is a section of the macro where I am trying to overlay and measure the mean grayscale intensity on a fiber type channel (MHCI). When I run this code however, all area and grayscale measurements are taken accurately, but nothing is being relabeled. Help!

selectWindow("MHCI")
run("From ROI Manager");
run("Set Measurements...", "area mean display add redirect=None decimal=3"); run("Clear Results"); nCount = roiManager("count"); for (i = 0; i < nCount; i++) {
roiManager("select", i);
roiManager("measure");
Mean = getResult("mean", i);
if (Mean > 7500) {
roiManager("select", i);
roiManager("rename", "I");
}
}
roiManager("update");

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html