Bio-format importer error while converting to multiframe tiff

Hi all,

I have a each slice of the Z-stack as a separate .tif file for 4 different channels. I wanted to convert each channel as .tif by combining all the slices. I have written a small macro, here it is. But not working. I don’t know where I am going wrong.
Any help would be greatful.

“C01” is my channel number. My “path” looks correct

input = getDirectory("Choose input directory");
list = getFileList(input);
path = input + list[0];
print (path);
run("Bio-Formats Macro Extensions");
//Ext.setId(path);
run("Bio-Formats Importer", "open=path color_mode=Default group_files open_all_series specify_range view=Hyperstack stack_order=XYCZT axis_1_number_of_images=[] axis_1_axis_first_image=[] axis_1_axis_increment=[] file=C01 pattern=[] t_begin=1 t_end=234 t_step=1");
saveAs("Tiff", input+"F001_DAPI_C01.tif");

Thanks,

Lakshmi

You need to write:

run("Bio-Formats Importer", "open=" + path + " color_mode=Default group_files open_all_series specify_range view=Hyperstack stack_order=XYCZT axis_1_number_of_images=[] axis_1_axis_first_image=[] axis_1_axis_increment=[] file=C01 pattern=[] t_begin=1 t_end=234 t_step=1");

See: http://imagej.net/Macros#Using_variables

Hi Curtis Rueden,

Thanks for the reply. I tried that too. But not working still.

Regards,
Lakshmi

We won’t be able to help you further unless you provide more details.

Please see this guide to writing good issue reports.

Hi Curtis Rueden,

Thanks for your support. Sorry about the description. Hope this would be fine.
O.k. Probably I will describe an example here.
I have a separate .tif of slices of a Z-stack. For example I have 1_C01.tif, 2_C01.tif, 3_C01.tif, 4_C01.tif, 5_C01.tif. Now I wanted to make a Z-stack of with this 5 images as multiframe tiff (as a single image). In each image file name I am looking for a pattern “C01” which corresponds to channel. Like this, I have four channels. All the tif files of four channels are in the same folder so I am using the pattern search in Bio-formates. I trying to get a multiframe tiff file for each of the channels (i.e. for an image set I need to get 4 multiframe tiff files). According to above mentioned script, I need to have 4 “Bio-Formates importer” lines in one script. But when I am trying for one channel only it is not working. Surprisingly the same thing is working out side the macro i.e. when I go by clicking Plugins>Bio-formats importer>.
I have approximately 50 image sets to convert.
I am uploading an example image set here. Because of the size I am uploading 3 images of one channel(.C01) as a zipped file.
160307-VaradhaLiver-60x_A01_T0001F001L01A04Z002C01.zip (21.1 MB)

1 Like

Did you try recording a macro? You should only need to run the Bio-Formats Importer once, with the “Group files with similar names” option checked. It should detect all your TIFF files, and import them as a single multidimensional image.

I tried with your sample data and got it imported as 3 Z planes, using the “Pattern” option on the file grouping dialog box. Here is the macro, courtesy of the Macro Recorder:

run("Bio-Formats Importer", "open=" + path + "/160307-VaradhaLiver-60x_A01_T0001F001L01A04Z001C01.tif autoscale color_mode=Default group_files view=Hyperstack stack_order=XYCZT axis_1_number_of_images=3 axis_1_axis_first_image=1 axis_1_axis_increment=1 contains=[] name=" + path + "/160307-VaradhaLiver-60x_A01_T0001F001L01A04Z00<1-3>C01.tif");

Where ... is the path to your images.

Yes, I tried recording a macro. Based on that I had built the existing script. I tried Bio-formats importer with “Group files with similar names” option checked. Again it works when I do it by clicking Plugins>Bio-formats importer option.
But when I paste the same command in the macro it is not working. Anyways, here I am attaching a ppt with the screenshots of each steps of macro that I am trying. Also the ppt has what the “Log” window shows after running the macro. Hope this would be helpful to understand the problem better. I am really wondering where I am going wrong.

Thanks,

LakshmiImageJ_problem_forum.zip (5.8 MB)

It looks like you are running an old version of ImageJ (2.0.0-rc-19/1.49m; the latest is 2.0.0-rc-47/1.50i). Could you please download a new Fiji from http://fiji.sc/#download and test with that version? There may be related bugs that were fixed.

Yes. Your are right. Its working with the new Fiji version. Thanks very much for your support.

Regards,
Lakshmi

1 Like