Saving as OME tif macro errors

Hello everyone,

I am having trouble with a macro I have written. In the macro, I want to select an input and output folder, open a stck of images, create a hyperstack, assign LUTs and finally save as an OME.tif.

This final part (saving as an OME.tif° is causing me a problem. I keep getting an error when I run the macro saying a ‘)’ is expected in the line containing the run(“OME-TIFF…” command.

Here is the code I have written, maybe someone can spot what I’m doing wrong? Thanks in advance.

//////// 
inputDir = getDirectory("choose the input directory");
outputDir = getDirectory("choose an output directory");
listdir = getFileList( inputDir ); 
for (i = 0; i < listdir.length; i++); { 
        path = inputDir + listdir[i-10]; 
        if ( File.isDirectory(  path  )  ); { 
                
              run("Image Sequence...", "open=" + path + " sort"); 



imagesName=getTitle();

getDimensions(width, height, channels, slices, frames);

channelNumber = 3;
trueslices= slices / 3;
pixelWH= 7.9;
pixelD= 11.25;
 


run("Stack to Hyperstack...", "order=xyczt(default) channels=" + channelNumber + " slices=" +trueslices+ " frames=1 display=Composite");

run("Properties...", "channels=" +channelNumber+ " slices=" +trueslices+ " frames=1 unit=micron pixel_width=" +pixelWH+ " pixel_height=" +pixelWH+ " voxel_depth=" +pixelD+ "");

run("Split Channels");
list1 = getList("image.titles");

selectWindow(list1[2]);
run("Blue");


selectWindow(list1[1]);
run("Green");

selectWindow(list1[0]);
run("Red");




run("Merge Channels...", "c1=" + list1[0] + " c2=" + list1[1] + " c3=" + list1[2] + " create");




omeConcat = outputDir + imagesName;

run("OME-TIFF...", omeConcat, "compression=Uncompressed");
outputName = getTitle();
selectWindow(outputName);
close(outputName);



               
        }; 
} ;
//////// 

When I tried to record a macro with ome tiff saving, the signature is as follow for me
run("OME-TIFF...", "save=[MyPath/test.ome.tif] compression=Uncompressed");
so maybe you could have
run("OME-TIFF...", "'save=['+ omeConcat + '] compression=Uncompressed'");

Thanks for the help!

in the end run("OME-TIFF...", "save=" + omeConcat + " compression=Uncompressed"); was what worked!

1 Like

Great you can tick your answer as solving the question then :wink: