Create a sub-roi from a freehand line ROI

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

Create a sub-roi from a freehand line ROI

lechristophe
Hi,

I have a javascript that does the following :

- get intensity values for each pixel along along a freehand (curved) line
ROI
- detect start and end of a feature based on intensity thresholding
(basically, the intensity profile along the line ROI is up and down, so it
locates the max and then the points where it reaches 30% as start and end
of the feature along the line).

How can I then generate a new freehand line ROI that is a part of the input
ROI, but only from the detected start to the detected end? There are ways
to do it by interpolating the input ROI as a line ROI with 1-pixel spaced
points, then crop the coordinates on each side and generate a new
point-by-point line ROI, but I was wondering if there would be something
nicer.

Thanks for your tips,

Christophe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Create a sub-roi from a freehand line ROI

dscho
Hi Christophe,

On Wed, 9 Oct 2013, Christophe Leterrier wrote:

> I have a javascript that does the following :
>
> - get intensity values for each pixel along along a freehand (curved) line
> ROI
> - detect start and end of a feature based on intensity thresholding
> (basically, the intensity profile along the line ROI is up and down, so it
> locates the max and then the points where it reaches 30% as start and end
> of the feature along the line).
>
> How can I then generate a new freehand line ROI that is a part of the input
> ROI, but only from the detected start to the detected end? There are ways
> to do it by interpolating the input ROI as a line ROI with 1-pixel spaced
> points, then crop the coordinates on each side and generate a new
> point-by-point line ROI, but I was wondering if there would be something
> nicer.

Since you have the original free-hand ROI, you could use the exact values
from the x/y coordinates you can obtain via getXCoordinates() and
getYCoordinates() on the PolygonRoi.

You will have to construct sub-arrays yourself and copy the coordinate
values. It is a bit tricky to create Java arrays in Javascript, therefore
we documented it on the Fiji wiki:
http://fiji.sc/Javascript_Scripting#Native_Java_arrays

Ciao,
Johannes

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