title: Image mosaic-ing in Matlab
body: <p>I am trying to do some image analysis over tiles of a big tif image. I have already done the processing required in each of these tiles and in this step I have to create one mosaic out of these tifs. I read somewhere that I can use 'cat' function for this reason. As I am not really pro in programming I found it easy and tried to apply it. The tiles I have are about 154 tifs and I tried the cat over 4 of them and it works and now I should expand it over all the files. My problem now is to apply it over all the tifs. The codes for 4 of them was: </p>
  
  <pre><code>img1 = imread ('E:...\'a1.tif','tif');
  img2 = imread ('E:...\'a2.tif','tif');
  img3 = imread ('E:...\'a3.tif','tif');
  img4 = imread ('E:...\'a4.tif','tif');
  
  image1 = cat(2,img1,img3);
  
  image2 = cat(2,img2,img4);
  
  image3 = cat(1,image2,image1);
  imshow(image3)
  </code></pre>
  
  <p>as you see in the code two by two should be stitch horizontally and the result would be stitch vertically to have the final image. M question is how through these amount of images I define which ones should be stitch first horizontally and then the resulted images stitch vertically. I would be really thankful if you guys could help me with it. Any other approaches would be welcome.  </p>