Import array of images as ImageSequence?

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

Import array of images as ImageSequence?

Adam Cliffe
I'm trying to write a macro which opens some of the images in a folder
as an image sequence.
i.e. the files are named
Job1_t0_ch000.tif,
Job1_t0_ch001.tif,
Job1_t1_ch000.tif,
Job1_t1_ch001.tif,
Job2_t0_ch000.tif,
Job2_t0_ch001.tif,
Job2_t1_ch000.tif,
Job2_t1_ch001.tif,
etc...

I would like the macro to open all the images with Job1 and ch001 in
the title.
I can't work out a way of imputing both of these parameters into the
'Import image sequence' dialog.

Its easy to make an array of the files I'd like to open (startsWith
Job1, endsWith "ch001.tif")
but I can't work out how to open all these files as one tif stack (in
my case there would be several hundred).

Does anyone know a way of doing this?

Thanks

Adam



Dr Adam Cliffe
Research Scientist, Rorth Lab

Institute of Molecular and Cell Biology
61 Biopolis Drive
Proteos
Singapore 138673

tel: +65 6586 9731









Note: This message may contain confidential information. If this Email/Fax has been sent to you by mistake, please notify the sender and delete it immediately. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

Mario Faretta
Dear Adam,
I have no a direct answer to your question but I can suggest a "ready to use
solution":
if you use the "hypervolume shuffler plugin" or the ImageJ5D plugin you can
import the entire sequence and then reorganize according to the parameters
coded in the name.
For example if you use image 5D virtual opener and you insert the following
parameters
3rd dimension> ch : number of channels
4th dimension> time: number of timepoints
5th dimension> z: number of Jobs
you got an hyperstack where you can browse through. The hypervolume shuffler
can also split the original stack into substacks.
Hope it helps
Mario

ps one little trick: if you choose z as dimension relative the timepoints (it
is only a label not a real correspondence). this way you can animate the stack
to observe the evolution of the timelapse for example

Adam Cliffe ([hidden email]) wrote:

>
> I'm trying to write a macro which opens some of the images in a folder
> as an image sequence.
> i.e. the files are named
> Job1_t0_ch000.tif,
> Job1_t0_ch001.tif,
> Job1_t1_ch000.tif,
> Job1_t1_ch001.tif,
> Job2_t0_ch000.tif,
> Job2_t0_ch001.tif,
> Job2_t1_ch000.tif,
> Job2_t1_ch001.tif,
> etc...
>
> I would like the macro to open all the images with Job1 and ch001 in
> the title.
> I can't work out a way of imputing both of these parameters into the
> 'Import image sequence' dialog.
>
> Its easy to make an array of the files I'd like to open (startsWith
> Job1, endsWith "ch001.tif")
> but I can't work out how to open all these files as one tif stack (in
> my case there would be several hundred).
>
> Does anyone know a way of doing this?
>
> Thanks
>
> Adam
>
>
>
> Dr Adam Cliffe
> Research Scientist, Rorth Lab
>
> Institute of Molecular and Cell Biology
> 61 Biopolis Drive
> Proteos
> Singapore 138673
>
> tel: +65 6586 9731
>
>
>
>
>
>
>
>
>
> Note: This message may contain confidential information. If this Email/Fax has been sent
> to you by mistake, please notify the sender and delete it immediately. Thank you.
>

--
Mario Faretta
Department of Experimental Oncology
European Institute of Oncology
c/o IFOM-IEO Campus for Oncogenomics
via Adamello 16
20139 Milan
Italy
Phone: ++39-02574303054
email: [hidden email]
http://www.ifom-ieo-campus.it



[- Il Tuo 5 per Mille a favore della Ricerca dell'Istituto Europeo di
Oncologia

Tutti coloro che presentano il modello Unico, il modello 730 o più
semplicemente che ricevono dal proprio datore di lavoro il modello CUD, hanno
la facoltà di scegliere la destinazione del proprio 5 per mille.

Nella casella riservata al Finanziamento agli Enti della Ricerca Sanitaria
inserisci il codice fiscale dello IEO (08 69 14 40 153) ed apponi la Tua
firma.
Il Tuo 5 per Mille verrà destinato alla ricerca contro il cancro dell'Istituto
Europeo di Oncologia

NON COSTA NULLA E NON COMPORTA ALCUN AUMENTO DELLE IMPOSTE DA VERSARE
NON È UN'ALTERNATIVA ALL'8 PER MILLE
E' UN GESTO CONCRETO E DI GRANDE VALORE

Per saperne di più vai al sito dello IEO www.ieo.it < http://www.ieo.it >
oppure scrivi a [hidden email] < mailto:[hidden email]>

Segnala ad un amico questa opportunità

 -]
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

dscho
In reply to this post by Adam Cliffe
Hi,

On Tue, 20 Oct 2009, Adam Cliffe wrote:

> I'm trying to write a macro which opens some of the images in a folder
> as an image sequence.
> i.e. the files are named
> Job1_t0_ch000.tif,
> Job1_t0_ch001.tif,
> Job1_t1_ch000.tif,
> Job1_t1_ch001.tif,
> Job2_t0_ch000.tif,
> Job2_t0_ch001.tif,
> Job2_t1_ch000.tif,
> Job2_t1_ch001.tif,
> etc...
>
> I would like the macro to open all the images with Job1 and ch001 in
> the title.
> I can't work out a way of imputing both of these parameters into the
> 'Import image sequence' dialog.
>
> Its easy to make an array of the files I'd like to open (startsWith
> Job1, endsWith "ch001.tif")
> but I can't work out how to open all these files as one tif stack (in
> my case there would be several hundred).
>
> Does anyone know a way of doing this?

How about reading the files one by one and then running "Images to Stack"?

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

Ingo Bartholomaeus
Hi Adam,

we use very similar macros to handle 4D Data from confocal microscopy. How if you try to adopt the following example to your needs:

dir=getDirectory("Choose  Directory ");
Dialog.create("Enter Job Name");
Dialog.addString("Name of Series", "Job1", 10);
Dialog.addNumber("Channel ID to Process", 0);
Dialog.show();
prefix=Dialog.getString();
ChannelID=Dialog.getNumber();

//you would need to define the 'increment' BEFORE, for instance by using a simple loop
//Please Note: I assume the number of Channels is maximally 10 (ch009) and identical for all timepoints)
//also every 'Job' must start with t0 to be detected.

ChannelNumber=0;
while (File.exists(dir+prefix+"_t0_ch00"+ChannelNumber+".tif")) {
ChannelNumber++;
}

if (File.exists(dir+prefix+"_t0_ch00"+ChannelID+".tif")) {
run("Image Sequence...", "open=["+dir+prefix+"_t0_ch00"+ChannelID+".tif] starting=1 increment="+ChannelNumber+" scale=100 file=["+prefix+"]");
}

Best regards,
Ingo

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Johannes Schindelin
Sent: Dienstag, 20. Oktober 2009 12:34
To: [hidden email]
Subject: Re: Import array of images as ImageSequence?

Hi,

On Tue, 20 Oct 2009, Adam Cliffe wrote:

> I'm trying to write a macro which opens some of the images in a folder
> as an image sequence.
> i.e. the files are named
> Job1_t0_ch000.tif,
> Job1_t0_ch001.tif,
> Job1_t1_ch000.tif,
> Job1_t1_ch001.tif,
> Job2_t0_ch000.tif,
> Job2_t0_ch001.tif,
> Job2_t1_ch000.tif,
> Job2_t1_ch001.tif,
> etc...
>
> I would like the macro to open all the images with Job1 and ch001 in
> the title.
> I can't work out a way of imputing both of these parameters into the
> 'Import image sequence' dialog.
>
> Its easy to make an array of the files I'd like to open (startsWith
> Job1, endsWith "ch001.tif")
> but I can't work out how to open all these files as one tif stack (in
> my case there would be several hundred).
>
> Does anyone know a way of doing this?

How about reading the files one by one and then running "Images to Stack"?

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

lechristophe
In reply to this post by Adam Cliffe
Adam,

The second box in the import image sequence dialog ("Enter Pattern")
takes regular expressions (RegEx) to form mutliple conditions on the
name. Learn how to use them here :
http://www.proftpd.org/docs/howto/Regex.html
particularly the "Wildcard" section.

To open images that have "string1" and "string2" in their name
(anywhere in the name) use :
.*string1.*string2.*
in the "Enter PAttern" box.

On Tue, Oct 20, 2009 at 11:54 AM, Adam Cliffe
<[hidden email]> wrote:

> I'm trying to write a macro which opens some of the images in a folder
> as an image sequence.
> i.e. the files are named
> Job1_t0_ch000.tif,
> Job1_t0_ch001.tif,
> Job1_t1_ch000.tif,
> Job1_t1_ch001.tif,
> Job2_t0_ch000.tif,
> Job2_t0_ch001.tif,
> Job2_t1_ch000.tif,
> Job2_t1_ch001.tif,
> etc...
>
> I would like the macro to open all the images with Job1 and ch001 in
> the title.
> I can't work out a way of imputing both of these parameters into the
> 'Import image sequence' dialog.
>
> Its easy to make an array of the files I'd like to open (startsWith
> Job1, endsWith "ch001.tif")
> but I can't work out how to open all these files as one tif stack (in
> my case there would be several hundred).
>
> Does anyone know a way of doing this?
>
> Thanks
>
> Adam
>
>
>
> Dr Adam Cliffe
> Research Scientist, Rorth Lab
>
> Institute of Molecular and Cell Biology
> 61 Biopolis Drive
> Proteos
> Singapore 138673
>
> tel: +65 6586 9731
>
>
>
>
>
>
>
>
>
> Note: This message may contain confidential information. If this Email/Fax
> has been sent to you by mistake, please notify the sender and delete it
> immediately. Thank you.
>
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

mmettlen
To revive this thread:
I have an array named "files" of length "h" and filled with paths pointing to certain images on my hard drive (e.g. D:\rawImages\condition1\image1.tif, D:\rawImages\condition1\image2.tif, ...)
Due to the files selected, I cannot use directly File=>Import=>Image sequence and therefor was wondering how to use the array "files" to build an image sequence by:
run("Image Sequence...", "open=XXXX  number=h starting=1 increment=1 sort use")
Reply | Threaded
Open this post in threaded view
|

Re: Import array of images as ImageSequence?

Rasband, Wayne (NIH/NIMH) [E]
On Feb 12, 2014, at 10:20 AM, mmettlen wrote:

> To revive this thread:
> I have an array named "files" of length "h" and filled with paths pointing
> to certain images on my hard drive (e.g. D:\rawImages\condition1\image1.tif,
> D:\rawImages\condition1\image2.tif, ...)
> Due to the files selected, I cannot use directly File=>Import=>Image
> sequence and therefor was wondering how to use the array "files" to build an
> image sequence by:
> run("Image Sequence...", "open=*XXXX * number=*h* starting=1 increment=1
> sort use")

Try using the File>Import>Stack from List command. Here is the description of this command from the ImageJ User Guide:

Opens a stack, or virtual stack, from a text file or URL containing a list of image file paths]. The images can be in different folders but they must all be the same size and type. The Virtual Stack From List macro [1] demonstrates how to generate a list of images and then use that list to open the images as a virtual stack. The OpenStackUsingURLs macro [2] demonstrates how to how to open an image series from a remote server.

[1] http://imagej.nih.gov/ij/macros/VirtualStackFromList.txt
[2] http://imagej.nih.gov/ij/macros/OpenStackUsingURLs.txt

-wayne

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