SIRF icon indicating copy to clipboard operation
SIRF copied to clipboard

ImageData.zoom_image() size orders

Open AnderBiguri opened this issue 3 years ago • 14 comments

I am trying to change the geometric info of an sirf.STIR.ImageData object.

While doing some tests, I tried:

import sirf.STIR as stir
stir.ImageData("myimage.hv")

off=img.get_geometrical_info().get_offset()

img.get_geometrical_info().print_info()
img=img.zoom_image(offsets_in_mm=(0.0,0.0,-off[2]))
img.get_geometrical_info().print_info()


Which prints:

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: (-371.52, -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

What threw me off is that offset is printed as (-350, -350, 21.52), the variable off has values off=(-350, -350, 21.52), yet, when I use the last value of off into offsets_in_mm, its the first value of the offset that gets changed.

This seems just a mismatch of python vs other (C++?) dimension storage issue (ImageData is indexed (z,x,y)). But it creates a strong undocumented inconsistency. I would expect that if I get the offset from an object, then set it to its negative, to return zero, without the need of rearranging the offset variable order.

Note this happens with all variables, not only offsets_in_mm.

I guess this is either the same, or a effect of #791

AnderBiguri avatar Oct 24 '20 13:10 AnderBiguri