Add to name of image Title macro

Hello everyone,

I am writing a macro to upload files from a folder and save them as an image sequence to make them easier to identify when I bring them to cell profiler.
Images are named “BPAECells001” in which there are four images, from 1-4 (BPAECells002…003…004)
There are three channels, and I would like to indicate them by “_c001, _c002, and c003” respectively within each of the four images to it would read as the following example for the first channel: BPAECells001_c001

Here is the code I have been using:

//Prompt User Change File name
waitForUser("Please change the file name in script line 12 by typing 'name=XX' after 'format=TIFF'. \n\nClick OK afterwards");

//Prompt user change save path
waitForUser("Please change file directory in script line 12 after 'save='. \n\nClick OK afterwards");

///////////////open all files of folder
dir = getDirectory( "Choose the Directory" );
list = getFileList( dir );
for ( i=0; i<list.length; i++ ) {
    open( dir + list[i] );
	run("Image Sequence... ", "format=TIFF start=1 digits=3 save=[C:/Users/Ryan Stephansky/Desktop/Cell Profiler Documentation/CellProf images to segment/]");

//close all images
run("Close All");

Whenever I insert a name into the code for run(“Image Sequence…” I cannot aptly rename the file as I want it, and if I write “name=BPAECells001_c” the macro only processes the first file as it is likely overwriting all 4 files with the same name.

Any suggestions would be very helpful!


Hello @micronryan,

Welcome to the forum. Your question is similar to this question. After reading up, maybe you can think of the solution yourself. If not, ask for more hints, there are other threads in this forum about manipulating colour tiff files and splitting their channels. hint! See the Command Finder (windows) or Help (mac).

1 Like