If I create a segmented line ROI (splined or not) ,and then use
edit>selection>straighten to obtain a mapping to a straight line, how can I map the coordinates of the resulting straight line to the segmented ROI from which it was created? I know that I can get the points that comprise the ROI, and calculate the distances, but I was wondering if there is something built in already that does this. --aryeh -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
On Nov 14, 2010, at 2:20 AM, Aryeh Weiss wrote:
> If I create a segmented line ROI (splined or not) ,and then use > edit>selection>straighten to obtain a mapping to a straight line, > how can I map the coordinates of the resulting straight line to the > segmented ROI from which it was created? > > I know that I can get the points that comprise the ROI, and calculate > the distances, but I was wondering if there is something built in > already that does this. You can call run("Fit Spline", "straighten"); to convert the line to one that has points spaced one pixel apart. These points map to the columns in the image generated by the Edit>Selection>Straighten command. -wayne |
On 11/15/10 11:57 PM, Rasband, Wayne (NIH/NIMH) [E] wrote:
> On Nov 14, 2010, at 2:20 AM, Aryeh Weiss wrote: > >> If I create a segmented line ROI (splined or not) ,and then use >> edit>selection>straighten to obtain a mapping to a straight line, >> how can I map the coordinates of the resulting straight line to >> the segmented ROI from which it was created? >> >> I know that I can get the points that comprise the ROI, and >> calculate the distances, but I was wondering if there is something >> built in already that does this. > > You can call > > run("Fit Spline", "straighten"); > > to convert the line to one that has points spaced one pixel apart. > These points map to the columns in the image generated by the > Edit>Selection>Straighten command. > > -wayne > Thank you for your reply. Does this mean that if I use getSelectionCoordinates(xCoordinates, yCoordinates) on the splined line, then the index of each point in those arrays will correspond to the columns in the image generated by the Edit>Selection>Straighten command? If that is the case, then it is exactly what I wanted. --aryeh -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
Hi Aryeh,
for a one-pixel wide line, run("Fit Spline", "straighten"); getSelectionCoordinates(x, y); will give you the points where the "Edit>Selection>Straighten" output is taken from. Note that the x and y values won't be integers; Edit>Selection>Straighten uses interpolation to get its pixel values. For line widths > 1, getSelectionCoordinates will give you the positions in the original image where the center line of the resulting image comes from. The pixels at the sides are collected in the original image along a straight line perpendicular to the splined selection. Hope this helps, Michael ____________________________________________________________________ On Tue, November 16, 2010 16:06, Aryeh Weiss wrote: > On 11/15/10 11:57 PM, Rasband, Wayne (NIH/NIMH) [E] wrote: > >> On Nov 14, 2010, at 2:20 AM, Aryeh Weiss wrote: >> >> >>> If I create a segmented line ROI (splined or not) ,and then use >>> edit>selection>straighten to obtain a mapping to a straight line, >>> how can I map the coordinates of the resulting straight line to >>> the segmented ROI from which it was created? >>> >>> I know that I can get the points that comprise the ROI, and >>> calculate the distances, but I was wondering if there is something >>> built in already that does this. >>> >> >> You can call >> >> run("Fit Spline", "straighten"); >> >> to convert the line to one that has points spaced one pixel apart. >> These points map to the columns in the image generated by the >> Edit>Selection>Straighten command. >> >> -wayne >> >> > > Thank you for your reply. > > Does this mean that if I use > getSelectionCoordinates(xCoordinates, yCoordinates) > on the splined line, then the index of each point in those arrays will > correspond to the columns in the image generated by the > Edit>Selection>Straighten command? > > If that is the case, then it is exactly what I wanted. > > --aryeh > -- > Aryeh Weiss > School of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > |
Free forum by Nabble | Edit this page |