Rendering two NRDD files side to side with different origin, space coordinates and spacing


I have two NRRD files:

  • T2W (1)
  • ADC (2)

When I load these two files in Slicer I can see that slicer automatically positions them in space according to their metadata and performs interpolation. I can tell that because (2) has a larger spacing than (1) and yet I can visualize slices from (2) as I scroll through (1).

I am writing a python script that take these two files and visualize them side to side. I don’t think I need to run registration since I already know the origin, spacing and orientation of each volume (as per their NRRD headers).

So, how can I do this: For each slice in (1) I want to show what would be the corresponding slice in (2)

I know that somehow I need to apply an affine transform and do some interpolation in (2) to change coordinates but I am a bit lost.

Since my frame of reference is (1), and say that its affine transform is T_1, perhaps I can apply T_1^{-1} to (2) to obtain (2) in coordinates with respect to the origin and standard set of basis? But then what? how do I do interpolation? Any help is welcome. Thanks!

If you do all this in Slicer then you don’t have to worry about any low-level detail. You can set up two slice viewers to show the volumes that you need to see, set the slice plane normals to have the same direction, enable slice link, make it hot-linked (long-click on slice link icon and check the “Hot linked” checkbox).


Thanks for the info Andras.

I found a solution using SimpleITK. For those who might run into the same problem, here it is the solution:



It was not clear if you need interactive view or resampling. Resampling is available in “Resample scalar/vector/DWI” module in Slicer.

What does the hot link exactly do?

Hot-link synchronizes pan&zoom between slice views that has the same orientation. It is useful if you need to review multiple volumes side-by-side.

Also hot-link updates the sync on each pointer move, while regular link only updates when you release the button.

Ok, thanks.

When would one prefer regular link over hot link? If the views are going to be updated anyway, why not update them immediately instead of waiting to release the mouse?

It’s usually faster to only redraw the window where the mouse is moving and you are usually looking at the window where the mouse is, that’s why hot-link is just an option.