Hi.
I have images that I have thresholded and then run through Process>Binary>Distance Map. The images are of tubes in which I would like to extract the radius value (or the largest and center value given by the distance map). The images vary in size but are mostly 640x480. From the following example pixel values I want to extract only the value of 6: Sample pixel values from a distance map image: 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 I've been stuck on some algorithm to extract the relevant information. Thanks for any help on this. -Paxton |
Paxton,
I must be confused about your problem. If you know that the radius value will be the biggest value in the map, then doesn't this work : function findRadius(){ radius = -1; for(c = 0; c < getWidth(); c++) for(r = 0; r < getHeight(); r++){ if (getPixel(c,r) > radius) radius = getPixel(c,r); } return radius; } Tony >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of Paxton Provitera >Sent: Wednesday, August 08, 2007 3:46 PM >To: [hidden email] >Subject: tube diameter > >Hi. >I have images that I have thresholded and then run through >Process>Binary>Distance Map. > >The images are of tubes in which I would like to extract the >radius value (or the largest and center value given by the >distance map). > >The images vary in size but are mostly 640x480. >From the following example pixel values I want to extract only >the value of >6: > > >Sample pixel values from a distance map image: > >0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 2 3 >4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 >2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 >0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 > >I've been stuck on some algorithm to extract the relevant information. >Thanks for any help on this. > >-Paxton > |
I neglected to mention that there are many fibers of slightly varying radii
in each image. On 8/8/07, Rotella, Anthony M. (GRC)[] <[hidden email]> wrote: > > Paxton, > > I must be confused about your problem. If you know that the > radius value will be the biggest value in the map, then doesn't this > work : > > function findRadius(){ > radius = -1; > for(c = 0; c < getWidth(); c++) > for(r = 0; r < getHeight(); r++){ > if (getPixel(c,r) > radius) > radius = getPixel(c,r); } > return radius; > } > > Tony > > > >-----Original Message----- > >From: ImageJ Interest Group [mailto:[hidden email]] On > >Behalf Of Paxton Provitera > >Sent: Wednesday, August 08, 2007 3:46 PM > >To: [hidden email] > >Subject: tube diameter > > > >Hi. > >I have images that I have thresholded and then run through > >Process>Binary>Distance Map. > > > >The images are of tubes in which I would like to extract the > >radius value (or the largest and center value given by the > >distance map). > > > >The images vary in size but are mostly 640x480. > >From the following example pixel values I want to extract only > >the value of > >6: > > > > > >Sample pixel values from a distance map image: > > > >0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 2 3 > >4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 > >2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 > >0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 > > > >I've been stuck on some algorithm to extract the relevant information. > >Thanks for any help on this. > > > >-Paxton > > > |
In reply to this post by Paxton Provitera
Take all pixels in the skeleton of your tubes. They should reside on
the let's say crete line (Gipfellinie) of the distance transform. Beware of border problems! Karsten Am 08.08.2007 um 21:46 schrieb Paxton Provitera: > Hi. > I have images that I have thresholded and then run through > Process>Binary>Distance Map. > > The images are of tubes in which I would like to extract the radius > value > (or the largest and center value given by the distance map). > > The images vary in size but are mostly 640x480. > From the following example pixel values I want to extract only the > value of > 6: > > > Sample pixel values from a distance map image: > > 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 > 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 > 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 > 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 > 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 > > I've been stuck on some algorithm to extract the relevant information. > Thanks for any help on this. > > -Paxton |
In reply to this post by Paxton Provitera
Paxton,
If you don't mind some kind of user input, one silly idea would be to write something where the macro does each tube one by one, using a user selection to outline the tube in question. You could select the tube, click a continue button (there is a "Wait for User" plug-in), have it do something like the macro I wrote previously, except it gets the loop bounds from the selection paramteres, and keep doing that until you've analyzed all the tubes. Of course, if there are hundreds of tubes or images, you will have to find something better. For instance: function getRadius(numTubes){ radius = -1; for(n = 0; n < numTubes; n++){ run("Wait For User..."); //draw a square getSelectionBounds(x, y, w, h); for(c = x; c < x + w; c++){ for(r = y; r < y + h; r++){ if (getPixel(c,r) > radius) radius = getPixel(c,r) } } print(radius); } } It may also be possible to outline them all one by one using the ROI Manager and to just loop them all at once. Regards, Tony >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of Paxton Provitera >Sent: Wednesday, August 08, 2007 4:18 PM >To: [hidden email] >Subject: Re: tube diameter > >I neglected to mention that there are many fibers of slightly >varying radii in each image. > >On 8/8/07, Rotella, Anthony M. (GRC)[] ><[hidden email]> wrote: >> >> Paxton, >> >> I must be confused about your problem. If you know that the >> radius value will be the biggest value in the map, then doesn't this >> work : >> >> function findRadius(){ >> radius = -1; >> for(c = 0; c < getWidth(); c++) >> for(r = 0; r < getHeight(); r++){ >> if (getPixel(c,r) > radius) >> radius = getPixel(c,r); } >> return radius; >> } >> >> Tony >> >> >> >-----Original Message----- >> >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of >> >Paxton Provitera >> >Sent: Wednesday, August 08, 2007 3:46 PM >> >To: [hidden email] >> >Subject: tube diameter >> > >> >Hi. >> >I have images that I have thresholded and then run through >> >Process>Binary>Distance Map. >> > >> >The images are of tubes in which I would like to extract the radius >> >value (or the largest and center value given by the distance map). >> > >> >The images vary in size but are mostly 640x480. >> >From the following example pixel values I want to extract only the >> >value of >> >6: >> > >> > >> >Sample pixel values from a distance map image: >> > >> >0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 1 2 3 >> >4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 >> >2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 >0 0 0 0 0 >> >0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 >> > >> >I've been stuck on some algorithm to extract the relevant >information. >> >Thanks for any help on this. >> > >> >-Paxton >> > >> > |
In reply to this post by karo03
Hi Karsten.
This sounds like exactly what I need, but I am very 0confused as how to do it. Could you give me some greater detail in exactly what to do? Thanks. -Paxton On 8/8/07, Karsten Rodenacker <[hidden email]> wrote: > > Take all pixels in the skeleton of your tubes. They should reside on > the let's say crete line (Gipfellinie) of the distance transform. > Beware of border problems! > Karsten > Am 08.08.2007 um 21:46 schrieb Paxton Provitera: > > > Hi. > > I have images that I have thresholded and then run through > > Process>Binary>Distance Map. > > > > The images are of tubes in which I would like to extract the radius > > value > > (or the largest and center value given by the distance map). > > > > The images vary in size but are mostly 640x480. > > From the following example pixel values I want to extract only the > > value of > > 6: > > > > > > Sample pixel values from a distance map image: > > > > 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 > > 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 > > 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 > > 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 > > 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 > > > > I've been stuck on some algorithm to extract the relevant information. > > Thanks for any help on this. > > > > -Paxton > |
Tscha, you start with the binary image of your tubes, create the
distance transform (dt) and the skeleton (sk) from your binary image. Than it depends upon you what you want to do with the pixels of the skelton in the distance transform. Multiplication of the two images and division by 255 gives an image with the crete line pixels having the dt value. You can extract all pixels not equal zero with their coordinates ... run("Distance Map"); run("Skeletonize"); Karsten Am 08.08.2007 um 22:52 schrieb Paxton Provitera: > Hi Karsten. > This sounds like exactly what I need, but I am very 0confused as > how to do > it. > Could you give me some greater detail in exactly what to do? > > Thanks. > > -Paxton > > > On 8/8/07, Karsten Rodenacker <[hidden email]> wrote: >> >> Take all pixels in the skeleton of your tubes. They should reside on >> the let's say crete line (Gipfellinie) of the distance transform. >> Beware of border problems! >> Karsten >> Am 08.08.2007 um 21:46 schrieb Paxton Provitera: >> >>> Hi. >>> I have images that I have thresholded and then run through >>> Process>Binary>Distance Map. >>> >>> The images are of tubes in which I would like to extract the radius >>> value >>> (or the largest and center value given by the distance map). >>> >>> The images vary in size but are mostly 640x480. >>> From the following example pixel values I want to extract only the >>> value of >>> 6: >>> >>> >>> Sample pixel values from a distance map image: >>> >>> 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 >>> 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 0 >>> 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 0 >>> 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 0 >>> 0 0 0 0 0 0 0 0 1 2 3 4 5 6 6 5 4 3 2 1 0 0 0 >>> >>> I've been stuck on some algorithm to extract the relevant >>> information. >>> Thanks for any help on this. >>> >>> -Paxton >> |
Free forum by Nabble | Edit this page |