users > Resampling passes
Showing 1-4 of 4 posts
Display:
Results per page:
Nov 8, 2012  03:11 PM | Ben Sutcliffe
Resampling passes
Hi,

Can anyone help with this?

If I specify a different --coarsest value for the upper limit for image sampling under Image resolution parameters, how can I find out how many times my image will be re-sampled?

Also how many refinements (control point grid resolution levels), under Transformation parameters, will there be?

I cannot seem to find this information in warp help.

Thanks,

Ben
Nov 8, 2012  05:11 PM | Torsten Rohlfing
RE: Resampling passes
Hi Ben:

So the simple answer first - there is no refinement of the warp control point grid unless you use the "--refine" command line option. This takes as its parameter the number of refinement steps, starting with the initial grid spacing ("--grid-spacing").

The more complicated part - image refinement. Basically, a hierarchy of images (some call it pyramid) is constructed, beginning from the highest resolution. The first resampled image will have the resolution (i.e., pixel size) determined by the "--sampling" parameter. That defaults to 1 (mm or whatever your unit of spatial dimensions is), which may well be inappropriate for non-typical (non human, non MRI, etc.) images.

Anyway, beginning from "sampling", pixel size is doubled repeatedly until "--coarsest" is exceeded.

So, for a simple example, let's say your original pixel size is 0.7 mm, you leave "--sampling" at 1mm and set "--coarsest" to 3mm (I am intentionally making this not be a power of two for the purpose of this example.

Then your image hierarchy would be built with pixel sizes:

  0.7mm, 1mm, 2mm

Registration would start at the end of this list and move in order of decreasing pixel size.

If in the above you set "--coarsest" to 4, you should see the following series:

  0.7, 1, 2, 4

But be aware that due to floating point arithmetic, you may end up without the last level (4) if 1.0*2.0*2.0 happened to be slightly larger then 4 (e.g., 4.000000001), in which case the 4mm level would not happen.

I hope this answers your question. I know this is a bit counter intuitive, but the design goal here (15 years ago by now) was to control the image resolutions directly, rather than specify a number of levels.

Coincidentally, I later retrofitted the alternative way of selecting number of levels to the linear registration tools ("registration" and "registrationx"), via the "--auto-multi-levels N" option. I guess a similar thing could be done for the warp and warpx tools, but they have the additional complication that for multi-level deformations, both image resolution and control point spacing have to be refined simultaneously in some sensible manner.

Anyway, let me know if you have additional questions!

Torsten
Nov 9, 2012  08:11 PM | Greg Jefferis
RE: Resampling passes
Hi Torsten,

A couple of follow-up questions/points to this.

1. If you have an image with resolution 3 mm and you set coarsest to 8 and leave --sampling as is, what happens?
2. Help for registration/warp says that --sampling defaults to -1 (which suggest and invalid value rather than a value of 1mm to me).

Thanks a lot,

Greg.


Nov 10, 2012  05:11 AM | Torsten Rohlfing
RE: Resampling passes
Thanks Greg, you are right, my memory was a bit fuzzy here.

So the default "--sampling" is indeed negative, which means in effect that it is automatically set to the maximum of all three pixel size dimensions, in either fixed and moving image. So if you have 3x3x5 mm in one image and 1x1x2 in the other, you'd start at 5mm. Thinking about it now, one would likely prefer for this to be image-dependent, but it is what it is (otherwise, it would also complicate getting the two image pyramids synchronized).

That should answer Q2.

Not for Q1, I would need to know the exact pixel size in x,y,z to answer, but say you have 3mm isotropic in both images. Then you'd have image resolutions 3 and 6 (no 12 because > 8). For isotropic pixel size, you'd effectively get the finest resolution run twice, which takes some time but otherwise won't hurt much.

If you have, however, something like 3x3x4 pixel size, you'd be seeing original,4,8 as the resolution levels (here and above, the actual optimization will start at the end of the list and go backwards, toward increasing resolution and smaller voxels.

TR