Open 2 images with different suffix and do Image Calculator on them in batch mode

Hi everyone,
I’m quite new in this forum and was wondering if you can give me some hints on a macro I’m having troubles to run.
Basically, I have more than 60 samples and for each of them I created 2 different masks saved as .tif with 2 different suffix, let’s say “RBCmask.tif” and “czi_mask.tif” and I have to combine them using the Image Calculator AND operator. Lastly, I have to save them with another suffix ".mask.[extension], all of this in a batch mode for all the 60 samples.
I tried in the way below but it didn’t work :confused:

Do you know how to make it work?
Thanks a lot!
Antonio

  1. path=getDirectory(“Choose a Directory”);
  2. list=getFileList(path);
  3. parent=File.getParent(path);
  4. File.makeDirectory(parent+"/CombinedMask");
  5. for (i = 0; i < list.length; i++) {
  6. open(path+list[i]);
  7. name = getTitle();

11.path=getDirectory(“Choose a Directory”);
12. list=getFileList(path);
13. parent=File.getParent(path);
14.
15. for (i = 0; i < list.length; i++) {
16. open(path+list[i]);
17. name = getTitle();
18. imageCalculator(“AND create”, name+“RBCmask.tif”, name+"_czi_mask.tif");
19.
20. saveAs(“Tiff”, parent+"/CombinedMask/"+name+"_mask");
21. close();
22. run(“Close All”);
23. }

As error, it’s saying:
Image not found in line 18: imageCalculator ( “AND create” , name + <“RBCmask.tif”> , name + “_czi_mask.tif” ) ;