Dear all,
I am struggling to extract individual pixel values from a selection or area of interest. I have tried to save the image as a text file, but it is very hard working to find and collect the pixels I am interested in. I have also tried to extract the histogram values from the option "list" however, it put several pixels with in a bin range and I want to extract every single individual value. Do you know any way to do this? Many thanks in advance :) -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Mirko,
the following macro should do what you need: //------------------------------------------------ Roi.getBounds(rx, ry, width, height); row = 0; for(y=ry; y<ry+height; y++) { for(x=rx; x<rx+width; x++) { if(Roi.contains(x, y)==1) { setResult("X", row, x); setResult("Y", row, y); setResult("Value", row, getPixel(x, y)); row++; } } } //------------------------------------------------ Hope this helps, Jan 2018-02-16 13:03 GMT+01:00 zherxes <[hidden email]>: > Dear all, > > I am struggling to extract individual pixel values from a selection or area > of interest. I have tried to save the image as a text file, but it is very > hard working to find and collect the pixels I am interested in. I have also > tried to extract the histogram values from the option "list" however, it > put > several pixels with in a bin range and I want to extract every single > individual value. > > Do you know any way to do this? > > Many thanks in advance > :) > > > > -- > Sent from: http://imagej.1557.x6.nabble.com/ > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- CEO: Dr. Jan Brocher phone: +49 (0)176 705 746 81 e-mail: [hidden email] info: [hidden email] inquiries: [hidden email] web: www.biovoxxel.de -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I love you!
This worked like a charm :) Many many thanks Jan! -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Be aware that actually the output is not perfectly exact because you can
draw ROIs similar to vector graphics partially independent of the pixels representing squares. thus, when you measure the area of your ROI it will not reflect exactly the measured number of pixel values by the macro. This depends on if IJ considers a respective pixel still inside or already outside the ROI. Please consider that because of this accuracy is not perfect in this analysis. Regards, Jan 2018-02-16 16:26 GMT+01:00 zherxes <[hidden email]>: > I love you! > > This worked like a charm :) > > Many many thanks Jan! > > > > -- > Sent from: http://imagej.1557.x6.nabble.com/ > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- CEO: Dr. Jan Brocher phone: +49 (0)176 705 746 81 e-mail: [hidden email] info: [hidden email] inquiries: [hidden email] web: www.biovoxxel.de -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by zherxes
Hi Mirko,
I didn't remember the function Herbie mentioned. This is the better option, because it will not skip pixels dependent on the relative position towards the selection line. regards, Jan 2018-02-16 13:03 GMT+01:00 zherxes <[hidden email]>: > Dear all, > > I am struggling to extract individual pixel values from a selection or area > of interest. I have tried to save the image as a text file, but it is very > hard working to find and collect the pixels I am interested in. I have also > tried to extract the histogram values from the option "list" however, it > put > several pixels with in a bin range and I want to extract every single > individual value. > > Do you know any way to do this? > > Many thanks in advance > :) > > > > -- > Sent from: http://imagej.1557.x6.nabble.com/ > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- CEO: Dr. Jan Brocher phone: +49 (0)176 705 746 81 e-mail: [hidden email] info: [hidden email] inquiries: [hidden email] web: www.biovoxxel.de -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by zherxes
Good day Mirko,
"Analyze >> Tools >> Save XY Coordinates..." does what you want. Regards Herbie ::::::::::::::::::::::::::::::::::::: Am 16.02.18 um 13:03 schrieb zherxes: > Dear all, > > I am struggling to extract individual pixel values from a selection or area > of interest. I have tried to save the image as a text file, but it is very > hard working to find and collect the pixels I am interested in. I have also > tried to extract the histogram values from the option "list" however, it put > several pixels with in a bin range and I want to extract every single > individual value. > > Do you know any way to do this? > > Many thanks in advance > :) -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by gankaku
Hi Jan!
Yes I realized that is taking some background pixels. However the macro was very comfortable since I have many RIOs to go through the same picture in about 120 pictures. Because the background pixel values are so different than the ones inside the RIOs, it was easy to filter them out. Nonetheless Herbie's solution worked nicely too! Many thanks again. -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Herbie
Hi Herbie!
Yes indeed it does exactly what I need :) Thanks you very much! -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |