How do I stitch multiple images in a spiral order
5 views (last 30 days)
Show older comments
Hi I am trying to stitch images in a spiral order starting from the center moving outward.
I have anywhere from 16-100 microscope images that need to be stitched together to form a square. The microscope takes images in a spiral and are labeled in sequential order of how they are taken. The images are named like so, AS-PC-7173_200824160001_A01f00d0, AS-PC-7173_200824160001_A01f01d0, AS-PC-7173_200824160001_A01f02d0,... the bolded letters represent the image number so for example, a 4x4 montage image will have images in order from 00-015. I am currently using the imtile() function but I have to manually rename each image in the position the function stitches them which is right to left and top to bottom.

This is a representation of how the images are taken, 0 being the first image and 63 being the last. In order for my imtile() function to work I rename image 63 (AS-PC-7173_200824160001_A63f01d0 as 01, image 62 as 02, image 61 as 03, and so on.
The only code I have right now is as follows:
myFolder = '/Users/...';
fileFolder = fullfile(myFolder,'*.tif');
imds = imageDatastore(fileFolder);
stitched = imtile(imds);
imshow(stitched);
Is there a way to have matlab stitch images in an order of my choosing or even a way to rename my images in the order imtile() would stitch. (Rename them as 63, 63, 61, 60, 59, 58, 57, 56, 36, 35,...
Thanks for the help!
Answers (1)
jonas
on 27 Aug 2020
Edited: jonas
on 27 Aug 2020
I would just put each image in a cell array, A(1)... A(n) based on their original name.
Then it's just a matter of indexing. Here I've made 10000 2x2 RGB images as an example, using spiral() to make the indices.
for i = 1:10000
A{i} = repmat(i/10000,2,2,3);
end
new_id = spiral(100);
A_new = A(new_id);
I = cell2mat(A_new);
imshow(I)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!