[ome-users] multiple series with bioformats importer
Curtis Rueden
ctrueden at wisc.edu
Mon Jun 17 21:02:51 BST 2013
Hi Aryeh,
> I originally tried:
>
> Ext.setSeries(i);
> Ext.openImagePlus(path);
>
> in my loop, but even though
>
> Ext.getSeries(seriesNum);
> print(seriesNum);
>
> reported the correct series, the open command open up the same series
five times.
Thanks, that is a bug. I filed a ticket for it:
https://trac.openmicroscopy.org.uk/ome/ticket/11145
Regards,
Curtis
On Mon, Jun 17, 2013 at 2:53 PM, Aryeh Weiss <aryeh at cc.huji.ac.il> wrote:
> On 6/17/13 10:48 PM, Curtis Rueden wrote:
>
>> Hi Aryeh,
>>
>> > I have a solution that does the job, and is not difficult.
>>
>> I am glad you got something that works for you!
>>
>> Is there a way to tell Ext.openImagePlus(path) which series to load.
>>>
>>
>> For the record: you call Ext.setSeries(seriesNo) before calling the
>> other functions, to assign which series is active. You can do this in a
>> loop over the value returned from Ext.getSeriesCount(**seriesCount) if
>> you
>> need to operate on all available series.
>>
>>
> Hi Curtis,
>
> Again, thank you for your help -- I would not have found the solution
> without it.
>
> I originally tried:
>
> Ext.setSeries(i);
> Ext.openImagePlus(path);
>
> in my loop, but even though
> Ext.getSeries(seriesNum);
> print(seriesNum);
>
> reported the correct series, the open command open up the same series five
> times.
>
> Beset regards,
> --aryeh
>
>
>
> Regards,
>> Curtis
>>
>>
>>
>> On Mon, Jun 17, 2013 at 2:43 PM, Aryeh Weiss <aryeh at cc.huji.ac.il
>> <mailto:aryeh at cc.huji.ac.il>> wrote:
>>
>> I have a solution that does the job, and is not difficult.
>>
>> Thanks to Curtis for pointing me to the extensions and to the
>> example code that allowed me to use them.
>>
>> Here it is:
>>
>> Ext.setId(path);
>> Ext.getCurrentFile(file);
>> Ext.getSeriesCount(__**seriesCount); // this gets the number of
>> fields
>>
>> print(seriesCount);
>>
>> seriesId = newArray(seriesCount);
>> seriesTitle = newArray(seriesCount);
>>
>> // now we open them one by one and get the imageID and set the title
>> // to something unique
>>
>> for (i=0; i<seriesCount; i++) {
>> Ext.setSeries(i);
>> // Ext.openImagePlus(path);
>> // I did not know how to tell Ext.openImagePlus which series to use,
>> // so I did it with the recorded command and some string games...
>> run("Bio-Formats Importer", "open=&path color_mode=Default
>> view=Hyperstack stack_order=XYCZT series_"+d2s(i+1,0));
>> seriesId[i] = getImageID();
>> // inputPrefix is defined earlier in my macro
>> rename(inputPrefix+"_series"+ d2s(i+1,0));
>> seriesTitle[i] = getTitle();
>> Ext.getSeries(seriesNum);
>> print(seriesNum);
>>
>> }
>>
>>
>> Best regards,
>> --aryeh
>>
>>
>> On 6/17/13 9:35 PM, Curtis Rueden wrote:
>>
>> Hi Aryeh,
>>
>> > Does Ext.getSeries(seriesNum) return what I want?
>>
>> Unfortunately not. As I said, the macro extensions do *not*
>> currently
>> include a "getSeriesUsedFiles" method. What I meant is that such
>> a thing
>> could easily be added by the core developers. But the extensions
>> do not
>> include it at the moment.
>>
>> > Also, are there some examples which use the extensions, from
>> which I
>> > can learn how they work?
>>
>> Sure, here is one such example:
>> https://github.com/__**openmicroscopy/bioformats/__**
>> blob/v4.4.8/components/loci-__**plugins/utils/macros/__**planeTimings.txt<https://github.com/__openmicroscopy/bioformats/__blob/v4.4.8/components/loci-__plugins/utils/macros/__planeTimings.txt>
>>
>> <https://github.com/**openmicroscopy/bioformats/**
>> blob/v4.4.8/components/loci-**plugins/utils/macros/**planeTimings.txt<https://github.com/openmicroscopy/bioformats/blob/v4.4.8/components/loci-plugins/utils/macros/planeTimings.txt>
>> >
>>
>> Regards,
>> Curtis
>>
>>
>> On Mon, Jun 17, 2013 at 1:29 PM, Aryeh Weiss
>> <aryeh at cc.huji.ac.il <mailto:aryeh at cc.huji.ac.il>
>> <mailto:aryeh at cc.huji.ac.il <mailto:aryeh at cc.huji.ac.il>>> wrote:
>>
>> Hi Curtis,
>>
>> Thank you for your quick reply.
>>
>>
>> On 6/17/13 8:41 PM, Curtis Rueden wrote:
>>
>> Hi Aryeh,
>>
>> > 1. Is there a way to open all of the series at
>> once, in a macro,
>> > without knowing ahead of time how many series are
>> in the file?
>>
>> Sure, there is an "Open all series" checkbox in the
>> initial Importer
>> dialog, which does exactly that.
>>
>>
>> Thanks -- I missed this, and it does the job.
>>
>>
>> > 2. Is there a way after they are opened of knowing
>> which
>> file belongs
>> > to which series?
>>
>> Yes, there is a method of IFormatReader called
>> getSeriesUsedFiles(boolean) which tells you. But you
>> would need
>> to write
>> Java code to call it -- there is no facility to call it
>> from a macro
>> (though it would be easy to add to the Ext functions).
>>
>>
>> I found the following two functions in the extensions:
>> Ext.getSeriesCount(____**seriesCount)
>>
>>
>> Ext.getSeries(seriesNum)
>>
>> I thought that they might do what I want, but even after
>> including
>> run("Bio-Formats Macro Extensions");
>> I cannot get them to work.
>>
>> This is because I have not figured out how to use the
>> extensions (
>> for example, if they are -== Usable after initializing a
>> file ==-
>> what does it mean to initialize a file?).
>>
>> Does Ext.getSeries(seriesNum) return what I want?
>> Also, are there some examples which use the extensions,
>> from which I
>> can learn how they work?
>>
>> Best regards,
>> --aryeh
>>
>>
>>
>> On Mon, Jun 17, 2013 at 9:59 AM, Aryeh Weiss
>> <aryeh at cc.huji.ac.il <mailto:aryeh at cc.huji.ac.il>
>> <mailto:aryeh at cc.huji.ac.il <mailto:aryeh at cc.huji.ac.il>>
>> <mailto:aryeh at cc.huji.ac.il
>> <mailto:aryeh at cc.huji.ac.il> <mailto:aryeh at cc.huji.ac.il
>> <mailto:aryeh at cc.huji.ac.il>>>**> wrote:
>>
>> When I open a multifield image with the bioformats
>> importer, all of
>> the fields come up with the same name. There
>> appears to be
>> no way to
>> know which is which from the metadata.
>>
>> When opening with bioformats in a macro, the
>> arguments
>> series_1,
>> series_2 etc specify which series to open.
>> However, I may
>> not know
>> ahead of time how many fields are in my multifield
>> file.
>>
>> If I open with metadata only, I can parse the
>> metadata text
>> to find
>> out how many series (fields) I have (but it would
>> be nice
>> if the
>> importer did that for me).
>>
>> My questions are:
>>
>> 1. Is there a way to open all of the series at
>> once, in a
>> macro,
>> without knowing ahead of time how many series are
>> in the file?
>>
>> 2. Is there a way after they are opened of knowing
>> which file
>> belongs to which series?
>>
>> Thanks in advance.
>> --aryeh
>> --
>> Aryeh Weiss
>> Faculty of Engineering
>> Bar Ilan University
>> Ramat Gan 52900 Israel
>>
>> Ph: 972-3-5317638
>> FAX: 972-3-7384051
>>
>>
>>
>>
>>
>>
>>
>
> --
> Aryeh Weiss
> Faculty of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph: 972-3-5317638
> FAX: 972-3-7384051
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20130617/ca2806f3/attachment.html>
More information about the ome-users
mailing list