Measuring along oblique lines

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

Measuring along oblique lines

Fintan McEvoy-2
Hi,

Can anybody help with what are probably very basic questions?

My questions :

If a line selection runs obliquely across the image how does "getProfile" in
ImageJ count pixels?
Does it count every pixel the line  touches?  
Can I accurately measure distances along oblique lines in ImageJ?
Is there any merit in measuring aling lines parallel to either the x or y axis?


I know that the line is drawn from the upper left corner of each pixel I
specify in the  makeLine command.
If the line is parallel with the side of the pixel,  ImageJ will count the
exact number of pixels  between two points of interest along the line and
since I  know the pixel dimensions, I can then calculate a distance that
interests me.

The detail of what I am doing is below:


I am using  a macro that contains written to run on CT images.  I  want to
measure the thickness  of subcutaneous adipose tissue. The while statment
below starts checking the value of the pixel at  "i", this will be less than
zero for air outside the patient , more than zero for skin and then again
less than zero for adipose tissue. Thus the the junction between skin and
adipose tissue is detected ad the variable "outer" gets the value of "i",
the process is repated to give the inner edge.  Since the lne is parallel
with the y axis of the image , all I need to do to get the thickness of the
tissue in pixels is subtract the value of the variable "outer" from the
value of "i" when it is stoped at the "inner edge"

In order to make measurements around the whole circumference of the patient
I have opted to rotate the image and not the line because I am not clear
what ImageJ, "getProfile" does with oblique lines,  


selectImage("temp6.dcm");
   w = getWidth/2;
   h = getHeight/2;
   makeLine (w,0,w,h);
   value=getProfile;
   i=0;
   while (value[i]<0) {i++;}
   //outer adipose edge
   while (value[i]>0) {i++;}
   outer=i;
   //inner adipose edge
   while (value[i]<-0) {i++;}
   //sub cutis fat thickness
   t=(outer-i)*(-1);



Thanks in anticipation for any help

Fintan McEvoy
Reply | Threaded
Open this post in threaded view
|

Re: Measuring along oblique lines

Sullivan, Michael J (College of Med.)
Fintan, I ran into this oblique line problem in a different situation
and had to write code that would read the pixel values along a "strait"
contiguous line (pixels touching either at edge or at corner) from one
set of pixel coordinates to another. Your welcome to this code (you'll
have to adapt it to your needs but the underlying algorithm should
work).  Also, someone else may respond with a more complete solution and
I'll realize I've just needlessly reinvented the wheel. Let me know if
you want my code.  --- Mike Sullivan

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Fintan McEvoy
Sent: Thursday, April 05, 2007 10:15 AM
To: [hidden email]
Subject: Measuring along oblique lines

Hi,

Can anybody help with what are probably very basic questions?

My questions :

If a line selection runs obliquely across the image how does
"getProfile" in ImageJ count pixels?
Does it count every pixel the line  touches?  
Can I accurately measure distances along oblique lines in ImageJ?
Is there any merit in measuring aling lines parallel to either the x or
y axis?


I know that the line is drawn from the upper left corner of each pixel I
specify in the  makeLine command.
If the line is parallel with the side of the pixel,  ImageJ will count
the exact number of pixels  between two points of interest along the
line and since I  know the pixel dimensions, I can then calculate a
distance that interests me.

The detail of what I am doing is below:


I am using  a macro that contains written to run on CT images.  I  want
to measure the thickness  of subcutaneous adipose tissue. The while
statment below starts checking the value of the pixel at  "i", this will
be less than zero for air outside the patient , more than zero for skin
and then again less than zero for adipose tissue. Thus the the junction
between skin and adipose tissue is detected ad the variable "outer" gets
the value of "i", the process is repated to give the inner edge.  Since
the lne is parallel with the y axis of the image , all I need to do to
get the thickness of the tissue in pixels is subtract the value of the
variable "outer" from the value of "i" when it is stoped at the "inner
edge"

In order to make measurements around the whole circumference of the
patient I have opted to rotate the image and not the line because I am
not clear what ImageJ, "getProfile" does with oblique lines,  


selectImage("temp6.dcm");
   w = getWidth/2;
   h = getHeight/2;
   makeLine (w,0,w,h);
   value=getProfile;
   i=0;
   while (value[i]<0) {i++;}
   //outer adipose edge
   while (value[i]>0) {i++;}
   outer=i;
   //inner adipose edge
   while (value[i]<-0) {i++;}
   //sub cutis fat thickness
   t=(outer-i)*(-1);



Thanks in anticipation for any help

Fintan McEvoy
Reply | Threaded
Open this post in threaded view
|

Re: Measuring along oblique lines

Gluender
In reply to this post by Fintan McEvoy-2
Dear Fintan McEvoy,

please note that with ij-version 1.37 profiles received an new option
that might help:

"v1.37q, 30 August 2006:
Added the 'Interpolate Line Profiles' checkbox to the
Edit/Options/Profile Plot Options dialog box."

You may also have a look at the "Radial Profile Extended" plugin
provided by Philippe Carl.


>Hi,
>
>Can anybody help with what are probably very basic questions?
>
>My questions :
>
>If a line selection runs obliquely across the image how does "getProfile" in
>ImageJ count pixels?
>Does it count every pixel the line  touches?
>Can I accurately measure distances along oblique lines in ImageJ?
>Is there any merit in measuring aling lines parallel to either the x
>or y axis?
>
>
>I know that the line is drawn from the upper left corner of each pixel I
>specify in the  makeLine command.
>If the line is parallel with the side of the pixel,  ImageJ will count the
>exact number of pixels  between two points of interest along the line and
>since I  know the pixel dimensions, I can then calculate a distance that
>interests me.
>
>The detail of what I am doing is below:
>
>
>I am using  a macro that contains written to run on CT images.  I  want to
>measure the thickness  of subcutaneous adipose tissue. The while statment
>below starts checking the value of the pixel at  "i", this will be less than
>zero for air outside the patient , more than zero for skin and then again
>less than zero for adipose tissue. Thus the the junction between skin and
>adipose tissue is detected ad the variable "outer" gets the value of "i",
>the process is repated to give the inner edge.  Since the lne is parallel
>with the y axis of the image , all I need to do to get the thickness of the
>tissue in pixels is subtract the value of the variable "outer" from the
>value of "i" when it is stoped at the "inner edge"
>
>In order to make measurements around the whole circumference of the patient
>I have opted to rotate the image and not the line because I am not clear
>what ImageJ, "getProfile" does with oblique lines,
>
>
>selectImage("temp6.dcm");
>    w = getWidth/2;
>    h = getHeight/2;
>    makeLine (w,0,w,h);
>    value=getProfile;
>    i=0;
>    while (value[i]<0) {i++;}
>    //outer adipose edge
>    while (value[i]>0) {i++;}
>    outer=i;
>    //inner adipose edge
>    while (value[i]<-0) {i++;}
>    //sub cutis fat thickness
>    t=(outer-i)*(-1);
>
>
>
>Thanks in anticipation for any help
>
>Fintan McEvoy


Because I'm using an older ij-version, I can't judge what is actually
meant by  'Interpolate Line Profiles', but I guess the pixel values
are now assigned to an ideal (oblique) line that is defined by its
end points.

HTH

Best
--


                   Herbie

          ------------------------

          <http://www.gluender.de>