Hi,
When getPixel(x,y) is asked to read a location that is outside the selected 
image it returns the value 0.
While a selection that is outside the image returns NaN - flagging the mistake.

Is there a reason for getPixel returning zeros rather than a NaN or simply 
crashing?

The code below demos the issue

// testing getPixel
print("\\Clear");
selectWindow("Log");
newImage("RAMP", "8-bit ramp", 256, 20, 1);
wdth=getWidth();
for (xpos=wdth-5; xpos < wdth+5; xpos++) {
print("xpos",xpos,"getPixel",getPixel(xpos,10));
run("Specify...", "width=1 height=3 x=xpos y=10");
getRawStatistics(nPixels, mean, min, max, std, histogram);
print("    mean from ROI ",mean);
}

Jeremy
===============================================
                    B i o V i s   P l a t f o r m of  Uppsala University
                   Light & EM microscopy / FlowCytometry & Cell Sorting / Image 
Analysis
===============================================




















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

Reply via email to