Imref2d or 3d show wrong resolution

2 visualizaciones (últimos 30 días)
thatguy14
thatguy14 el 14 de Sept. de 2020
Comentada: thatguy14 el 28 de Sept. de 2020
Hello,
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

Respuesta aceptada

Julianna Mather
Julianna Mather el 28 de Sept. de 2020
Editada: Julianna Mather el 28 de Sept. de 2020
The "world limits" you provide in the 2nd and 3rd arguments to imref2d measure from the outside of the pixels, not the centers.
You stated that the pixels have a width of 0.5 units, so the image raster starts on the left edge at 0.75 = (1 - 0.5/2) and goes to 100.25 = (100 + 0.5/2) on the right.
So you would call imref2d this way: R = imref2d([199 199], [0.75 100.25], [0.75 100.25]);
  1 comentario
thatguy14
thatguy14 el 28 de Sept. de 2020
Thank you for your answer and that clears it up.
This is of course my opinion but I think this should potentially be made more clear in the imref2d and 3d page with a few words under those properties? I don't think it is obvious from the examples given that the extent referenced is the edge of a voxel rather than the center. But again, maybe I just think differently and this is "standard" process.
I appreciate your time regardless!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by