passing arguments to Image Sequence

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

passing arguments to Image Sequence

Glen MacDonald
Hello,
I'm having difficulty passing arguments to open a series of TIFF images with the Import/Image
Sequence dialog.  I have OIF formatted files from the Olympus confocal. Multi-channel z-series
images are exported as a series of 16-bit TIFFs for each channel.  Also, a LUT for each channel and a
bunch of nuisance files with metadata are created.  The following should look at a user selected
directory, determine how many channels are present by the number of LUT files, then calculate the
location of first TIFF in the directory array.  The name of this tiff, number of TIFFs  and a bit of text
identifying which channel of TIFFs to import (file=C00n) should be passed to the command.

The commented out Image Sequence command at the bottom is the result of recording the macro.  
The values in the macro command are the last of the many permutations I've tried.  

thanks,
Glen

//number of channels = number of .lut files
//TIFF images per channel = TIFF files/lut

macro "File Array [F]"
{
        dir = getDirectory("Choose a Directory ");
        listFiles(dir);
        function listFiles(dir)
{
        list = getFileList(dir);
        for (i=0; i<list.length; i++)
    if (endsWith(list[i], ".lut"))  
      lut=lut+1;
        for  (i=0; i<list.length; i++)
        {
        if (endsWith(list[i], ".tif"))  {
                tiffnum=tiffnum+1;
                numtiffch=(tiffnum/lut);
                lastTiff=i;     }
        }
print("Number of channels: " +lut);
print("Number of TIFFs: "+tiffnum);
print("TIFFs per channel: "+ numtiffch);
offset=(lastTiff-(tiffnum*2)+2);//calculate the first tiff file in the directory array
filestart=dir+list[offset]; ///get that file name
firsttiff=File.getAbsolutePath(filestart);//make darn sure this is a string
run("Image Sequence...", "open= +firsttiff number= tiffnum starting=1 increment=1 scale=100
file=C001");
//run("Image Sequence...", "open=[/Volumes/UWCCR 2 GB/Image0002.oif.files/
Image0002_C001Z001.tif] number=126 starting=1 increment=1 scale=100 file=C001");
}
}
Reply | Threaded
Open this post in threaded view
|

Re: Eliminate characters from line?

Weller Andrew Francis
In relation to below, how would I eliminate both starting and trailing
characters, just capturing a middle component? For example, if I receive
the following:

50037631 5 2 1 164325 2 1 35 45 1

I am interested in just the "164325" part. So I guess I remove the first
n characters with:

answer = substring(answer, n, lengthOf(answer));

but how the remaining m characters?

Cheers, Andy

> Dear all,
>
> When reading from the Results Table, ie:
>
> answer = getResultLabel(0);
>
> how can I eliminate characters from the returned (answer)?
>
> For example, if the following is returned:
>
> 50062abcxyz
>
> I am only interested in "abcxyz" not the "50062" part -
> I would like them removed?

You can remove the first 5 characters from the string 'answer' using

     answer = substring(answer, 5, lengthOf(answer));

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

Re: Eliminate characters from line?

Wayne Rasband
On Jun 7, 2006, at 10:53 AM, Andy Weller wrote:

> In relation to below, how would I eliminate both starting and
> trailing characters, just capturing a middle component? For
> example, if I receive the following:
>
> 50037631 5 2 1 164325 2 1 35 45 1
>
> I am interested in just the "164325" part. So I guess I remove
> the first n characters with:
>
> answer = substring(answer, n, lengthOf(answer));
>
> but how the remaining m characters?

Call substring twice, first to remove the starting characters and a
second time to remove the trailing characters.

     s = "50037631 5 2 1 164325 2 1 35 45 1";
     s2 = substring(s, 15, lengthOf(s));
     s2 = substring(s2, 0, 6);
     print(s2);

Or you can use the split() function to get the 5th of n space delimited
numbers.

     numbers = split(s);
     print(numbers[4]);

-wayne