File f = new File(dir1+list[i]);
if (!f.isDirectory()) {
Reader reader = new Reader(masterModel);
ImagePlus [] impTab = reader.open(dir1, list[i],false,false,false);
for (int k=0; k<impTab.length; k++){
ImagePlus img = impTab[k];
if (img!=null) {
img = process(img);
if (img!=null){
if (img.getStackSize() != 1) {
for (int slice=0; slice<img.getStackSize(); slice++){
img.setSlice(slice);
ImageProcessor ip = img.getProcessor();
ImageProcessor newip = ip.createProcessor(ip.getWidth(),ip.getHeight());
newip.setPixels(ip.getPixelsCopy());
String slicename = img.getTitle();
slicename +=("_slice");
String numb = IJ.d2s(slice,0);
slicename += "_"+numb;
ImagePlus img2 = new ImagePlus(slicename, newip);
save(img2, dir2, format, k);
slicename ="";
numb ="";
}
} else save(img, dir2, format, k);