it would be useful if you could provide a few test series with non-axial slice orientations. Have you encountered […] images with variable slice spacing or non-parallel slices?
TL;DR: Yes, it is relatively easy to address both of those needs with IDC.
And no, you should not have to decypher DICOM SeriesDescription to guess image orientation.
Background
The above question came from a collaborator developing certain image processing capability. Indeed, the variety of images available from IDC can be useful in selecting the needed samples.
All of the images available from IDC are in DICOM format, which relies on ImageOrientationPatient[1] to encode image orientation (various articles describe how this attribute can be used for reconstructing image volume [2][3], although in most cases this will be taken care of by the software you use to load the image, such as ITK or 3D Slicer). Most of the image series for cross-sectional radiology modalities in IDC are stored as a set of files, with the orientation defined per-slice, each slice of the volume saved in a separate file.
Since ImageOrientationPatient is a slice-level attribute, we will need to rely on BigQuery to search it. If you want to try out the queries below, you will need to first complete the BigQuery prerequisites discussed in this tutorial[4].
Grouping and sampling IDC images by image orientation
Let’s first get an idea of the values for ImageOrientationPatient in the data. That attribute contains two vectors defining orientation of the image plane, which are stored in the BigQuery column as an array of strings. We can query distinct values of that array aggregated into a single string for the major cross-sectional modalities as follows.
SELECT DISTINCT
array_to_string(ImageOrientationPatient, '/') AS orientation,
COUNT(DISTINCT (SeriesInstanceUID)) AS num_series
FROM `bigquery-public-data.idc_current.dicom_all`
WHERE Modality IN ('MR', 'CT', 'PT')
GROUP BY orientation
ORDER BY num_series DESC
Complete query result: IDC MR/PT/CT series per ImageOrientationPatient - Google Sheets
As you can see from the result of the query (only first 10 rows are shown), it is suboptimal, since due to the string representation of the floating point number, 0 and 0.00000 etc, or very small numbers are treated as different values. We can improve this by converting string values to floating point, rounding and converting back to string. I am also adding a new column that picks one of the series for each orientation value and builds a URL to open the corresponding series in the IDC viewer.
SELECT DISTINCT
array_to_string(
ARRAY(
SELECT CAST(ROUND(CAST(element AS FLOAT64), 2) AS STRING)
FROM UNNEST(ImageOrientationPatient) AS element
),
'/'
) AS orientation,
COUNT(DISTINCT SeriesInstanceUID) AS num_series,
any_value(concat("https://viewer.imaging.datacommons.cancer.gov/v3/viewer/?StudyInstanceUIDs=",StudyInstanceUID,"&SeriesInstanceUIDs=",SeriesInstanceUID)) as sample_viewer_url
FROM `bigquery-public-data.idc_current.dicom_all`
WHERE Modality IN ('MR', 'CT', 'PT')
GROUP BY orientation
ORDER BY num_series DESC
Complete query result: IDC normalized ImagePatientOrientation for MR/PT/CT with viewer URLs - Google Sheets
The updated result (only first 6 rows are shown) should be more useful, and you can easily verify that the second row contains URL for a coronal CT scan: https://viewer.imaging.datacommons.cancer.gov/v3/viewer/?StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.116909578713634902770119704523554615736&SeriesInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.236551424325042944424549153222216208228. This should answer the first question of how to select images of different orientations.
Selecting series that have inconsistent geometry
Looking at the example linked above, you can see a warning icon for the series in the viewer, and might notice the series contains a strange slice displaying a grid and having a different orientation.
To learn a bit more about what is going on, you can open “DICOM Tag Browser” in the viewer (you can find that in the drop-down toolbar section), and confirm that ImageOrientationPatient varies across the slices in this series, with most of the slices having 1\0\0\0\0\-1, and one slice 0\1\0\0\0\-1!

Let’s select cross-sectional series that have multiple values of ImageOrientationPatient across the slices - the following query is more complex, but builds upon the prior one!
WITH
formatted_orientations AS (
SELECT
SeriesInstanceUID,
array_to_string(
ARRAY(
SELECT CAST(ROUND(CAST(element AS FLOAT64), 2) AS STRING)
FROM UNNEST(ImageOrientationPatient) AS element
),
'/') AS orientation
FROM `bigquery-public-data.idc_current.dicom_all`
WHERE Modality IN ('MR', 'CT', 'PT')
),
series_with_multiple_orientations AS (
SELECT
SeriesInstanceUID,
array_agg(DISTINCT (orientation)) AS all_orientations,
COUNT(DISTINCT orientation) AS num_orientations
FROM formatted_orientations
GROUP BY SeriesInstanceUID
HAVING COUNT(DISTINCT orientation) > 1
)
SELECT
any_value(d.collection_id) collection_id,
#any_value(s.all_orientations) all_orientations,
any_value(s.num_orientations) num_orientations,
string_agg(DISTINCT (d.Modality), ',') modalities,
any_value(concat("https://viewer.imaging.datacommons.cancer.gov/v3/viewer/?StudyInstanceUIDs=",d.StudyInstanceUID,"&SeriesInstanceUIDs=",d.SeriesInstanceUID)) as series_viewer_url
FROM `bigquery-public-data.idc_current.dicom_all` d
INNER JOIN series_with_multiple_orientations s
ON d.SeriesInstanceUID = s.SeriesInstanceUID
WHERE d.Modality IN ('MR', 'CT', 'PT')
GROUP BY d.SeriesInstanceUID
ORDER BY num_orientations DESC
You may be wondering what kind of CT series has 377 distinct values of ImageOrientationPatient? I will save you the effort of running the query by pasting the link from the result: https://viewer.imaging.datacommons.cancer.gov/v3/viewer/?StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.4334.1501.230619032860725731609749439682&SeriesInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.4334.1501.124856962567987872851664631318.

Query result (only those series that have more than 2 distinct orientation strings): IDC MR/PT/CT with number of orientations per series - Google Sheets
In a similar manner, you can select series that have inconsistent value of PixelSpacing, or slice dimensions, as defined by the Rows and Columns DICOM attributes, by modifying the last query (or add a note to this thread and I will be happy to add that query!).
Downloading selected series
Any of the DICOM series or DICOM studies can be easily downloaded to your computer, if you want to use those, or examine them further.
Assuming you have Python and pip set up on your system, all you need to do is install the prerequisite idc-index package
pip install --upgrade idc-index
which will set up command-line download tools on your system. To download the series in the last example, you can run the following
# pass SeriesInstanceUID or StudyInstanceUID (or collection_id) to this command line tool
idc download 1.3.6.1.4.1.14519.5.2.1.4334.1501.124856962567987872851664631318
In conclusion
DICOM metadata contains answers to not all, but many mysteries about the data. Don’t ignore it - it can often help you make your tools more robust and ready for real-world challenges. IDC gives you tools to become familiar with DICOM metadata, and a reasonable sample of real-life DICOM data to help you develop robust analysis workflows.



