Hi Philippe,
yes, I agree that the problem is in ij.macro.Functions.java. I suspect
it in getArray(), which seems to work correctly only for "Array.*"
functions and newArray, but not for the other arrayFunctions defined in
the MacroConstants.
I think that
array[i] = new Variable(0, 0.0, list[i]);
is fine.
According to the constructor of ij.macro.Variable, this simply creates a
String variable, which becomes one of the elements of the array. The
first '0' should be also ok since a variable that forms part of an array
does not have a name (an entry in the symbol table).
Also, the getList() function where this statement appears is equally
used in the case where the bug appears and where it does not appear.
Michael
________________________________________________________________
On 10.09.24 20:50, CARL Philippe (LBP) wrote:
Hi Christophe,
How are you doing ?
Within the following macro code:
lutB = getList("LUTs");
lutA = Array.concat(lutB, lutB);
lutA = Array.concat(lutB, getList("LUTs"));
lutA = Array.concat(getList("LUTs"), lutB);
Array.show(lutA);
The first line defining lutA is working as the two following ones will be
falling.
So it is the getList("LUTs") that is not well interpreted.
Nevertheless the interpreter is correctly going up to this line:
https://github.com/imagej/ImageJ/blob/master/ij/macro/Functions.java#L4948
I checked this by adding an "IJ.log(array[i]);" just after this line.
But what is returned is thus not interpreted as an array.
In the same time I don't really understand the content of this last reached
line which is:
array[i] = new Variable(0, 0.0, list[i]);
and thus beyond my understanding.
Indeed, why not just return the "IJ.getLuts();" of line 4945?
Kindest regards,
Philippe
Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 41
----- Mail original -----
De: "Christophe Leterrier" <[email protected]>
À: "imagej" <[email protected]>
Envoyé: Mardi 10 Septembre 2024 17:44:48
Objet: Concatenation of arrays in macro code - bug?
Hi,
Consider the following macro code:
lutB = getList("LUTs");
lutC=Array.concat(newArray("Null"),lutB);
Array.show(lutC);
lutA = Array.concat(newArray("Null"), getList("LUTs"));
Array.show(lutA);
The first part runs fine and displays the LUTs with an added "Null"
element. The second part fails with the error message:
Error: Array expected in line 5:
lutA = Array . concat ( newArray ( "Null" ) , <getList> ( "LUTs" ) ) ;
Is this behavior expected or is it a bug?
Thank you,
Christophe
--
Christophe Leterrier
NeuroCyto lab
INP CNRS UMR 7051
Aix Marseille University, France
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html