Stacking and scanning what software

Hi,
Just trying playing with blood smear for the very first time and I wonder if it’s any guide how to do it, what should be scanning steps, no of pictures, used soft.
I found the Fiji but not sure if it’s good for newbies like me.
So if you want what should i read to find out more please let me know.
Thank you in advance
Kris

1 Like

That is a really nice image. The focus is sharp across the field of view which should give nice stacking and scanning. @JohemianKnapsody is developing a specific stack, scan and tile suite for the microscope, Automated Slide Scanning and Tiling - General - OpenFlexure Forum. I don’t know how far that is from being packaged in a way that can be used easily.

To get good registration for tiling the images in a scan you need good overlap, I think 30% of the frame overlapping with the previous is common. Once you have the images Fiji is one of the commonly used stitching algorithms, @dgrosen has used it quite a bit I think: Sharing an (almost) whole slide scan - Contributions - OpenFlexure Forum

1 Like

Looks good to me, for stitching Fiji Stitching isn’t too complicated if you have a powerful PC.

As William says, I’m working on something that’ll stitch OFM images automatically, if you’ve calibrated the Camera Stage Mapping then it shouldn’t take any inputs other than a link to the folder. Information on how to set it up is at OpenFlexure / openflexure-stitching · GitLab, and if it’s not clear then any feedback on the instructions would be really helpful

1 Like

I’m using a simple method I found using Hugin (https://hugin.sourceforge.io/) and a couple of command-line instructions in your image directory:

First, align the images using:

align_image_stack -m -a OUT $(ls)

(This command will take each image in a directory and generate an aligned version of the image in .tif format)

Then, focus-stack using:

enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --output=FocusStacked.tif OUT*.tif

(This command takes the aligned images and selects the areas in focus from each, to generate the focus stacked version)

(Instructions copied from a couple of blogs - Nature photography with magnification: Using Hugin for focus stacking ; focus stacking hugin)

I’ve only used the default settings, so I’m sure some improvement is possible, but I’m happy with the result - keep in mind the input images I used here are very low res, you can get much better results.


(Left: Image stack before alignment, Right: After alignment)

Hadn’t heard about Fiji, but it looks like a great tool as well!

1 Like

Thank you for the all your feedback.
One more question. I found out that during a stage moving the focus seems to be lost, when the stage is back to initial position the focus is ok again. It looks like moving in x,z axis has influence on Z axis. It no standard behaviour?
If so, should I use autofocus for scanning, and maybe together with Z step (how much and what should be the steps, like 20?).
For X a Y steps like 2500 and 1500 seems to be ok (there is 30% margin which should be enough).
Best regards
Kris

PS
regading the script installation i got the error :frowning:

pi@microscope:~ $ pip install git+https://gitlab.com/openflexure/openflexure-stitching.git
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting git+https://gitlab.com/openflexure/openflexure-stitching.git
  Cloning https://gitlab.com/openflexure/openflexure-stitching.git to /tmp/pip-req-build-1sk6de05
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-1sk6de05/setup.py'

You will almost certainly need to autofocus for images in a scan. The depth of focus is very small for high resolution, so any vertical motion will put it out of focus. Apart from any actual misalignments or errors, the flexure geometry will give a small vertical motion during x-y movement as it takes the stage effectively over the top of a sphere. The scan routine in the Openflexure software does autofocus. The standard autofocus range is 2000 steps I think. You could reduce it as you are starting close to focus, but 20 is likely to be too small because of backlash.

@JohemianKnapsody has been working on this aspect as well :slightly_smiling_face:.

Hi Kris. After using almost all alternatives out there I found that Fiji (imageJ) is the most reliable for image stitching. The grid collection option of the stitch plugin works good for me. I have also used z-stacking of up to 5 images to get crisper images before stitching. This was particularly useful for cytology smears where there are too many focal points. Also z-stacking helped bringing out of focus areas due to the openflexure parallax effect.
I have scanned a 20x20 grid (400 images) using a 40x objective, but that was just pushing the limits. My default for histology is 10x10 with Z=1 and for cytology 10x10 with Z=3. I do z-stacking using Fiji.
Please be aware that Fiji tends to crash when stitching these large images if you the image output options set to “fuse and display”. To avoid this I select “write to disk” under image output and then merge the three RGB channels.

EDIT: I made this quick video some time ago on stitching. https://www.youtube.com/watch?v=Qqbl_wfDiiY
Hope this helps

2 Likes

The OpenFlexure team will give you a more detailed and technical answer. Mine is just from using it.

The stage moves like a dome creating a parallax effect. I found that 500 steps works well on histology sections and 600-800 steps for cytology. If your samples are too thick you may need more steps or use the z-stacking approach.

I found that after a long move the edges of the filed may be out of focus. This is also largely dependent on your built, the alignment of the optic parts, etc. Since the stage is the last layer to print, it may be slightly irregular. Sanding a little and using the clips helps a lot. I had microscopes built that have perfect focus every time and other that are terrible. On one microscope built I had a terrible out of focus upper right corner. @JohemianKnapsody added a piece of tape on the area out of focus to raise the slide slightly. This made the whole area to be in focus.

1 Like

Thank you.
One more question, do you do z-stacking using Fiji before doing x/y stiching ? And what is the plugin name you use.
Thank you in advance.
Kris

I use stack focuser, but there are plenty of other options if you google it.
https://imagej.nih.gov/ij/plugins/stack-focuser.html

Do z-stacking before XY stitching to create the new image. The new image filename should be sequential for the fiji stitching macro to work.

Stitiching before stacking may not be possible since some photos will be out of focus, confusing the macro.

D

1 Like

Thank you.