Login  Register

Re: macro help please

Posted by Larry Nolan on Jan 01, 2010; 6:05pm
URL: http://imagej.273.s1.nabble.com/macro-help-please-tp3689867p3689878.html

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


11.jpg (30K) Download Attachment
61.jpg (32K) Download Attachment
1933.jpg (11K) Download Attachment