Trakem2 align stack slices script needed for multiple image data sets

Hello everyone,

I have 121 tile folders each including 10 images (same tissue stained with different markers).

I need a script to align these images in each folder automatically. Making the alignment 121 times by dragging the image folder into the Trakem2 is extremely time consuming. Moreover, macro record function does not work with Trakem2.

Any help would be appreciated.

Hi @mesencephalon,

I’m happy to help, but I won’t have time to write code in the foreseeable future, but I can help by pointing you to resources and in debuging stuff.

First, can you give some more details, i.e.

  1. How many images are there per folder?
  2. Are you aligning the sections of a stack or doing montaging?
    2a) What gui commands / and parameters have you found work for your problem?
  3. How do you want to export the results?

Second, do you have much programming experience in general or with trakem2?
This repositiory has some scripts that might help you, but it depends on your answers to the questions above.

John

Let me describe what I am trying to accomplish first. We have a multiplex IHC method called MICSSS in which single slide is stained by different markers consecutively (iterative cycles of staining/scanning/bleaching). This method generates multiple RGB chromogenic IHC whole slide images of a single slide, so all images are generated from the same tissue.
I am trying to register those whole slide images of the same tissue by tiling them and registering the tiles separately. I have 121 tiles generated from 10 different marker whole slide images. This makes 121 tile folders each have 10 small tile images in them and these 10 images have the same size and they are all from the same location of the tissue. These tiles have 10 percent overlap with each other with the purpose of compensating irregular borders after the registration.

Answers to your questions:

  1. 10 images per folder. 121 folders total.
  2. I will just align those 10 images with a stack and
  3. I will save the registered images in the corresponding folder. I dont need the transform data.

I’ll check that repository, thanks a lot!I have not much coding experience. It is not possible to script from scratch for me.

1 Like

Hi @bogovicj, I couldn’t find a proper script in that repository. Could you please point out a script there which is relevant to my problem. I think I couldn’t find due to my lack of experience in programming.

Hi @mesencephalon,

I’ll try to point out the relevant parts, and outline the process. (All the files that repository ending in bsh are scripts.)

  1. Make a new trakem2 project
  2. Make layerset and import images
  3. Affine alignment
  4. Save the project
  5. Do elastic alignment
  6. Save the project again
  7. Do the export
    7a) Grab the patch on a layer (the image to export)
    7b) Get the transform, apply it to the image
    7c) Export the image (write to file)

I know its alot and you’re new to programming. But just take it slow, step-by-step, and don’t be shy about asking questions!

John

1 Like