I am not sure what I am misunderstanding about the use of the Imref features. This came up when I was setting up some DICOM coordinates but can be shown with a simple example.
Let's say I know that the x and y direction coordinates for each voxel can be stated as
x_coord = 1:0.5:100;
and same for y. The first value is the first coordinate position, the middle is the pixel spacing, and last is the last coordinate given. This would give an image size of 199x199.
I then use imref2d:
R = imref2d([199 199], [1 100],[1 100])
which is giving the size, and the x/y world extents from min to maximum.
When this is inspected, it then says that the PixelExtentInWorldX is 0.4975 - obviously incorrect from what I stated above.
So my question is, are the world limits defined as inclusive for the minimum and exclusive for the maximum? To get the correct spacing I would have to specify:
R = imref2d([199 199], [1 100+0.5],[1 100+0.5])
i.e., add the pixel spacing to the end extent. This seems a bit messy when using imref3d, espcially when considering the use of it with imwarp.
Thanks, let me know if I should clarify anything