There are number of things that are worth optimising when first starting to register a new kind of image. These include some of the parameters that are fed to the initial affine and warping registration.
First it is important to make sure that the initial affine step is giving a good seed to the warp. If the affine isn't working well the warp may never be able to clean up the mess.
Although some parameters are scale free (perhaps the key one is --energy-weight
), several of the other key parameters are expressed in the space units (ie microns or mm) of the image data. It may be necessary to vary these according to the field of view of the image.
Initial Affine Registration
(See also all affine parameters)
- Check how this is doing by reformatting after the affine step. You can do this with munger.pl using a command like:
munger.pl -r 01 -l a -s <referencebrain> <sample brain/dir>
- Consider using the make_initial_affine tool to provide a better initial estimate (eg using principle axes) and then feeding that to the full affine registration
- Make sure that the initial exploration step size is appropriate (
--exploration
). This is the distance in µm that the optimiser moves. May need to be larger if the FOV is larger. I have used 8µm for 160x160x80µm volumes. Twice that would be a good idea for eg 400 x 400 x 160 µm. - consider using mean square difference (MSD) rather than Normalised Mutual Information (NMI) if staining intensity is similar (
--metric 4
).
If you are using munger.pl or the simple GUI (which calls munger) you need to pass these parameters onto the affine registration program using munger's -A
switch. For example your standard munger.pl command line invocation might look like:
munger.pl -awr 01 -s image reference.pic .
Some recent experimentation suggests that it would be a good idea to use a lower accuracy (--accuracy
) for the initial affine. It seems that a large part of the time is being spent on the final step sizes. By default these go to 0.1 µm which seems excessive since the affine will be be cleaned up by the subsequent warping registration anyway. It seems to me that 1 µm should be fine.
To change these affine parameters from the defaults, you would change your command line as follows:
munger.pl -awr 01 -A '--exploration 16 --metric 4 --accuracy 1' -s image reference.pic .
Warping Registration
(See also all warp parameters) and munger.pl parameters.
- Make sure that you have a good starting affine registration
- Make sure that initial grid point spacing (warp
--grid-spacing
; munger-G
) is appropriate to the image size. This is a number in µm or mm or whatever the space unit of your image is. Torsten says aim for about 3 grid points along the shortest axis. eg 400 x 400 x 160 µm choose at least 80µm (he was going to suggest 200µm given the 400 µm in XY but obviously that mightn't work so well in Z). - Make sure that the initial exploration step size (warp
--exploration
; munger.pl-E
) is large enough to allow displacements that might need to be considered (ie how far off are points after the best initial affine registration?). ie if points are still displaced by 30µm at the start of the warp your exploration should be of this order. - … but comfortably (3x?) less than the grid spacing. If the value is too large then you will get folding. I used 16 µm for 160x160x80 brains), Torsten says up to 30 µm for 400^2×160.
- Refine the grid (warp
--refine
; munger.pl-R
) until your final grid spacing is appropriate for the radius of curvature of objects in your sample. Each level of the multiscale registration usually increases the number of grid points by 2 (this too can be changed if you want!). So if your starting grid point spacing is 40 µm and you refine 3 times, your final grid point spacing will be 40/2^3 = 5 µm, which we have found reasonable for our partial fly brains in the Cell paper. If you double the initial grid spacing for an object with the same spatial frequencies, you should still aim to end up with the same final grid spacing, so refining 4 times would make sense. - Choose a sensible value for the coarsest resampling of the brain image (warp
--coarsest
; munger.pl-C
) at the initial stages of the registration. I used 4 µm for my 160x160x40µm images but I think 8 would be better for the 400x400x160µm images. Imagine resampling your image to this voxel size (eg in ImageJ) and thinking if that would be enough information.
Note that if you are using munger.pl or the simple GUI (which calls munger) there are 2 ways to access some of the key warp command line parameters. You can either specify a parameter directly to munger or you can use a general method for passing parameters onto warp unchanged.
If you are using munger.pl or the simple GUI (which calls munger) you need to pass these parameters onto the warp registration program using munger's -W
switch. For example your standard munger.pl command line invocation might look like:
munger.pl -awr 01 -s image reference.pic .
To change these warp parameters from the defaults that munger will pass, you would change your command line as follows:
munger.pl -awr 01 -W '--exploration 26 --coarsest 8 --grid-spacing 80 --refine 4 --accuracy 0.2' -s image reference.pic .
However it is recommended that you do this:
munger.pl -awr 01 -X 26 -C 8 -G 80 -R 4 -W '--accuracy 0.2' -s image reference.pic .
because munger.pl will use some of these values to give the output files different names.
NB Step sizes have to be a power of 2 times the minimum exploration which is set by –accuracy. So if you have accuracy=0.2 and exploration=26, What you will actually get is:
25.6 12.8 6.4 3.2 1.6 0.8 0.4 0.2
so in practice –exploration 30 and –exploration 25 may give very different initial step sizes (25.6 µm and 12.8 µm, respectively)