Gabriel,
Thanks, I reread the getPixels documentation in B&B. getPixels returns a
reference, not a copy. To many years using Matlab, I guess.
David Webster
On Sat, Apr 4, 2009 at 1:03 AM, Gabriel Landini <
[hidden email]>wrote:
> On Saturday 04 April 2009, David William Webster wrote:
> > I have a question about how ImageJ/Java passes computational results out
> > of a method. For example, the GaussianBlur class contains the void method
> > blurFloat with an argument ImageProcessor ip. In this method, the pixels
> > values in ip are copied into a float array using (float[]) pixels =
> (float
> > []) ip.getPixels(). The array pixels is then used in subsequent
> > computations. But, I don t see how the final results are communicated
> back
> > to ip as there is no ip.setPixels() in this method. I see this many
> places
> > and know its some sort of OOP thing, but I can t figure it out. Can
> > someone tell me how ip gets the updated pixel values.
>
> I think (please correct if I am wrong) that by getting the pixels into an
> array with ip.getPixels(), you are accessing the image processor directly,
> so
> if you change the array, you are effectively changing the image pixels.
> No need to update the processor, but you might have to update the ImagePlus
> being shown with imp.updateAndDraw() at the end of the processing.
>
> Cheers,
>
> G.
>