Posted by
Ingo Bartholomaeus on
Oct 21, 2009; 7:38am
URL: http://imagej.273.s1.nabble.com/Import-array-of-images-as-ImageSequence-tp3690686p3690689.html
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