Imref2d or 3d show wrong resolution
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Julianna Mather
2020년 9월 28일
편집: Julianna Mather
2020년 9월 28일
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]);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!