macro help please

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

Re: macro help please

Joel Sheffield
It seems to me, without doing the measurements, that you may be having
problems in the conversion from rgb to 8-bit.  The actual conversion is
somewhat complicated, since each of the channels are weighted differently in
the calculation of the grey values.  If you are actually interested in the
foliage, as measured by green and black in the original, I would suggest
that you try to separate out the channels, rather than use a general
conversion.  Use Image>colors>split channels, and then select the green
channel.  Then carry out your threshold and measurements, etc.

Alternatively, you can use Gabriel Landini's color deconvolution plugin to
select more accurately.

Best of luck.

Joel


On Fri, Jan 1, 2010 at 1:05 PM, Larry Nolan <[hidden email]> wrote:

> Working with a set of 1000 images from ten years ago now; I've succesfully
> processed images from this summer with the macro I completed.
>
> Each old Jpeg image is 320x240.  All were taken with the same camera.
>
> I'm worried that there is something different in some of the files that is
> causing my macro not to process the images correctly.  I've randomly pulled
> three images and used this macro to analyze them to find the canopy cover
> (leaves and branches).
>
> Here's the macro; I open the file twice so I can compare the original with
> the thresholded result:
>
>  dir = getDirectory("Choose a Directory ");
>  list = getFileList(dir);
>  setOption("display labels", true);
>
>  for (i=0; i<list.length; i++) {
>      path = dir+list[i];
>      showProgress(i, list.length);
>      open(path); open(path);
>
>      run("8-bit");
>      setAutoThreshold();
>      run("Measure");
>  }
>
> After running the macro on a folder with the three files (attached in order
> below):
>
> File 11.jpg      has the sky selected as red, not the foliage; area results
> wrong
> File 61.jpg      appears to be OK with the foliage selected as red and the
> analysis result looking reasonable
> File 1933.jpg  has the sky selected as red, not the foliage; area results
> wrong
>
> i don't understand what's going on.  Is there something possibly different
> with file 11.jpg and 1933.jpg vs. 61.jpg?  How would I figure out what it
> is?
>
> I don't want to have to manually process all 1000 images to get valid
> analysis results.
>
> Larry
>
>


--


Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail: [hidden email]
URL:  http://astro.temple.edu/~jbs
Reply | Threaded
Open this post in threaded view
|

Re: macro help please

Gabriel Landini
In reply to this post by Larry Nolan
On Friday 01 January 2010, you wrote:

> After running the macro on a folder with the three files (attached in
> order below):
>
> File 11.jpg      has the sky selected as red, not the foliage; area
> results wrong
> File 61.jpg      appears to be OK with the foliage selected as red and
> the analysis result looking reasonable
> File 1933.jpg  has the sky selected as red, not the foliage; area
> results wrong
>
> i don't understand what's going on.  Is there something possibly
> different with file 11.jpg and 1933.jpg vs. 61.jpg?  How would I
> figure out what it is?

Yes, I get the same results here. There might be some problem, with the
"Default" method while running from a macro. Calling the threshold adjuster
and using the Default method seems to find the right phase but not when
running from the macro.

If you install the Auto_Threshold plugin (which has some extra settings) and
change in your macro:

setAutoThreshold();
for
run("Auto Threshold", "method=Default setthreshold show");

Then the phases seem to be detected properly.
The plugin (and some documentation) is here:
http://www.dentistry.bham.ac.uk/landinig/software/autothreshold/autothreshold.html

Happy 2010 to all

G.
Reply | Threaded
Open this post in threaded view
|

Re: macro help please

Larry Nolan
Gabriel,

Thanks for confirming what I was seeing with the interactive vs. macro  
results.

The Auto_Threshold plugin does give dramatically improved results.  
I'll work with it, trying to tweak the output for the files that have  
problems like the one I've attached.

a good start to 2010!  Thanks,

Larry






On Jan 1, 2010, at 12:59 PM, Gabriel Landini wrote:

> On Friday 01 January 2010, you wrote:
>> After running the macro on a folder with the three files (attached in
>> order below):
>>
>> File 11.jpg      has the sky selected as red, not the foliage; area
>> results wrong
>> File 61.jpg      appears to be OK with the foliage selected as red  
>> and
>> the analysis result looking reasonable
>> File 1933.jpg  has the sky selected as red, not the foliage; area
>> results wrong
>>
>> i don't understand what's going on.  Is there something possibly
>> different with file 11.jpg and 1933.jpg vs. 61.jpg?  How would I
>> figure out what it is?
>
> Yes, I get the same results here. There might be some problem, with  
> the
> "Default" method while running from a macro. Calling the threshold  
> adjuster
> and using the Default method seems to find the right phase but not  
> when
> running from the macro.
>
> If you install the Auto_Threshold plugin (which has some extra  
> settings) and
> change in your macro:
>
> setAutoThreshold();
> for
> run("Auto Threshold", "method=Default setthreshold show");
>
> Then the phases seem to be detected properly.
> The plugin (and some documentation) is here:
> http://www.dentistry.bham.ac.uk/landinig/software/autothreshold/autothreshold.html
>
> Happy 2010 to all
>
> G.


C3P0034C.jpg (32K) Download Attachment
12