Hi,
Is there a way to recover the x-y coordinates of JUST the anchor points on a segmented line? When I do "save as ... xy" I get tons of xy data. But I need only the anchor points (sorry if that is the wrong word - I mean the places where I clicked to define the segments). I tried to search for this but "segmentation" dominates the results. Hoping somone can point me to a useful plugin/macro for this. Thanks, Tobias -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 Hi Tobias, in a macro you can do it with: Roi.getSplineAnchors(xx, yy); Array.print(xx); Array.print(yy); Volker Tobias Baskin: > Hi, Is there a way to recover the x-y coordinates of JUST the > anchor points on a segmented line? When I do "save as ... xy" I get > tons of xy data. But I need only the anchor points (sorry if that > is the wrong word - I mean the places where I clicked to define > the segments). I tried to search for this but "segmentation" > dominates the results. Hoping somone can point me to a useful > plugin/macro for this. Thanks, Tobias > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJVHRO1AAoJENcVU956o58Nts0H/0nXCrXRVpFesxMGh7XKqqQr hYz4bSVcjit5JabsEHAiB9UiOfXjR/sQHXD7fxOQ2KyvMVw1cFtP7wdYvTrbTLjf jENzSWfFF3NONNA2CjH39IcEUtrJhJnSOifdOuw3kdYgh4Edq1CjdNYVzNRqOjGa amzNbsMiXtJI59olrxYzRPajkMkQfD7aTxIMPwYrhl5DMai4YUze7ufWQPtFJPTK +dtv7PvLbpL65pWa1OvqRdlaVYnmaXbp+ZLOMWK2Ql5PtcF/Vh6UZbBx7x/5hsuK teFCegklngKBGJbCUD0HEA5DBiXh61AW7gaX7Zr31UjT4NRTxZ6C5Traw+auFhE= =EKse -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Tobias Baskin
Volker,
Thank you. I just tried it and got an error: unrecognized roi function. I simply cut and pasted what you wrote into a new macro and installed it (I didn't 'compile it). I am running version 1. 49m. Sorry I am quite an ImageJ novice, maybe there is something obvious to make the macro you wrote work? Thanks again! Tobias -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 Hello Tobias, yes you are right, you need at least version 1.49p. It is macro code, not a plugin so there is nothing to compile. You can just copy the code and paste it into ImageJ. It should be opened in a macro editor where you can run it from the menu Macros>Run Macro. Volker Tobias Baskin: > Volker, Thank you. I just tried it and got an error: unrecognized > roi function. I simply cut and pasted what you wrote into a new > macro and installed it (I didn't 'compile it). I am running version > 1. 49m. Sorry I am quite an ImageJ novice, maybe there is something > obvious to make the macro you wrote work? Thanks again! Tobias > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJVHSNBAAoJENcVU956o58NItkH+gMjo7wAAtE2zgC1I3VfmZ6c YW0sVYT/Odm6Rvz90fALrZVG0PlwPt8zshZRb7eQAqvniwiQSrBxJ9eAF4lWosP0 y88xeNOKHD3tugQ6LU3DQXRL6KLiJ6lnRxfJ/33vvsQRytadElaJkAFy0GaLZPH8 DJO75oDqvr8sL/ujehzi0DnLCfoFi0hDCqWwvfvkGr1ZNI9x4qH1awaIgN0RH99i QrK+X0/hwYttdAotrXx6Lgk+RyTs9lr7fezdiwEdLdVZe0LnYOykt8lzpQbe61fp Kbjf+JEXwZ5yBgJF3DV9G5/zFiIRaQhqhiSu71PpxHvxRvSvQfTdYUQqURpWTbU= =4K4T -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 In fact, I made it to complicated. Roi.getCoordinates(xx, yy); Array.print(xx); Array.print(yy); should work as well even with older versions of ImageJ. Volker Volker Baecker: > Hello Tobias, yes you are right, you need at least version 1.49p. > It is macro code, not a plugin so there is nothing to compile. You > can just copy the code and paste it into ImageJ. It should be > opened in a macro editor where you can run it from the menu > Macros>Run Macro. Volker > > Tobias Baskin: >> Volker, Thank you. I just tried it and got an error: >> unrecognized roi function. I simply cut and pasted what you wrote >> into a new macro and installed it (I didn't 'compile it). I am >> running version 1. 49m. Sorry I am quite an ImageJ novice, maybe >> there is something obvious to make the macro you wrote work? >> Thanks again! Tobias > >> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJVHSQPAAoJENcVU956o58NVGQH/24ceAFjRjVH+zLoSZwS4P2O JNtO+aiUpFEB0DLsKy6xeYar28x85QcogaxyyjFrbLGtt3nGvBOzqMQaOerDYIYI hlzrIKThnn94p2AXWyhNRoposjbXqcYllKGncNkwscLaNPjg9/NkjHSE87sGo41f 3Mmi300LEYclf9MY54sloHm4MAgOvydxy942JKcdRCPTuhaklxGA5LFWhQnSVhqA kPzI85cwO2E8Kij8uIwIH6kdAmIunOlvBvv7Z3ejk0OMzyeg3WN6PnGOpZ/bgd2g r/11CZ/3838Mqy/dkTtYFepwxowKOUtLtmsBES7cP05TYqJTq98Lc15zf4ZZSGg= =KqKB -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Tobias Baskin
Volker,
Thank you again. I downloaded the latest version and now the ROI.getSplineAnchors runs. Yay! (in the latest version, the ROI.getCoordinates returns points every pixel, not just the anchors). But it happens that the software that I feed the coordinates into needs the y-axis coordinate inverted, and the returned y-values are not inverted. I have the 'invert Y coordinate' checked in the set measurements options but I suppose that the ROI command is not a measure command and hence oblivious to that. Is there a command to add to the macro that will invert the y values? Also, is there syntax to have the data come out as x y, x y, x y, rather than x x x, y y y? That would be quite helpful. I totally appreciate your time here! Many thanks, Tobias -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 Tobias does the macro below do what you want? Roi.getSplineAnchors(xx, yy); height = getHeight(); print("\\Clear"); result = ""; for(i=0; i<xx.length; i++) { result += "" + xx[i] + " " + (height - yy[i]); if (i<xx.length - 1) result += ", "; } print(result); Volker Tobias Baskin: > Volker, Thank you again. I downloaded the latest version and now > the ROI.getSplineAnchors runs. Yay! (in the latest version, the > ROI.getCoordinates returns points every pixel, not just the > anchors). But it happens that the software that I feed the > coordinates into needs the y-axis coordinate inverted, and the > returned y-values are not inverted. I have the 'invert Y > coordinate' checked in the set measurements options but I suppose > that the ROI command is not a measure command and hence oblivious > to that. Is there a command to add to the macro that will invert > the y values? Also, is there syntax to have the data come out as x > y, x y, x y, rather than x x x, y y y? That would be quite helpful. > I totally appreciate your time here! Many thanks, Tobias > > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJVHTEeAAoJENcVU956o58NuvIH/1uwNMmyQymbGKczfbqmALM/ DPIhbQJY2Wb509OVCQ3+dO5PtqOGVx50X8pJDzN4S9dEo4NFXE7g5rvQx4dmXpCY mcwHYYlM4bZ5b/a2xqUssUp2XKrBiLLZ5DcboxlJqmgiaYgzabZEloFX3SDBImxV /5g6vHJBcu4qu9tPmocNOsEUzQNp2v9t1LDJAOY5WLL9/vpgq0FDHHxvEV59FIZE S3XyWD3z5/MFuetFXfZi3enNwWEFyfeFNFaUqiC1d4p43V7zxty8wpzVOHyw++ea UxLDjbUxekSunqpjbtyDk2YVu5FMmU3AVExSjn/syMqyRbHkGcT+Q/Ilr4QYL9U= =FZsh -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Tobias Baskin
Volker,
Perfect! Wow! I cannot even pretend to understand the syntax of that do loop. But it certainly works. This will save me a bunch of time (I have been writing down those points by hand!). I am tremendously grateful. As ever, Tobias -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 It's really not as complicated as it looks. for(i=0; i<xx.length; i++) { result += "" + xx[i] + " " + (height - yy[i]); if (i<xx.length - 1) result += ", "; } In the for-loop the index i will run from 0 to length of the array xx minus one. In each iteration the two coordinate values x and y are added to the result string. The value of y is inverted by subtracting it from the height of the image. In each iteration except the last a comma is added to the result string. Note that "result +=" is short for "result = result + " <shameless self-advertisement> If you want to know more about ImageJ macro programming you can have a look at my workshop at: http://dev.mri.cnrs.fr/projects/imagej-macros/wiki/ImageJ_Macro_Programming_for_Biological_Image_Analysis </shameless self-advertisement> Volker Tobias Baskin: > Volker, Perfect! Wow! I cannot even pretend to understand the > syntax of that do loop. But it certainly works. This will save me a > bunch of time (I have been writing down those points by hand!). I > am tremendously grateful. > > As ever, Tobias > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJVHT5zAAoJENcVU956o58N/e8H/1j07U9AltCcBq8XS6BvdZFy aFL27MnVHFAln+qfgQTCM6tlpHXz/hfcg24/D4GspnZWyui8zjd9emDP3ORRsrW1 KbhO77qA7Yq49IYmPk2RSV8scTV5PHmcPvn35fGj9f8T0dbiieMfUZfdjMnu3eiP aHQTyVqzBsHaR9KkB/nxFHye8AT3ifeOdAqd8I138Nc5f5Cu1PZ1BJrHyZ+CAh8R Nk1PuBjDzrpGsJaMSByHOYZ2WZN1JdkiuIsFbMmqp/qd3pQEbRGewZlUyS014QAa XnFp41jDYWGBvugHJsN0zcdKbjcvihzw++wSovjhNXp+UEQqCr4JxOArPB58fMA= =KSeC -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |