6

I have a set of fMRI images. One group has a dimensionality of 90 x 60 x 12 x 350 with voxel dimension 1 x 1 x 1 mm (350 volumes). The other group has a dimensionality of 80 x 35 x 12 x 350 with voxel dimension 0.2 x 0.2 x 0.5 mm. I'm using one of the images as reference image for registration. Due to the difference in resolution the registration fails (with flirt). So I have to first downsample or upsample. I have tried the following approach:

flirt -in input_image \ -ref good_size_image \ -out output_image \ -applyxfm \ -init /usr/share/fsl/5.0/etc/flirtsch/ident.mat

This does not work, not for downsampling and not for upsampling.

How should I do correct downsampling / upsampling?

machinery
  • 5,972
  • 12
  • 67
  • 118
  • for starters `tri-linear interpolation` see this [inverse interpolation of multidimensional grids](http://stackoverflow.com/a/25658628/2521214) it might help a bit (the image there is tri linear filtering) but I suggest you google out tri-linear interpolation (Wiki) – Spektre May 27 '15 at 07:48
  • when you say 'this does not work' does that mean that your down-/upsampled images do not look right or that the registration of the down/upsampled images fails? maybe some example results would help. – alle_meije Jan 11 '17 at 08:37

2 Answers2

7

If I understand correctly then you have images whose spatial extent are (a) 9 x 6 x 1.2 cm^3 and (b) 1.6 x 0.7 x 0.6 cm^3? Those are quite small and quite different. I can imagine that if image 2 covers a very specific sub-region of image 1 (because it is much smaller) you may need to give a good starting estimate to get a correct result.

if input_image has the dimensions (b) and good_size_image has the dimensions (a) then with the call

flirt -in input_image 
      -ref good_size_image 
      -out output_image 
      -applyxfm 

(init option is not strictly necessary in this case),

your output will be the image showing the much smaller space in much larger voxels. I assume the output image would have the size of the reference image (that is the idea of the reference image) but most of it would be empty. Switching (a) and (b) would not make sense because the space of the reference image can then only cover a tiny part of the input. You would need to register first.

You may want to experiment with the option applyisoxfm which resamples an image to cubic voxels of a given size.

flirt -in small_image -ref small_image -out small_1mm -applyisoxfm 1

will resample the image that covers the space (b) to 1x1x1 mm^3. Again, that is probably to coarse a resolution for so small a space. maybe resample both images to 0.5 mm isotropic and then register?

For these problems the FSL mailing list is a much better place to find help.

alle_meije
  • 2,424
  • 1
  • 19
  • 40
  • +1 for `-applyisoxfm`, which handles changing the origin correctly (`-applyxfm -init $FSLDIR/etc/flirtsch/ident.mat` + `fslcreatehd` doesn't and creates higher resolution images but with an incorrect origin) – Erik Kastman Jan 09 '18 at 17:59
1

Did you try with the fslmaths -subsamp2 command?

  • 3
    I upvoted because this is an oft-used approach, and OP should be aware of it, however, `fslmaths -subsamp2` causes some pretty bad aliasing. `flirt ... -applyisoxfm 2` gives considerably better results. – TheChymera May 25 '16 at 21:50
  • 1
    `-subsamp2` is definitely easier (and can be used in a sequence of commands of one `fslmaths` call) but does not usually respect the geometry. One place where this matters is downsampling a MNI space image at 2mm (size 91x109x91). Standard 4mm MNI images have size 45x54x45, but `-subsamp2` will give you 46x55x46. – alle_meije Jun 30 '16 at 12:36