FloatProcessor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FloatProcessor

Dimiter Prodanov
Dear all,

I noticed interesting issue in FloatProcessor.
Somehow  FloatProcessor.getPixels() returns a
empty float[] object, eg 0-filled. I tried the also with
FloatProcessor.getPixel(int x, int y) but the result was the same.

Did anybody notice something like this?  Or shold I use
a bitwise operation to access the values?

best regards


_______________________________________________________________________
Dr Dimiter Prodanov, MD, Ph.D.

Neural Engineering Rehabilitation Laboratory
(Laboratoire de Génie de la Réhabilitation Neurale)
Département de Physiologie et Pharmacologie
Université catholique de Louvain
Avenue Hippocrate, 54
POBox UCL-5446 / B-1200 Bruxelles -Belgique-
Phone: 00-322-764 5596
Fax: 00-322-764 9422

http://www.md.ucl.ac.be/gren
Reply | Threaded
Open this post in threaded view
|

Re: FloatProcessor

dscho
Hi,

On Mon, 2 Oct 2006, Dimiter Prodanov wrote:

> I noticed interesting issue in FloatProcessor.
> Somehow  FloatProcessor.getPixels() returns a empty float[] object, eg
> 0-filled. I tried the also with
> FloatProcessor.getPixel(int x, int y) but the result was the same.

I work with FloatProcessors all the time, since I interpolate images a
lot. No problems here.

Do you have a minimal example of what breaks for you?

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: FloatProcessor

Dimiter Prodanov
In reply to this post by Dimiter Prodanov
Hi wayne, hi Johannes

Plase take a look at this code:

public void erode(FloatProcessor ip) {

         int width = ip.getWidth();
         int height = ip.getHeight();
         float min =imin; //,k=0,x=0,y=0;

         //int sz=pg.length;//se.getWidth()*se.getHeight();

         float[] pixels=(float[])ip.getPixels();

         float[] wnd=new float[2];

         float[] newpix= new float[pixels.length];

         int i,j=0;
         for (int c=0;c<pixels.length;c++) {
              i=c/width;
              j=c%width;
                 IJ.log("pixel "+ip.getPixelValue(i, j));

             wnd=getMinMax(c, width, height, pixels, pg, ERODE);
             min=wnd[0]+imax; //v2 = max - (v1 - min);
             newpix[c]=min;

         }


         System.arraycopy(newpix, 0, pixels, 0, pixels.length);

         }


>I dont see a mistake but may be you'll find it.


best


_______________________________________________________________________
Dr Dimiter Prodanov, MD, Ph.D.

Neural Engineering Rehabilitation Laboratory
(Laboratoire de Génie de la Réhabilitation Neurale)
Département de Physiologie et Pharmacologie
Université catholique de Louvain
Avenue Hippocrate, 54
POBox UCL-5446 / B-1200 Bruxelles -Belgique-
Phone: 00-322-764 5596
Fax: 00-322-764 9422

http://www.md.ucl.ac.be/gren
Reply | Threaded
Open this post in threaded view
|

Re: FloatProcessor

dscho
Hi,

On Thu, 5 Oct 2006, Dimiter Prodanov wrote:

>         System.arraycopy(newpix, 0, pixels, 0, pixels.length);

Why not use FloatProcessor.setPixels()? This could solve your problems,
too.

Ciao,
Dscho