SIRF icon indicating copy to clipboard operation
SIRF copied to clipboard

Document zoom_image() operation order

Open AnderBiguri opened this issue 3 years ago • 2 comments

If you zoom and offset in the same call to zoom_image() the amount of offset changes by some unknown/unexpected ratio.

I suppose this is because operation order?

e.g:

img.get_geometrical_info().print_info()
img=img.zoom_image(offsets_in_mm=(-10,0.0,0.0),zooms=(2.80005/2.76148, 1., 1.))
img.get_geometrical_info().print_info()
Offset: (-350, -350, 21.52)
Spacing: (1.36719, 1.36719, 2.80005)
Size: (512, 512, 411)
Dir mat: 
1, 0, 0
0, 1, 0
0, 0, -1

Offset: (-350, -350, 23.6132)
Spacing: (1.36719, 1.36719, 2.76148)
Size: (512, 512, 411)
Dir mat: 
1, 0, 0
0, 1, 0
0, 0, -1

the zoom is correct, but the offset is now +2.0932 instead of -10. This is because it first scales everything (including the offset) and then adds the offset to that result. Maybe this should be documented, or applied in different order (but this should be documented too, if that is the case).

(sidenote: the signs confuse me too, I can see that the Dir mat is negative, but maybe we should also document that the offset will be multiplied by the dir mat?)

AnderBiguri avatar Oct 24 '20 15:10 AnderBiguri