Change numeric file names into meaningful names

Hello,

I have 72 files named 00 to 71. Each file corresponds to a given replica with a given treatment like this:
image

Is there a way of automatically (with a macro) renaming the images into for example:

Control_0mM_Replica1_Position1
Control_0mM_Replica1_Position2
Control_0mM_Replica1_Position3
Control_0mM_Replica1_Position4

Drug_25mM_Replica3_Position1
Drug_25mM_Replica3_Position2
Drug_25mM_Replica3_Position3
Drug_25mM_Replica3_Position4

Thank you very much

Here is a IJ macro code to show how the names can be created from the numbers:

drugs = newArray("Control_0_mM", "Drug_5_mM", "Drug_10_mM", "Drug_15_mM", "Drug_20_mM", "Drug_25_mM");
reps = newArray("Replica1", "Replica2", "Replica3");

for (i = 0; i<72; i++){
    drugID = Math.floor( i / 12);
    tmp = i - drugID *12;
    repID = Math.floor( tmp / 4);

    name = drugs[drugID] + "_" + reps[repID] + "_position";

    IJ.log("" + i + " : " + name);
}
2 Likes