Macro for recording cumulative sequential distance with segmented line tool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro for recording cumulative sequential distance with segmented line tool

B Jessop
Dear List,
            I have a requirement to measure the cumulative sequential
distances of a series of age marks from the origin to edge of scales and
otoliths of fishes (analogous to the age rings in trees). The segmented
line tool records total distance for a series of segments not the
cumulative distance to each point along a transect e.g., start (0), age
1 (50), age 2 (95), age 3 (165), etc. to edge (850).  My hoped for
procedure is to initially run a straight line between origin and edge
with the line tool, then using it as a guide for straightness, use the
segmented line tool to measure the distances to each age mark.  Finally,
the measurements will be saved to the data sheet for copying and pasting
to Excel.  
            I am a retired fishery biologist working on a project of
personal/professional interest who no longer has access to programs such
as SigmaScan and ImagePro that easily do the above task.  I lack skills
in programming in Java or any computer language so I am sending a
request out to see if anyone may have a macro or plug-in for ImageJ that
might fill my need.  There is great use in fisheries of back-calculation
methods based on scale/otolith image measurements and not all (students,
employees with tight budgets) can afford the professional programs.  A
tool that would take such measurements in ImageJ would be a great asset.

            Thanks very much to anyone who can help with this request.
 
Sincerely yours,
Brian Jessop
 
Reply | Threaded
Open this post in threaded view
|

Re: Macro for recording cumulative sequential distance with segmented line tool

W. Chan
Hi Brian

How about press "m" (for measure) after you click on each age mark with
the segmented line tool?  That will put an entry of cumulated distance in
the result window.  Not elegant but simple.

If the age marks has good enough contrast, you can use the straight line
tool to mark the transect, press "k" (for Plot profile) to obtain a line
profile, then each peak or valley will represent an age mark.  Just an
idea.

--
Pang (Wai Pang Chan, [hidden email], PAB A087, 206-685-1519)
The Biology Imaging Facility (http://staff.washington.edu/wpchan/if/)

On Fri, 20 Jul 2007, B Jessop wrote:

>            I have a requirement to measure the cumulative sequential
> distances of a series of age marks from the origin to edge of scales and
> otoliths of fishes (analogous to the age rings in trees). The segmented
> line tool records total distance for a series of segments not the
> cumulative distance to each point along a transect e.g., start (0), age
> 1 (50), age 2 (95), age 3 (165), etc. to edge (850).  My hoped for
> procedure is to initially run a straight line between origin and edge
> with the line tool, then using it as a guide for straightness, use the
> segmented line tool to measure the distances to each age mark.  Finally,
> the measurements will be saved to the data sheet for copying and pasting
> to Excel.
Reply | Threaded
Open this post in threaded view
|

Re: Macro for recording cumulative sequential distance with segmented line tool

Wayne Rasband
In reply to this post by B Jessop
Here is a macro that measures cumulative distances along a segmented  
line selection or between the points of a point selection.

   macro "Measure Cumulative Distances [1]" {
      if (!(selectionType==6||selectionType==10))
          exit("Segmented line or point selection required");
      getSelectionCoordinates(x, y);
      if (x.length<2)
          exit("At least two points required");
      getPixelSize(unit, pw, ph);
      n = nResults;
      distance = 0;
      for (i=1; i<x.length; i++) {
         dx = (x[i] - x[i-1])*pw;
         dy = (y[i] - y[i-1])*ph;
         distance += sqrt(dx*dx + dy*dy);
         setResult("D"+i, n, distance);
      }
      updateResults;
   }

-wayne

On Jul 20, 2007, at 10:54 AM, B Jessop wrote:

> Dear List,
>             I have a requirement to measure the cumulative sequential
> distances of a series of age marks from the origin to edge of  
> scales and
> otoliths of fishes (analogous to the age rings in trees). The  
> segmented
> line tool records total distance for a series of segments not the
> cumulative distance to each point along a transect e.g., start (0),  
> age
> 1 (50), age 2 (95), age 3 (165), etc. to edge (850).  My hoped for
> procedure is to initially run a straight line between origin and edge
> with the line tool, then using it as a guide for straightness, use the
> segmented line tool to measure the distances to each age mark.  
> Finally,
> the measurements will be saved to the data sheet for copying and  
> pasting
> to Excel.
>             I am a retired fishery biologist working on a project of
> personal/professional interest who no longer has access to programs  
> such
> as SigmaScan and ImagePro that easily do the above task.  I lack  
> skills
> in programming in Java or any computer language so I am sending a
> request out to see if anyone may have a macro or plug-in for ImageJ  
> that
> might fill my need.  There is great use in fisheries of back-
> calculation
> methods based on scale/otolith image measurements and not all  
> (students,
> employees with tight budgets) can afford the professional programs.  A
> tool that would take such measurements in ImageJ would be a great  
> asset.
>
>             Thanks very much to anyone who can help with this request.
>
> Sincerely yours,
> Brian Jessop
>