ImageJ won't open TIF file from macro to merge channels ("File is not in a supported format")

Dear all,

I am a beginner at ImageJ, and I’m getting desperate…

For a looooooong long time I tried to make a macro that would automatically take three images and merge them into different coloured channels, as I often have to do that for my work (on hundreds of images…).

I had finally managed to write a macro that worked (!!) a few weeks ago, now I wanted to use it again, and it stopped working… although it is still exactly the same (obviously).

I am now getting the error message “File is not in a supported format, a reader plugin is not available or it was not found”.

I double checked the file path and the file names, and both are fine.

The macro in question looks like this:

directory = getDirectory(“Choose a Directory”);

firstIndex = 1;
lastIndex = 50;

for (i = firstIndex; i <= lastIndex ; i++) {

open(directory + File.separator + "20201027_CDD_wt_MD_Synpo-561_Homer-647_MAP2-488_" + i + "_w1Conf488.stk_MIP.tif");
imageTitle1 = getTitle();

open(directory + File.separator + "20201027_CDD_wt_MD_Synpo-561_Homer-647_MAP2-488_" + i + "_w2Conf561.stk_MIP.tif");
imageTitle2 = getTitle();

open(directory + File.separator +  "20201027_CDD_wt_MD_Synpo-561_Homer-647_MAP2-488_" + i + "_w3Conf640.stk_MIP.tif");
imageTitle3 = getTitle();

run("Merge Channels...", "c1=[" + imageTitle3 +"] c2=[" + imageTitle2 + "] c3=[" + imageTitle1 + "] create ignore");

saveAs("tiff", directory+imageTitle1+"_composite");
close;

}

Can someone please give me a pointer as to what might be wrong here? I don’t want to make composites of 200 images by hand :frowning:

Best,
Anja

1 Like

Hey Anja @Anko ,

before opening the file, can you print(<filename>); the file name to check if it really exists?

Let us know if this helps!

Best,
Robert

1 Like

Oh my god… thank you Robert there was literally a mistake in the file name… :woman_facepalming:

I checked it twice and saw it the third time :roll_eyes::roll_eyes::roll_eyes:

Thanks, this was a valuable suggestion XD

1 Like