Login  Register

Re: area calculations - discrepancy in the manual and batch results

Posted by ram prasad on Jan 26, 2016; 6:12pm
URL: http://imagej.273.s1.nabble.com/area-calculations-discrepancy-in-the-manual-and-batch-results-tp5015432p5015468.html

HI Brandon,

Thank you very much for the script. Works like a charm.

As for the perpendicular line, I'm trying to draw a line perpendicular to
the central vein. To achieve that, first, I draw a line as shown in
step1.png (attached) and then rotate the selection around the midpoint by
90degrees to get step2.png (attached). So if I just draw the first line and
then ask the macro to rotate it by 90degress, that should work, no?

Cheers,
Ram

On Mon, Jan 25, 2016 at 6:38 PM, Brandon Hurr <[hidden email]>
wrote:

> Ram,
>
> Your previously attached code has no perpendicular calculations in it.
> Also, the approach you've laid out seems dangerous to me because given a
> line (slope + intercept) there are infinite perpendicular lines. How are
> you anchoring it? Are you predrawing your dark blue lines and then drawing
> the line perpendicular to that?
>
> Attached I've included the ability to select a folder and loop through that
> folder. I've also included a results table that stores the area to the
> right and left of your line that are "black" pixels as defined by your
> color thresholding step.
>
> If you can explain better why you want to draw a perpendicular line, and
> how you would anchor that line, I might be able to adapt the macro to that.
> I have recently developed code for computing perpendiculars but relative to
> the midpoint of the drawn line, but this code doesn't seem to apply in your
> situation (in my opinion).
>
>
> HTH,
> B
>
>
> On Sun, Jan 24, 2016 at 4:25 PM, ram prasad <[hidden email]> wrote:
>
> > Hi Brandon,
> >
> > Thank you very much for your reply. I really appreciate it.
> >
> > A line was drawn by me on the vein which was then perpendicular'd to give
> > that blue line you see on that image. So just to make it more
> convenient, I
> > included that rotate line step in my script so that all I had to do was
> to
> > give it the first line and then let the tool rotate it by 90.
> >
> > And yes, this script does exactly what I wanted it to do. I was under the
> > impression that looping through a series of images and putting it in the
> > batchmode are one and the same thing. Is there a way to do that? Almost
> > every hit I see on google talks about running things in batchmode or
> > running it as an image sequence but neither works for me.
> >
> > Cheers,
> > Ram
> >
> >
> > On Sun, Jan 24, 2016 at 7:07 AM, Brandon Hurr <[hidden email]>
> > wrote:
> >
> > > The logic in your workflow doesn't make sense here:
> > > 1) Select the line tool
> > > 2) Wait for my input
> > > 3) Rotate my line by 90 degrees.
> > > 3) Calculate slope and extrapolate the line to the edges of my image.
> > > 4) Make a polygon from the line coordinates and add it to ROI
> > > 5) Inverse my selection and add it to ROI
> > > 6) Duplicate the original image
> > > 7) Select ROI 0
> > > 8) Set foreground colour to blue
> > > 9) Fill the other slice with foreground colour.
> > > 10) Use thresholder to identify black pixels and make a selection
> > > 11) Restore selction on the original image and calculate the area of
> the
> > > selection.
> > > 12) Repeat  6-11 for ROI 1.
> > >
> > > You don't need to perpendicular line. You need the continuation of your
> > > line to the edges of the image. I already gave you code for steps 1-5
> and
> > > it did work (but I fixed a potential bug in it related to completely
> > > vertical line selections).
> > >
> > > Also, you've got it set up for potentially going into batch mode. When
> > you
> > > do that, the image will not be displayed and your user will not be able
> > to
> > > input the initial line. If you want to loop through a series of images,
> > > that's different than just putting it in batchmode.
> > >
> > > I've changed some things and functionalized your segmentation (since
> it's
> > > the same) and it seems to be working for me. Can you test again with
> this
> > > and report back?
> > >
> > > HTH,
> > > B
> > >
> > > On Fri, Jan 22, 2016 at 5:32 AM, Ramprasad Neethiraj <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I just realized that I had sent a different version of my script from
> > the
> > > > one I was using for testing. Please find the script attached.
> > > >
> > > > --
> > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > > >
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

step1.png (1M) Download Attachment
step2.png (1M) Download Attachment