Hi all. Have anyone figured out an easy way to stitch images acquired using stack and scan feature?
Thanks
Hi all. Have anyone figured out an easy way to stitch images acquired using stack and scan feature?
Thanks
I don’t think there is a native openflexure stitcher. A couple of mentions of successful stitching on the forum here and here .
Thanks William. I saw those posts before. I was able to stitch using ImageJ using a simple script that I made. However, the biggest problem I have is that the file names generated by open flexure software are confusing. It saves the images as using the X, Y, Z coordinates I think. It will be much easier having a sequential file name system or something like that.
Hi
I’ve been looking at ways to stitch images and I’ve found (but not tried for now) these:
I just started using Microsoft’s Image Composite Editor like you described above. The part for me that was hard to understand was setting up the Stack and Scan and what direction it would go? How many steps to configure it for overlap of the images at say a 50% overlap? I find that “Snake” makes the most sense to me because it starts in the lower right corner and works its way up first on the Y, then left on X and back down, etc as it snakes across the stage.
So, to scan the whole stage where my max on X and Y is 50000 I can do this…
I watch the debug output now in an SSH window and it appears scanning the whole stage took 973 seconds, so 16 minutes.
With my steps at 10 on x and y, that’s 10x10, so it will create 100 images. I resized the images to 640x480, so the disk usage for that is 17MB.
I download the gallery collection.
Then I open the folder in Microsoft’s ICE (Image Composite Editor) and just use all of the automatic settings.
After stitching my image seems screwed up, so I’m guessing 5000 was too large of a step as the stitcher wasn’t able to guess at the correct position of each image. It’s like I ended up with almost no overlap.
So I went back and used the “Structured Panorama” approach. Here’s the settings I used to force it to the “snake” pattern that the microscope used to grab the images. What I don’t get is that Zigzag seems to give me a better preview here than Serpentine, even though I would presume Serpentine in Microsoft’s app matches “Snake” in the microscope app.
The final stitched image looks pretty good, although I have some blurry spots where I think the app had to guess. So that bothers me.
I went back and chose Serpentine.
And here’s the result. I’m still confused as I would think this would be the correct setting, but it doesn’t appear to be.
In conclusion, the best result for me despite some of the blurriness is
That is a good stitch on a very challenging image. There is a lot if blank area that does not give the algorithm very much to go on to match up where it should be joined together. Something with detail all across the slide will work much better.
I tried to run the stitching again with steps at 2500 to get more overlap. To scan the whole stage requires 20x20 steps then, so 400 images instead of 100 images, which takes MUCH longer to run.
Whew! That took 2776 seconds or 46 minutes. It was about 106MB for the images.
I tried using all of the automatic settings.
And it worked great but it did take about 45 minutes for the stitching to complete.
Hello! If you want to upload your images for me to download somewhere I can give it a go using my method and report back to you. Then if it’s successful I can detail the steps for you.
I’ve found ImageJs stitching tools to be much better once you get the parameters right.
N.B - to combat your problem of the image sequence labelling, you can import the images from your folder (sorted by date) into a stack in Imagej, then export the image sequence with sequential filename numbering.
Thanks so much nonacastro for the links. I was not aware of the MIST software. I will try it and report back.
Gracias por tu ayuda!
Thanks John! I really appreciate you took the time to comment on my post. I went through the same hoops and loops to get a stitched image. However, I used ImageJ which gave me better results and can support stacked images as well.
Like William said, I found that large blank areas are not ideal for stitching. I solve this using a marker to fill the gaps and then delete with photoshop.
I did successfully completed some stitching but it is very laborious to get it done. I am planning to scan HUNDREDS of slides for teaching and research purposes. Hence, trying to develop a “drag and drop” solution.
So this is what I did and what worked best for me so far:
If I was able to rename the images sequentially then I run the following script in imageJ (fiji).
This script assumes you have “stackfocuser” plugin installed
Stack Focuser
images are sequentially renamed as “img#.jpeg”
dir = getDirectory(“Choose image sequence folder”);
title = “Untitled”;
width=512; height=512;
Dialog.create(“New Image”);
Dialog.addString(“directory:”, dir);
//Dialog.addChoice(“Type:”, newArray(“8-bit”, “16-bit”, “32-bit”, “RGB”));
Dialog.addNumber(“X:”, 5);
Dialog.addNumber(“Y:”, 5);
Dialog.addNumber(“Z:”, 5);
//Dialog.addCheckbox(“Ramp”, true);
Dialog.show();
title = Dialog.getString();
X = Dialog.getNumber();
Y = Dialog.getNumber();;
Z = Dialog.getNumber();;;
//type = Dialog.getChoice();
//ramp = Dialog.getCheckbox();
//if (ramp==true) type = type + " ramp";
//newImage(title, type, width, height, 1);
print(X,Y,Z)
i=1
FS=1
{for (xx=1;xx<X+1;xx++)
{for (yy=1;yy<Y+1;yy++)
{
for (zz=1;zz<Z+1;zz++)
{
FN= “img”+i+“.jpeg”;
open(dir+FN);
print(“X:”,xx,“Y:”,yy,“Z:”,zz,“FN:”,FN);
i=i+1;
}
run(“Focus Search Bar”);
run(“Images to Stack”, “name=Stack title= use”);
run(“Stack Focuser “, “enter=5”);
selectWindow(“Focused_Stack”);
selectWindow(“Stack”);
selectWindow(“Focused_Stack”);
saveAs(“Tiff”, dir+“Focused_Stack”+FS+”.tif”);
print(“filename:”,FS);
FS=FS+1;
close();
selectWindow(“Stack”);
close();
}
}
}
run(“Grid/Collection stitching”, “type=[Grid: column-by-column] order=[Left & Down] grid_size_x=X grid_size_y=Y tile_overlap=30 first_file_index_i=1 directory=[dir] file_names=Focused_Stack{i}.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap computation_parameters=[Save memory (but be slower)] image_output=[Fuse and display]”);
saveAs(“Tiff”, dir+“Fused.tif”);
Here is a good one after playing with the settings
Once again. Thanks for the good vibes and camaraderie
Daniel
I agree on ImageJ. I use it a lot and get good results.
As you can see in my post above, is hard to sort by date because many images have the same timestamp.
Another great opensource stitching software:
Hello,
A bit late to the discussion, but if anyone is still interested, we managed to come up with a lightweight focus stacking algorithm based on Python. I am aware that the discussion was also about stitching the images first, which our code is not capable of doing. But if someone is only interested in focus stacking, you might want to check out our code.
Cheers
Silvan
Hi @Nijeri, that’s cool - I am sure someone will want to make use of this, so it’s great to have a link.