如何计算体素大小? [英] How to calculate a Voxel size?
问题描述
从DICOM标头提供以下信息,如何计算体素大小的第三个值?我假设前两个值为0.515625和0.515625.
Provided following information from a DICOM header, how can I calculate the third value of voxel size? I assume the first two values are 0.515625 and 0.515625.
BitsAllocated: "16"
BitsStored: "12"
Columns: 512
HighBit: "11"
ImageOrientation: "1\0\0\0\-1\0"
ImagePosition: "-144\-34.7242241\925.599976"
ImageType: "ORIGINAL\PRIMARY\AXIAL\HELIX"
InstanceNumber: "456"
Modality: "CT"
PhotometricInterpretation: "MONOCHROME2"
PixelRepresentation: "0"
PixelSpacing: "0.515625\0.515625"
RescaleIntercept: "1"
Rows: 512
SamplesPerPixel: "1"
SeriesDescription: "CERVEAU SANS IV"
SeriesNumber: "3"
SliceThickness: "1.50"
WindowCenter: "00040\00040"
WindowWidth: "00120\00120"
imagesFormat: "jpg"
modality: "CT"
name: "soft tissue"
nodeId: "557621"
pixelHeight: "0.515625"
pixelWidth: "0.515625"
注意:我收到的是JPEG图像堆栈,而不是DICOM,它带有一个文件,该文件具有我在上面发布的值.如果需要,我可以回去询问文件中的其他信息.
Note: I receive a JPEG image stack, not DICOM, and it come with a file that had the values I posted above. I can go back and ask for additional information in file if needed.
推荐答案
仅给出一个切片的标签,您必须使用 SliceThickness
作为第三维,尽管我对此建议不建议,因为这不能保证给出切片之间的距离.有标签 SpacingBetweenSlices
提供了此信息,尽管您的情况似乎不存在.
Given only the tags of one slice, you have to use SliceThickness
as the third dimension, though I would advice against this, as this is not guaranteed to give the distance between slices. There is the tag SpacingBetweenSlices
that provides this information, though it seems not to be present in your case.
最好的方法是利用相邻切片之间 ImagePositionPatient
中的差异.为此,您当然当然还需要下一个切片的标签.附带说明:在您的清单中, ImageOrientation
和 ImagePosition
应该更好地将 ImageOrientationPatient
和 ImagePositionPatient
读为 ImageOrientation
和 ImagePosition
是其他标签(CT图像中不存在).
The best way is to use the difference in ImagePositionPatient
between adjacent slices. For this, you need of course the tag of the next slice, additionally. As a side note: in your listing, ImageOrientation
and ImagePosition
should better read ImageOrientationPatient
and ImagePositionPatient
, as ImageOrientation
and ImagePosition
are other tags (not present in CT images).
ImagePositionPatient
给出切片在DICOM患者坐标中的左上角的位置,并且要计算距离,您必须考虑切片在该坐标系中的方向.这由 ImageOrientationPatient
给出,该图像包含DICOM坐标中切片的归一化行和列方向余弦矢量.您可以在 DICOM上进行阅读.标准.
ImagePositionPatient
gives the position of the upper left hand corner of the slice in DICOM patient coordinates, and to calculate the distance you have to take into account the orientation of the slice in that coordinate system. This is given by ImageOrientationPatient
, which contains the normalized rows and columns direction cosine vectors of the slices in DICOM coordinates. You can read that up in the DICOM standard.
方向矩阵的前两个分量由 ImageOrientationPatient
提供(例如,前三个数字和后三个数字),可以通过取这两个分量的叉积来计算第三个分量.
The first two components of the orientation matrix is provided by ImageOrientationPatient
(e.g. the first and second three numbers), the third component can be calculated by taking the cross product of these 2 components.
因此,在伪代码中,它看起来像这样:
So, in pseudo code this will look something like this:
orient1 = vector(ImageOrientationPatient[0], ImageOrientationPatient[1], ImageOrientationPatient[2])
orient2 = vector(ImageOrientationPatient[3], ImageOrientationPatient[4], ImageOrientationPatient[5])
orient3 = orient1 x orient2 // cross product
orient_matrix = matrix(orient1, orient2, orient3)
pos1 = vector(ImagePositionPatient[0], ImagePositionPatient[1], ImagePositionPatient[2]) // from current slice
pos2 = vector(ImagePositionPatient[0], ImagePositionPatient[1], ImagePositionPatient[2]) // from adjacent slice
diff_pos = pos2 - pos1
image_pos = orient_matrix o diff_pos / length(orient3) // normalized dot product
voxel_z = image_pos.z
更新:@gofal指出,第一个版本不正确.我还包括了规范化(例如,按 length(orient3)
删除),尽管严格来讲,这些值应该已经规范化了.
Update: As pointed out by @gofal, the first version was incorrect. I also included the normalization (e.g. delete by length(orient3)
), though strictly speaking the values should already be normalized.
这篇关于如何计算体素大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!