Login  Register

Re: Execute "Line to Area" from "segmented line" roi

Posted by guitarro17 on Aug 23, 2014; 9:15pm
URL: http://imagej.273.s1.nabble.com/Execute-Line-to-Area-from-segmented-line-roi-tp5009299p5009320.html

Just curious, because I could not find the answer on google: what the "Fit Spline" command do?

Abraço,

Prof. Guilherme Chagas Kurtz
Cursos de Ciência da Computação e Sistemas de Informação
UNIFRA - Centro Universitário Franciscano
Rua dos Andradas 1614 - 97010-032 - Centro - Santa Maria - RS
+55 55 3220 1200


2014-08-23 18:16 GMT-03:00 Guilherme Kurtz <[hidden email]>:
Thanks, I will try that!

:)

Abraço,

Prof. Guilherme Chagas Kurtz
Cursos de Ciência da Computação e Sistemas de Informação
UNIFRA - Centro Universitário Franciscano
Rua dos Andradas 1614 - 97010-032 - Centro - Santa Maria - RS
+55 55 3220 1200


2014-08-23 14:06 GMT-03:00 Rasband, Wayne (NIH/NIMH) [E] [via ImageJ] <[hidden email]>:

On Aug 21, 2014, at 10:18 PM, guitarro17 wrote:

> Hi!
>
> I use ImageJ as library in my application, and I have a sequence of points
> that form a segmented line.
> I'm having some trouble in turning this segmented line into an area
> selection/roi (Like the menu Edit -> Selection -> Line to Area), and then
> crop the image.

Set the width of the segmented line selection and the Edit>Selection>Line to Area command will work as expected. The following JavaScript example creates a segmented line selection, sets its width to 35 pixels and then uses "Line to Area" to convert it into an area selection. There is a screenshot of the output at <http://wsr.imagej.net/images/LineToArea.png>.

-wayne

   imp = IJ.createImage("Untitled","8-bit black",300,200,1);
   xpoints = [55,105,164,209,229,217];
   ypoints = [111,137,132,102,62,25];
   line = new PolygonRoi(xpoints,ypoints,Roi.POLYLINE);
   imp.setRoi(line);
   IJ.run(imp, "Fit Spline", "");
   IJ.setForegroundColor(255,255,255);
   IJ.run(imp, "Draw","");
   line.setStrokeWidth(35);
   IJ.run(imp, "Line to Area","");
   IJ.run(imp, "Crop", "");
   imp.show();


> My code until now, but that doesn't work:
>
> ImagePlus imp = new ImagePlus("", ip);
> PolygonRoi s = new PolygonRoi(xPoints, yPoints, nPoints, Roi.POLYLINE);
> imp.setRoi(s);
> IJ.run(imp, "Line to Area", "");
> IJ.run(imp, "Crop", "");
> ImageProcessor ip2 = imp.getProcessor();
>
> What should I do? thanks!
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Execute-Line-to-Area-from-segmented-line-roi-tp5009299.html
> Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Execute-Line-to-Area-from-segmented-line-roi-tp5009299p5009317.html
To unsubscribe from Execute "Line to Area" from "segmented line" roi, click here.
NAML