Re: Problems running macros and seeing files using getDirectory

Posted by PEARSON Matthew on
URL: http://imagej.273.s1.nabble.com/Problems-running-macros-and-seeing-files-using-getDirectory-tp5011627p5011636.html

Hi John,

These are the first few lines of my macro which i use to sequentially open files within a directory:
setBatchMode(true);
dir = getDirectory("Select source directory");
dir2 = getDirectory("Select destination directory");
list = getFileList(dir);

for (q=0; q<list.length; q++) {
        path = dir+list[q];
        path = "["+path+"]";
        run("Bio-Formats Windowless Importer", "open="+path);

I have used this many times before to batch process a folder of images but never noticed that it doesn't show you the individual files in the folder.  I think the confusion might be that i usually use macs and on there it shows the image files when using getDirectory but on a PC it doesn't..

Still not sure when i try to run any macro on a pc with the latest FIJI it just doesn't proceed.

Thanks for your advice,

Matt




On 17 Feb 2015, at 09:52, John Hayes wrote:

> Hi Matt,
>
> Regarding your main problem, I think you want to use the open function (http://rsb.info.nih.gov/ij/developer/macro/functions.html#open) and not getDirectory (http://rsb.info.nih.gov/ij/developer/macro/functions.html#getDirectory). As the name implies, 'getDirectory' is intended to get directories (i.e., folders) and not files.
>
> Try recording the File->Open operation to give you the correct macro syntax and remember you should not need to pass a filename to the function to get the open dialog during macro execution...
>
> HTH,
>
> John
>
> Le 17 févr. 2015 à 04:23, PEARSON Matthew a écrit :
>
>> Hi all,
>>
>> Apologies if this has already cropped up on the list but i haven't seen anything about it so far.
>>
>> I have updated FIJI and find that when i try to run any macro, it reports "running" but nothing actually happens.
>>
>> The reason i updated it is because when i used getDirectory the directory window would show folders but no images present.  It doesn't matter what type of image file it is.  If i use File>Open outside of the macro i can see the files.
>>
>> Would appreciate any advice about this.
>>
>> Thanks,
>>
>> Matt
>>
>>
>>
>>
>>
>> --
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
Matt Pearson
Microscopy Facility
MRC Human Genetics Unit
IGMM
University of Edinburgh
Crewe Road
EH4 2XU


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html