Login  Register

Possible bug - Creating PolygonROI modifies values in float array

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Possible bug - Creating PolygonROI modifies values in float array

C Heeney
13 posts
I'm using ImageJ 1.47t  (under Fiji)

I create a PolygonROI in java using the following command

    PolygonRoi pr = new PolygonRoi(xt, yt, 4, Roi.POLYGON);

Where xt and yt are arrays of float values.
I'm using float to support possible decimal values, although in testing I actually have integer values.
The values contained in these arrays are based on calculation:

    xt[0] = FirstArray[0] + SecondArray[0] + SomeIntegerValue;


If I report the values in the arrays (xt and yt)  before I create the polygon, I can see the values that I expect.

If I report the values in those arrays AFTER I create the polygon (using the line above), they appear to have been modified. The "new" values appear to be the relative distance to the (leftmost, topmost) corner of the bounding rectangle.


If I rewrite the code so that everything is of type "int", then the values before and after creating the polygon are as expected.

Is this intentional?


Thanks in advance
C Heeney

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Possible bug - Creating PolygonROI modifies values in float array

Rasband, Wayne (NIH/NIMH) [E]
1064 posts
On Jun 14, 2013, at 12:17 PM, C Heeney wrote:

> I'm using ImageJ 1.47t  (under Fiji)
>
> I create a PolygonROI in java using the following command
>
>    PolygonRoi pr = new PolygonRoi(xt, yt, 4, Roi.POLYGON);
>
> Where xt and yt are arrays of float values.
> I'm using float to support possible decimal values, although in testing I actually have integer values.
> The values contained in these arrays are based on calculation:
>
>    xt[0] = FirstArray[0] + SecondArray[0] + SomeIntegerValue;
>
>
> If I report the values in the arrays (xt and yt)  before I create the polygon, I can see the values that I expect.
>
> If I report the values in those arrays AFTER I create the polygon (using the line above), they appear to have been modified. The "new" values appear to be the relative distance to the (leftmost, topmost) corner of the bounding rectangle.
>
>
> If I rewrite the code so that everything is of type "int", then the values before and after creating the polygon are as expected.
>
> Is this intentional?

This is a bug that is fixed in the ImageJ 1.47u daily build.

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html