Reputation: 19
Does anyone know if it is possible to sort dicom files if there is no SliceLocation attribute?
By "sort" I mean arrange the images longitudinally (in a craniocaudal orientation) with the most superior images first followed by the inferior images.
After reviewing the forums it appears SliceLocation is an optional parameter.
I have access to the following attributes in my dicom data set.
(0008, 0018) SOP Instance UID UI: ID_32fede0dc
(0008, 0060) Modality CS: 'CT'
(0010, 0020) Patient ID LO: 'ID_4c8ee851'
(0020, 000d) Study Instance UID UI: ID_a362744476
(0020, 000e) Series Instance UID UI: ID_1ec35eec9c
(0020, 0010) Study ID SH: ''
(0020, 0032) Image Position (Patient) DS: [-115, -1, 146.599976]
(0020, 0037) Image Orientation (Patient) DS: [1, 0, 0, 0, 1, 0]
(0028, 0002) Samples per Pixel US: 1
(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'
(0028, 0010) Rows US: 512
(0028, 0011) Columns US: 512
(0028, 0030) Pixel Spacing DS: [0.44921875, 0.44921875]
(0028, 0100) Bits Allocated US: 16
(0028, 0101) Bits Stored US: 12
(0028, 0102) High Bit US: 11
(0028, 0103) Pixel Representation US: 0
(0028, 1050) Window Center DS: [00036, 00036]
(0028, 1051) Window Width DS: [00080, 00080]
(0028, 1052) Rescale Intercept DS: "-1024.0"
(0028, 1053) Rescale Slope DS: "1.0"
(7fe0, 0010) Pixel Data OW: Array of 524288 elements
Initially I though Image Position (Patient) might work but this does not seem to arange the images in a sequential order. I need a sequence because the temporal information is relevant for the detection of abnormalities.
Anyone have any bright ideas or is this simply not possible?
I am using:
Upvotes: 1
Views: 1349
Reputation: 16815
Sorting images by location is best done by using Image Position (Patient) [(0020,0032)]
if that tag is available (as it always is for example in CT and MR images). This is the most reliable way to do this.
As the tag contains three elements which represent the x, y and z coordinates in the DICOM coordinate system, you best sort by the main axis, e.g. the axis there the position changes most. In most cases, you probably already know that axis (in your case you want to sort cranio-caudal, so the axis should be in that direction), or you can easily check it by comparing slice positions, but you can also calculate it from Image Orientation (Patient)
.
Image Orientation (Patient) [(0020,0037)]
contains the normalized row and column vectors. To get the main axis, you can multiply these, and in the resulting vector the component with the largest absolute value will show the main axis.
In your example you have the row and columns vectors (1, 0, 0) and (0, 1, 0), by multiplying them you get (0, 0, 1), which means that the main axis is the z axis (e.g. the cranio-caudal direction in the DICOM coordinate system).
Upvotes: 5