Login  Register

Re: determining intensity pixel by pixel

Posted by Ben Tupper on Feb 05, 2009; 3:33pm
URL: http://imagej.273.s1.nabble.com/determining-intensity-pixel-by-pixel-tp3693847p3693850.html

On Feb 5, 2009, at 1:00 AM, Runa Hamid wrote:

> Dear Ben,
>
> Thank you very much .  I will try it out !
>
> Will this macro works for ROI of any shape. I have circular ROIs.  
> Do I have
> to code it for circular ROIs?
> I have never worked with macros.
> I have circular
>


Yes, I think it does.  Draw your circle and then run this...

w= getWidth() ; h = getHeight();
getSelectionBounds(xmin, ymin, selwidth, selheight);
run("Create Mask");
m=newArray(w*h);
for(x=0;x<w;x++){
        for(y=0;y<h;y++){
                m[y*w+x]=getPixel(x,y);
        }
}
close(); //close mask
for(x=xmin;(x<=xmin+selwidth);x++){
        for(y=ymin;(y<=ymin+selheight);y++){
                if (m[y*w+x]!=0) print (x,y,getPixel(x,y));
        }
}


Cheers,
Ben









> Regards,
> Runa
>
>
> On Wed, Feb 4, 2009 at 8:05 PM, Ben Tupper  
> <[hidden email]>wrote:
>
>>  On Feb 4, 2009, at 5:03 AM, Runa Hamid wrote:
>>
>> Dear image J users,
>>>
>>> Is it possible to determine intensity pixel by pixel in a selected
>>> circular
>>> ROI in a live sample rather than getting an average intensity of  
>>> that
>>> region . If yes then how?
>>> I am a new user of image J. I would be grateful if anyone of you  
>>> can help
>>> me
>>> with this.
>>>
>>>
>> Hi,
>>
>> There is a nice example of a macro that can do what you are asking.
>>
>> https://list.nih.gov/cgi-bin/wa?A2=ind0608&L=IMAGEJ&D=0&I=-3&P=23793
>>
>> Cheers,
>> Ben
>>