Superimpose atlas image onto microscope picture



Hi all,
I’m new in this forum and I’m a beginner with ImageJ.
My question(s) regards how to superimpose rat brain picture (from Paxinos Brain Atlas) onto microscope rat brain image, because I need to count cells in specific brain regions. I knew how to draw line with ImgaeJ but this method is not so accurate. The most accurate method it will be superimpose atlas panel picture onto microscope image. I have watched tutorials on youtube and read articles as well as user manual, but still I cannot figure out how to do it. Furthermore, I cannot manage on how to register properly atlas picture with my interested brain slice, in order to avoid any deformation which can compromise the outcome of cell count. Can you help me to manage with this?
The atlas picture, which has a well defined brain regions, should be transparent and just only the dashed lines should remain in order to have precise brain regions outline.
I am working with ImageJ which run on Windows 7.

Since I am a new user I cannot attacha ny file, but I will share with all of you a link to google drive folder, in which you can find the both pictures:

Your help will be really appreciated.

I hope I was clear enough.

Many thanks.


Alignment between two images based on a multi-point ROI

Hello @SimMem and wellcome to the forum!

Just curious : do you have a link for this atlas ? Can you only get a tif file format for the atlas or are there vectorial images (svg for instance) available ?


Hello NicoKiaru,

thanks for welcoming me in this forum.

I do not have a link for the atlas, but at the link I posted in my topic you can find both microscope as well as atlas pictures. Both are .tif file. I am sorry, but I do not know if they are vectorial images.


Hum, but where did you get the atlas file ? If you provide a website link, I could check if there are alternative file formats.

To be fair what you ask for is not very straightforward with ImageJ. We have a workaround in our facility where we use OnTopReplica, but that’s not ideal, and it works only with Windows ( The documentation is sparse, if you’d like to know more I can give more details.

Maybe others have better options…



my supervisor shared with me that file. I have only the link to buy it, not to get the pdf file.

I guessed that my question(s) would not be so easy to answer. Do you think if I use OnTopReplica then I could manage with superimpose the images?
Anyway, it will be a pleasure if you could share some info with me.
Thanks a lot!


You could do this in a few steps:

a- align the atlas with the image

b- select the region you’re interested in. (and/or save it to file)

c- prepare the rat image for analysis (bkg sub, thresholding)

d- use “restore selection” on your rat image (or load it from the file)

e- perform “analyze particles” while the selection is active.

For step a I would suggest TurboReg and a rigid or affine transform, in manual mode. It will require you to manually move two or three (depending on what transform you are using) reference points on each image. The source is the atlas, the target is the mouse brain image. Once applied, you will get an aligned version of the atlas, that you can use to perform step b. You might have to convert the atlas image to 8-bit first.




Hi @SimMem,

I don’t have much to add to @Thomas_Pengo 's great suggestion, except with a bias toward a tool I wrote we’re calling bigwarp. It lets you align / warp the atlas to your image on the fly (manually), and visualizes images together. In a minute, I was able to produce:

though I obviously don’t know rat anatomy :man_shrugging:

A quick gotcha, I had to run this quick script on your atlas to make visualization easier.

run("Split Channels");
selectWindow("Figure 6 rata brain atlas.tif (red)");

Let me know if you want to give it a try and I’m happy to help,


Looks super nice! But I feel stupid because I can’t put any landmark…
One just need to hold spacebar and left click sequentially in the big dataviewer windows ?

Nothing shows up. Neither on the image nor on the table. What could I be missing ? Keyboard layout ? Should I press on the original image windows ?

I tried left click and right click… But whether I hold space or not, I rotate the image with a left click and drag the image with a right click.

When I press T, I just get an error message because, of course, no deformation can be estimated.




Thanks @NicoKiaru,

No, not your fault at all, I just forgot about this. It sounds like you ran into a bug someone found awhile ago. It’s fixed, but the new version hasn’t made it to the update site yet.

To get the fix, just replace the bigwarp jar in your fiji plugins folder with the newest release, downloadable from here.

In this new release, you tap Space to enter “landmark mode” and tap it to exit.*


*In older releases, holding space down is how you placed landmarks.

Edit: wording


@NicoKiaru @bogovicj @Thomas_Pengo thanks a lot, to both of you, for your advice.
So, basically, to do want I want to do I need:

  • download both the plugins TurboReg and bigwarp;
  • open both images with ImageJ/FIJI;
  • modify the atlas picture (make it transparent) using TurboReg;
  • with bigwarp I will align/warp the atlas to my image;
    So once I complete such path, I will have a picture as @bogovicj attached, am I right?
    Your advice make me in a very good mood…now I will try to apply your advice, I will let you know if I was able to do it!

Thanks a lot!



Hi @SimMem,

If you’re using Fiji, then you don’t need to download bigwarp, you already have it. ( Plugins > BigDataViewer > Big Warp ).

You won’t need both TurboReg and Bigwarp, just one. They both will let you do step ‘a’ in @Thomas_Pengo’s list above. i.e. both TurboReg and Bigwarp let you align images to each other.

There are other steps that you’ll need to do to get regions of interest / selections from the atlas. (steps c and d above), though those should be straightforward.

Give the alignment a try, and then post back if you’re having trouble with next steps.



hi @bogovicj,

Thanks a lot for your explanation.

Now I am trying to align with BigWarp, but when I select it and the two images were opened, appear also a dialog window in which is wrote:
Opening dataset that is not suited for interactive browsing.
Consider resaving as HDF5 for better performance.
So I cannot select the landmarks point in the moving image. Can I have some clue about it?

I am aware I am asking a lot of question, but for me this kind of things are quite new.

Your help is well appreciated.

Thanks a lot.



Hi @SimMem
That’s also very interesting to me so I played with BigWarp. I did a small screencast with your data, and I will share it within in an hour.

For the error message, you just don’t need to care.



Hi @NicoKiaru,

thanks for sharing.

With the error windows seems that the program does not allow me to do anything more. Maybe is due to my inexperience. I will figure out something.



Have you tried to press space and click on the images ? Can’t you put a ‘red’ point on the open images ?

If not, you may have the same problem than me. In that case just do what @bogovicj wrote:

Here’s the promised screencast:

(Note: do a lot of mouse wheel movement down = downscaling, when pressing T)

I find this plugin awesome, but there are a few unatural things to handle with bigdataviewer. So don’t hesitate to ask if you have problems reproducing this. Carry on! The result is worth it.


Hi @NicoKiaru @bogovicj @Thomas_Pengo

thanks to your advice I was able to superimpose the outline onto microscope image. I need to practice more to make more precise the outline, but the big part of the job is done.
It was not neither hard, nor so immediate, but thanks to all of you and to your FIJI skills I did it!!!
I will continue to practice, and I will let you know how its goes…in mean time I will attach my result :grin: :grin: :grin:

Here it is the link:

Thanks again to all of you!


Hi @NicoKiaru and @bogovicj

Is it possible to overlap the ImageJ ROI file to the brain image(Simone post) by bigwarp? The ROI files are drawn based on the standard brain atlas.

We got the matlab files from website which is the brain atlas(attached Coronal Rat Brain Atlas 1 to 80 wD fixed.mat (446.8 KB)

Is it possible to convert the matlab files to the imageJ ROI files?

If the Matlab file is not possible converted to ROI file, can make it based on standard Brain Atlas?



Hello @Jet_G,

This should be possible but it’s not straightforward.

  • First: this matlab file seems to have its own convention and file format (is it taken from here ? What it means is that it requires some work to make it ‘understandable’ by Fiji. In short : how to convert this particular file to ImageJ ROIs ? It’s doable, but it requires some work (understand the API, file format, them write some code to make a converter from this file to ImageJ ROIs)
  • Second: once you have managed to get ImageJ ROIs, you need to transform them according to the deformation you defined in BigStitcher --> this part should be ok, because BigStitcher can transform a list of points (which is just what ROIs is made of).

If it was possible to have this atlas in a standard vectorial file format, like svg (what the allen brain atlas did), or even in the form of a list of coordinates (csv for instance), things would be easier…




Hi @NicoKiaru,

The m-file is one of files dowloaded from Carlos Brody’s lab website ( ).
I think I am not able to convert the m-file to imagJ ROIs with my naive programming skills at the moment. Prefer the easy life…

You mentioned the svg files, which can be dowlorded from

So, what is your further suggestions to get the imageJ ROIs easier?

With best wishes,


Hi @Jet_G,

So here’s one possible way of doing what you want:
1- Download a svg image from the atlas (for instance
2- Open the svg image on FIJI (it will ask for a width and height, you can keep the default parameters (700 and 512), but you can make it bigger if you wish to make it smoother).
3- Align this image with the slice by using Big Warp
4- Export the deformed atlas image with Big Warp (but take care, choose NEAR NEIGHBOR interpolation, that’s important!)
5- With the deformed atlas image, execute this groovy script ( -> it will transform the label image into a list ot ROI, put into the ROI Manager

One thing which is not ideal is that the ROI will look like ‘broken lines’. But to make it nicer, this would require to use Big Warp to transform a list of points (defined by their coordinates) rather than an image. This way the vectorial svg would be better used. How easy is it to transform a list of points with BigWarp @bogovicj ? Is there a way to get the deformation and apply it to points instead of images ? Is that doable currently ?