STIR FAQ
STIR FAQ
How to display images generated by STIR?
By default, STIR uses a version of the Interfile format, although only a subset of keywords is implemented. (See the STIR web-site for more links on Interfile).
Amide and xmedcon read STIR .hv files without trouble as long as the data-offset is zero (e.g. files which are written by STIR). Other packages might ignore the scale factor (but STIR by default writes as floats with scale factor 1). And other packages might insist on using the official Interfile 3.3 standard. The .ahv files written by STIR are closer to that, but they have a tweak to let Analyze (from the Mayo) read them correctly (as Analyze misinterprets the z-spacing). Open one of the .ahv files in your text editor and read the comments.
STIR currently uses a home-grown way to specify the image origin. No other program supports this convention as far as we know (as Interfile currently does not have relevant keywords). STIR currently completely ignores patient orientation etc. So if you have an image of the same object written by a different program, and the display program tries to interpret coordinate systems, it's unlikely the 2 objects will be displayed in the same location.
How does the STIR coordinate system work (e.g. for generate_image)
Details are given in the STIR Developer's guide. Here we attempt to give some more info on how this works for images.
The origin of the STIR coordinate system is in the centre of the first ring of the scanner. Moreover, for an image with zero offset, the origin is assumed to coincide with the centre of the first plane.
Let's say you want to have the cylinder in the centre of the image. Then we need to compute the STIR coordinates of the centre. Given that (0,0,0) is at center of the first plane (see below), the center of the last plane is at ((num_planes-1)*z_voxel_size,0,0). And therefore, the middle of the image is at ((num_planes-1)*z_voxel_size/2,0,0).
There's another small complication. The STIR convention in x and y is
actually a bit different. When you have an odd number of voxels in x (or
y), the 0 coordinate is indeed in the centre of the image. But if you have
an even number, it's actually half a pixel off.