Macro Error for: Splitting Confocal Channels & Merging them

Hey everyone,

I had an Imaging course last week, so this is my first try to make a macro myself in FIJI. I want to easily use the batch macro, to open my confocal files, then split the channels and merge them afterwards. There I want to set the LUTs do different colors add a scale bar to the composite, flatten this image and finally export all 4 images to png (3 individual channels in new LUT colors + the flattened composite with the scale bar).

I have tried my best with the macro. The problem is, that I need to put the image name into a variable (I called it “originalImageName”) to process all images without changing anything all the time. Here comes my Macro:


open("/Users/…");

originalImageName=getTitle();

run(“Split Channels”);

run(“Merge Channels…”, “c5=[selectWindow(C1-”+originalImageName")] c6=[selectWindow(C3-"+originalImageName")] c7=[selectWindow(C2-"+originalImageName")] create keep ignore");

run(“Scale Bar…”, “width=10 height=5 font=18 color=White background=None location=[Lower Right] bold overlay”);

run(“Flatten”);


The Error I get says: Error: ‘)’ expected in line 7:
Line 7 would be:

run(“Merge Channels…”, “c5=[selectWindow(C1-”+originalImageName")] c6=[selectWindow(C3-"+originalImageName")] c7=[selectWindow(C2-"+originalImageName")] create keep ignore");

Can someone help :slight_smile: ?

Best,
Emi

Hi,

Welcome to the forum.

So, two things, you don’t need the selectWindow function, just the name and you need to have a “+” symbol at the end of a variable as well as the beginning.

So your merging line should look something like this

run("Merge Channels...", "c5=[C1-" + originalImageName + "] c6=[C3-" + originalImageName + "] c7=[C2-" + originalImageName + "] create keep ignore");

1 Like

Amazing ! It works. Thank you so much :slight_smile: