Login  Register

Re: can i draw cylinders!

Posted by jmutterer on Oct 24, 2006; 10:52am
URL: http://imagej.273.s1.nabble.com/can-i-draw-cylinders-tp3701211p3701225.html

Christophe,
you can do this with with the following macro that converts a line
selection with a certain line width to an area selection.
Run this macro with any line selection. The original selection is
available from the roiManager.


Jerome


// macro convert line with width to area selection
setLineWidth(10);
t=getTitle();
getSelectionCoordinates(x,y);
roiManager("Add");
segline=roiManager("Count");
print (segline);
run("Duplicate...", "title=mask");
run("Select All");
run("Clear");
selectWindow("mask");
roiManager("Select", segline-1);
run("Draw");
doWand(x[0],y[0]);
roiManager("Add");
close();
selectWindow(t);
roiManager("Select", segline);



On 10/24/06, Christophe Leterrier <[hidden email]> wrote:

> I think he may refer to a line with a finite width : adjust the line
> width by double clicking the line tool.
>
> As regards segmented or freehand lines with a fixed width, it is not yet
> implemented. I desperately need it to do measurements on thick neurites
> and I've spent hours trying to figure out how to write such a tool with
> a macro. The only output of my efforts so far have been massive headache...
>
> What I understood was that line objects (such as segmented or freehand
> lines) are very different from surface objects (rectangles etc...),
> because they are not measured in the same way (length vs area). So
> having a straight line with a finite width is relatively straighforward,
> because length and area are linked very simply, but for segmented lines
> with a finite width (which i call "kinky snakes"), or even worst for
> freehand "snakes", the relationship is much more complicated.
>
> What would be needed is a way to draw a line (wathever the type) and
> having some kind of "expand" command to generate a thick snake from that
> line, that would then be considered as a surface ROI, not a linear one.
>
> Alternatively, one could think about manually generate a rectangle from
> the extremities of a straight line, and process segmented lines by
> iteration (segment by segment). For that, I need a way to specifiy a
> rectangular ROI (not horizontal or vertical, but with any inclination)
> from the segment extremities. These extremities corresponds to the
> middle points of the two opposite (parallel) sides of the rectangle.
> Using these points and and the lenght of the corresponding side defines
> a unique rectangle, but there is no way to define a rectangular ROI
> using this parameters in ImageJ.
>
> Knowing the straight lins coordinates and the width of the rectangle, it
> could be done by calculating the rectangle four corners coordinates, but
> I somehow got lost in the calculus somewhere among angles, arctan and
> triangle sides ratios...
>
>
> Jeez this is where posting a drawing could help explain what I'm saying.
> If someone is able to figure out a quick hack to be able to draw a
> segmented line, expand it to a "kinky snake" and process that as a
> surface ROI (not a linear one), all of this wrapped into a easy-to-use
> single tool, it would be christmas in advance.
>
>
>
> Christophe
>
>
>
> --
> Christophe Leterrier
>
> Postdoc
> INSERM UMR641 Neurobiology of ionic channels
> IFR Jean Roche - Mediterranee University
> Marseille, France
>
>
> Robert Baer wrote:
> > I want to know if I can draw cylindrical lines in 2D in imageJ
> > - A cylinder is a 3-dimensional object, not a 2D object
> > - A line is a 1-dimensional object (although sometimes given width for
> > visualization purposes), not a 2D object.
> > - What, therefore, do you mean by a cylindrical line on a 2D image?
> > And, do you mean a stack of 2D images?
> >
> > Help us if you want us to help you.
> >
> >
> > ----- Original Message ----- From: "sridevi polavaram" <[hidden email]>
> > To: <[hidden email]>
> > Sent: Monday, October 23, 2006 12:40 PM
> > Subject: can i draw cylinders!
> >
> >
> >> Dear ImageJ,
> >> I want to know if I can draw cylindrical lines in 2D in imageJ.  I don't
> >> see any such tool avaiable  on the main window. But is there any
> >> plugin that
> >> provides this facility?
> >> If not, what is the solution!? I hope atleast one of you might have
> >> needed
> >> this! please let me know.
> >> -Thanks
> >> Sri
> >>
> >
>