Problems running macros and seeing files using getDirectory

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

Problems running macros and seeing files using getDirectory

PEARSON Matthew
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
Reply | Threaded
Open this post in threaded view
|

Re: Problems running macros and seeing files using getDirectory

John Hayes
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
Reply | Threaded
Open this post in threaded view
|

Re: Problems running macros and seeing files using getDirectory

PEARSON Matthew
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
Reply | Threaded
Open this post in threaded view
|

Re: Problems running macros and seeing files using getDirectory

ctrueden
Hi Matt,

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

There might be an invisible error message [1]. Try turning on ImageJ's
Debug mode (Edit > Options > Miscellaneous) before running your macro, or
launching ImageJ from the command line [2], and see if an error message
shows up. Also make sure that your ImageJ installation is fully up-to-date
[3].

Regards,
Curtis

[1] We tried showing them in the log, but people complained. We have a plan
to show them less aggressively in a separate window, which should help in
the future: https://github.com/imagej/imagej-legacy/issues/97

[2] http://imagej.net/Debugging#Launching_ImageJ_in_debug_mode

[3]
http://imagej.net/Frequently_Asked_Questions#How_can_I_verify_that_my_ImageJ_is_really_100.25_up_to_date.3F

On Tue, Feb 17, 2015 at 10:40 AM, PEARSON Matthew <
[hidden email]> wrote:

> 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
>

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