Re: Getting coordinates inside a ROI

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Getting-coordinates-inside-a-ROI-tp5003250p5003332.html

Hi Peter,

if you have a Point[100000] array, it's 100000+1 objects, the array and 100000 Point objects.
If you have an int[2][100000], that's three objects: An int[][], which contains two 1-dimensional arrays. Each of these two arrays contains 100000 numbers, but the numbers are so-called primitives, no objects.

By the way, there is also a significant difference of memory allocation: Two integer numbers need 8 bytes, but a Point object more than twice as much.

Michael
________________________________________________________________
On Jun 10, 2013, at 20:25, Peter Mc wrote:

> Thanks Michael;
>
> I did not know how the mask works,now I can understand what you both said.
> Now I can allocate the right space for the points avoiding null points
> inside the array,about using a Point[] or int[][]... I am not sure how the
> Garbage Collector performs in Java,is there a big difference getting rid of
> a Point[] or int[][] when as in this case are both "full" (without null or 0
> elements)?finally both are objects with a similar memory allocate by the new
> operator,aren't they? and what about the former case (with null elements)?
> Anyway these couple of questions are just for curiosity but I would like to
> know,haha.
>
> Thank you again for your answer ,your advice has been really useful.
>

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