Posted by
Michael Schmid on
Dec 03, 2018; 6:22pm
URL: http://imagej.273.s1.nabble.com/Help-with-macro-tp5021508p5021519.html
Hi Alex,
it is unclear to me what you refer to with "projection of these lines":
(a) Projection of the lines onto the xy plane?
This is trivial:
If you have a line between the points (x1,y1,z1) and (x2,y2,z2), the
projection on the xy plane is simply a line between (x1,y1) and (x2,y2).
Use makeLine(x1, y1, x2, y2).
(b) Line profile (of pixel values) along the lines?
ImageJ has no 3D line selections (line ROIs are 2D), so I fear that you
have to do this point by point:
(x,y,z) = (x1,y1,z1) + (i/(n-1))*((x2,y2,z2) - (x1,y1,z1))
where i is the index of the point (running from 0 to n-1) and n is the
number of points (e.g. set it to the length of the line).
For each of the points, set the slice number according to z and use
getPixel(x,y).
getPixel does interpolation in x and y, but selecting one slice for each
point means you have no interpolation in z direction.
(c) Intersection points of the lines with the slices? Again, I fear you
have to do the math.
(d) Something else?
Michael
________________________________________________________________
On 30.11.18 15:00, Aleksandr Mironov wrote:
> Dear Listers,
>
> I just wonder will it be possible by means of ImageJ macro language do
> the following:
>
> in the stack of images to create arbitrary (random angles) 2 parallel
> lines that go through several slices. I would like projection of these
> lines to be drawn on slices. In general it should not be too hard but I
> cannot get my head around how to calculate these projections if you have
> random (but known) angles in all 3 axes (X,Y,Z).
>
> Sincerely,
>
> Alex
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html