2D image to 3D atlas mapping

Hi all, I have a very specific need, which I haven’t managed to solve (for distinct reasons) with available software. The data that I have is composed of 2D images (8bit single channel (DAPI) .tif files) of brain slices (each image is one full coronal mouse brain slice). Using a custom pipeline I find cells of interest (using the other channels on that image that for the current purpose is not important) and annotate their 2D coordinates (relative to each particular image). So what I have is a set of 2D images and points of interest (image_id, x_position, y_position.

The aim is to add this information (the coordinates of the cells of interest) to the 3D brain atlas (the Allen Institute one), so that I can combine the information for different slices and different mice (sliced with different angles, and the slices are not matching 100% in between mice either). The end result would be, for each point of interest, its position in the 3D atlas (x_position, y_position, z_position).

My initial thought was to find a transformation, using elastix, directly from the 2D slice to the 3D atlas, but I don’t think that is possible atm.

My plan now is to find, for each physical brain slice that I have, the corresponding slice in the atlas (using big data viewer, or any available matlab plugin designed for this, that doesn’t matter), and then calculate the 2D-2D transformation using elastix (probably a non-rigid one). Then, apply that transformation to the coordinates of the cells of interest, and then ‘put those coordinates’ into the 3D volume. For that I would need to use the information of the 3D position of my virtual slice.

Is there any software that allows this?
In a nutshell what I need is: slice a 3D volume in any orientation and save two things:

  1. the virtual slice as a .tif image.
  2. for every pixel in the virtual slice (1), the corresponding xyz positions of the atlas (this could be used as a look up table). Alternatively, a transformation that can be applied to a 2D point to get a 3D point.

Any help is much appreciated

pinging @NicoKiaru :slight_smile:

3 Likes

Some threads from this forum you may already know, I’m linking them for the record:

All the individual components to meet your needs are probably already there (in matlab, python, or c), but combining them conveniently for your use case, may require a lot of work.

As far as I’m concerned, I’m actively developing this tool : GitHub - BIOP/ijp-imagetoatlas: Atlas display and registration tools, and I think your need may well fit into it, I’ll try to post something when it’s a bit more stable. The components I’m re-using are the ones from the BDV / Fiji ecosystem, especially BigWarp (BigWarp - ImageJ). I’ve also transformed the allen brain atlas into something compatible with BigDataViewer, if you want to play with it : https://zenodo.org/record/4173229#.YAlT3xYo9EY

3 Likes

Hi @Hernando_Martinez ,

I just stumbled across this thread and I think I may have exactly what you need :slight_smile: I recently wrote a tool that’s called Slice2Volume for this job exactly. It maps histological sections (ideally from a slidescanner) to a 3D volume. It’s originally intended for brain image data. You find it here.

It’s almost not documented as of now, so here are a few usage notes:

  • The histological slices need to be evenly spaced (e.g. a slice every 150microns or so. Missing slices can be interpolated, but the script will run into trouble if slices are spaced like |150microns|200microns|250microns|100microns|etc

  • The slices need to be named correctly: The script is looking for a convention like XXXX_Scene_Y in the filenames, whereas XXXX refers to the number of the slide and Y refers to the number of the tissue section on the slide. The images can be stored all in the same directory or in separate subdirectories like this:
    /0001_Scene_1/subdir/myimage.tif
    /0001_Scene_2/subdir/myimage.tif
    /0002_Scene_1/subdir/myimage.tif

  • you need to know how much tissue was discarded: Typically a bit of tissue is thrown away before the first staining - it’s important to know how much (in microns) this was

  • The Atlas should have the same orientation as the histological data (coronal, sagittal or axial for the image to work.

I’ll add the documentation in the days to come, let me know if you need help!

Edit: now features some basic documentation for usage.

Best, Johannes

1 Like

Thanks for all the tips. Because my data did not fulfill some of the criteria for some tools like S2V, I ended up using something more custom made, based on BDV and elastix, and transformation steps, in order to see my cells of interest in the atlas.

  • from 2D histology to 2D atlas (transformix).
  • from 2D atlas to 3D atlas (using information form the Mobie plugin to recover the position.
    This works very nicely but at the moment has some resolution limitations. I have a repo in case anyone is interested, but at the moment is in its bones and poorly documented. I will be happy to share and make it nicer if anyone needs to use something like this though!
1 Like