> Larry Nolan <
[hidden email]> wrote:
> setAutoThreshold();
> setThreshold(0, 128);
>
>
> Larry,
> In addition to Gabriels' answers, you might also be wanting to
> record the
> actual threshold values used for your measurements. In that case,
> you could
> add them to your results table by adding the following lines to your
> code:
>
> ...
> setAutoThreshold();
> getThreshold(lower, upper);
> run("Convert to Mask");
> run("Measure");
> setResult("Lower",nResults-1,lower);
> setResult("Upper",nResults-1,upper);
> updateResults();
> close();
> ...
>
> Sincerely,
> Jerome
>
>
>
> On Tue, Dec 15, 2009 at 11:28 PM, Larry Nolan <
[hidden email]>
> wrote:
>
>> I'm creating a macro to process a directory of forest canopy images.
>> Here's what I've got so far after wrapping a recorded macro for one
>> image
>> file:
>>
>> dir = getDirectory("Choose a Directory ");
>> list = getFileList(dir);
>> setOption("display labels", true);
>> setBatchMode(true);
>>
>> for (i=0; i<list.length; i++) {
>> path = dir+list[i];
>> showProgress(i, list.length);
>>
>> open(path);
>>
>> run("8-bit");
>> setAutoThreshold();
>> //run("Threshold...");
>> setThreshold(0, 128);
>> run("Convert to Mask");
>> run("Measure");
>>
>> close();
>> }
>>
>> My question is that I want each image to get it's own threshold set
>> automatically but I'm not sure how to do that to replace the
>> setThreshold(0,128) call. What I want is to open each image,
>> convert to
>> greyscale, do an autothreshold, then convert to Binary and do the
>> Measure
>> function to calculate the percentage of black pixel which represent
>> the
>> canopy. I think I'm close but would appreciate a review of what
>> I've done
>> so far.
>>
>> thanks,
>>
>> Larry
>>