Hallo everyone,
I am writing an imageJ macro. I want to recreate a hand-drawn straight line selection, that can easily contain not integer coordinates, as can be seen from this code (if the selection was done at high magnification/zoomed in): --------------------- Roi.getCoordinates(x,y); Array.print(x); Array.print(y); --------------------- When trying to create a selection that contains only integers, everything is fine. But when I try to create a selection that also contains coordinates with decimal numbers with the following code, I get an error: --------------------- newImage("Untitled", "8-bit black", 512, 512, 1); xCoords1 = newArray(200, 400); yCoords1 = newArray(200, 400); xCoords2 = newArray(200.5, 400); //<- this .5 causes the error lateron yCoords2 = newArray(200, 400); makeSelection(5, xCoords1, yCoords1); //5 stands for "straight line" print("everthing fine"); wait(2000); makeSelection(5, xCoords2, yCoords2); --------------------- The error message is the following: ##################### ImageJ 1.50a; Java 1.6.0_20 [64-bit]; Windows 7 6.1; 55MB of 8192MB (<1%) java.lang.NullPointerException at ij.macro.Functions.makeSelection(Functions.java:1972) at ij.macro.Functions.doFunction(Functions.java:142) at ij.macro.Interpreter.doStatement(Interpreter.java:227) at ij.macro.Interpreter.doStatements(Interpreter.java:215) at ij.macro.Interpreter.run(Interpreter.java:112) at ij.macro.Interpreter.run(Interpreter.java:82) at ij.macro.MacroRunner.run(MacroRunner.java:139) at java.lang.Thread.run(Thread.java:619) ###################### Is this a bug, that the coordinates of a selection can have decimal numbers when drawn by hand but not when done programmatically? Or am I missing something here? I have got a second question: Is there a tool/plugin/macro to easily measure the width of some long "worm-like" structure along its way? Thank you in advance for any help, Jochen (PhD student) -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Jul 27, 2015, at 2:04 PM, Jochen Reichel <[hidden email]> wrote:
> > Hallo everyone, > > I am writing an imageJ macro. I want to recreate a hand-drawn straight line selection, that can easily contain not integer coordinates, as can be seen from this code (if the selection was done at high magnification/zoomed in): > --------------------- > Roi.getCoordinates(x,y); > Array.print(x); > Array.print(y); > --------------------- > > > When trying to create a selection that contains only integers, everything is fine. But when I try to create a selection that also contains coordinates with decimal numbers with the following code, I get an error: This bug is fixed in the latest ImageJ daily build (1.50b3). -wayne > --------------------- > newImage("Untitled", "8-bit black", 512, 512, 1); > xCoords1 = newArray(200, 400); > yCoords1 = newArray(200, 400); > xCoords2 = newArray(200.5, 400); //<- this .5 causes the error lateron > yCoords2 = newArray(200, 400); > makeSelection(5, xCoords1, yCoords1); //5 stands for "straight line" > print("everthing fine"); > wait(2000); > makeSelection(5, xCoords2, yCoords2); > --------------------- > > > The error message is the following: > ##################### > ImageJ 1.50a; Java 1.6.0_20 [64-bit]; Windows 7 6.1; 55MB of 8192MB (<1%) > > java.lang.NullPointerException > at ij.macro.Functions.makeSelection(Functions.java:1972) > at ij.macro.Functions.doFunction(Functions.java:142) > at ij.macro.Interpreter.doStatement(Interpreter.java:227) > at ij.macro.Interpreter.doStatements(Interpreter.java:215) > at ij.macro.Interpreter.run(Interpreter.java:112) > at ij.macro.Interpreter.run(Interpreter.java:82) > at ij.macro.MacroRunner.run(MacroRunner.java:139) > at java.lang.Thread.run(Thread.java:619) > ###################### > > Is this a bug, that the coordinates of a selection can have decimal numbers when drawn by hand but not when done programmatically? Or am I missing something here? > > I have got a second question: Is there a tool/plugin/macro to easily measure the width of some long "worm-like" structure along its way? > > Thank you in advance for any help, > Jochen (PhD student) -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Am 27.07.2015 20:52, schrieb Rasband, Wayne (NIH/NIMH) [E]:
> > This bug is fixed in the latest ImageJ daily build (1.50b3). > > -wayne > Thank you very much for the amazingly quick fix! It works fine now. Jochen -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |