THE ANSWER to: How to .setPixel(int,int)
Wayne M Barnes <wayne <at> ETAQ.COM>
2005-01-02 23:21:39 GMT
Dear Duane, Wayne R., Mike and Jason,
I got it. Here is the answer to my problem, how
to make Cell_counter.java work faster than "Fill" "Slice".
It uses some respelled and relocated advice frome Wayne R.
1. Put the line
// at the beginning of the plugin, before
//any methods (like right after "ImagePlus img2;", to make it global.
2. In the 'run' section, remove "ImageProcessor" from the line
ImageProcessor ip = imp1.getProcessor;
// so 'ip' is the global one.
3. To put a pixel during some method, use a line like:
ip.putPixel(ix,iy,red<<16 | green <<8 | blue);
// This works very fast, even in a loop that does 10,000 pixels.
4. To see the new pixel(s)
I'll submit the complete faster version soon.
- Wayne M. Barnes
> At "the beginning of the plugin" I already have a line in my 'run'
> ImageProcessor ip = imp1.getProcessor();