Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello,
I have this macro to open a stack-serie with two channels: // Macro for Reading Z-Stacks from Leica SP5 // Volker Hilsenstein - last change 14.8.2012 // Ask for source folder and get list of files in that folder folder = getDirectory("F://"); filelist = getFileList(folder); print(folder); print(lengthOf(filelist)); enhance_contrast = true; subsample = 1; // subsample the stack on loading, 1 means no subsampling, 2 is every other slice // check for presence of channels // and example filename iC0 = 0; iC1 = 0; sum = 0; filename_example = ""; for(i=0; i<lengthOf(filelist) ; i++) { if(indexOf(filelist[i],"C00")>-1) { if(iC0==0) { print("Channel 0 present."); } iC0++; if(lengthOf(filename_example)==0) { filename_example=filelist[i]; } } else if(!iC1 && indexOf(filelist[i],"C01")>-1) { if(iC1==0) { print("Channel 1 present."); } iC1++; if(lengthOf(filename_example)==0) { filename_example=filelist[i]; } } } sum=iC0+iC1; if(sum==0) { exit("no channels found"); } print("First file of stack sequence is " + filename_example + " in folder " + folder); if(iC0>0) { run("Image Sequence...", "open="+ folder + "//" + filename_example+ " number=sum starting=1 increment=" + subsample + " scale=100 file=C00 or=[] sort"); rename("tmpC00"); if(enhance_contrast) { run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel"); makeRectangle(26, 467, 468, 37); run("BG Subtraction from ROI", "number=2"); run("Select None"); run("Enhance Contrast...", "saturated=0.4 normalize process_all"); } sC0="tmpC00"; } else { sC0="*None*"; } if(iC1>0) { run("Image Sequence...", "open="+ folder + "//" + filename_example+ " number=sum starting=1 increment=" + subsample + " scale=100 file=C01 or=[] sort"); rename("tmpC01"); if(enhance_contrast) { run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel"); makeRectangle(26, 467, 468, 37); run("BG Subtraction from ROI", "number=2"); run("Select None"); run("Enhance Contrast...", "saturated=0.4 normalize process_all"); } sC1="tmpC01"; } else { sC1="*None*"; } I would like to adapt this macro to open more than one stack-series stored in the same folder. Here, an example of a folder with three different series: image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00.ome.tif Many thanks! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Sorry, the true sequence is this:
image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--001.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--002.ome.tif image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01.ome.tif |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
> image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--001.ome.tif
> image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--001.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--001.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--001.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--001.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--001.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--002.ome.tif > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01.ome.tif > ... [show rest of quote] Hey Sergi, maybe I would try to solve this problem incremental. First get clean sequences and then process them as desired. Sure, one could process them via.. > filelist = getFileList(folder); but speaking in terms of a naming convention your example above shows potentially 12 different sequences. So if this file naming is mandatory, you could store it in a text-file or array while execution, make a sorting/renaming of the files as desired, process them as wanted imported/converted to/as separate stacks .. i.e. Sometimes I'm some kind of fascinated why rather simple things can become complex mostly unintended as it seems. Could you provide more information about your naming scheme? Is it mandatory? Which Images should be interpreted/imported as one stack? Do the tiffs already contain slices? Maybe you could ask Volker Hilsenstein to help you.. All the best and beyond, Rainer -- Rainer M. Engel, Dipl. Digital Artist scientific|Media GbR Pichelsdorferstr. 143 D-13595 Berlin -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Thank you for your time, All values are constant except for Z position (from Z00 to Z87), Chanel (C01 or C00) and the sample number (SN: nothing, 001,002,...n samples)
My intention is open the stacks separately for each sample and each channel, and do it for all the samples in the same folder. Sergi 2012/12/18 Rainer M. Engel [via ImageJ] <[hidden email]>
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Sergi.novo
Hi Sergi,
One thing I notice is that your files are labeled as OME-TIFFs. If they are truly properly recorded OME-TIFF files, you can open them dataset-by-dataset using Bio-Formats, rather than manually with the "File > Import > Image Sequence" command. That is, each OME-TIFF file embeds information about its 5D structure, which other OME-TIFF files are part of the dataset, etc., so that Bio-Formats can open them all properly. As long as they haven't been renamed, and the metadata is written correctly to the OME-TIFF structure, it should work. Regards, Curtis On Mon, Dec 17, 2012 at 2:39 PM, Sergi.novo <[hidden email]> wrote: > Sorry, the true sequence is this: > > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C00.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z00--C01.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C00.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Z01--C01.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C00.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--001.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01--002.ome.tif > > image--L0000--S00--U00--V00--J08--E02--O00--X01--Y02--T0000--Zn--C01.ome.tif > > > > -- > View this message in context: > http://imagej.1557.n6.nabble.com/Macro-to-open-more-than-one-stack-series-with-two-channels-in-the-same-folder-tp5001189p5001192.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |