liveBook · Manning

DICOM

As explained in Deep Learning with PyTorch, Second Edition

A medical imaging standard for storing and exchanging scan data and associated metadata.

DICOM is the native file format for CT scans. It turns scan data from raw files into information that software can parse and use, while its headers preserve metadata needed to interpret the scan. section 12.3 section 12.4.1

For machine-learning work, the practical goal is usually not to manipulate DICOM bytes directly. A parser or library can load the data into a structured voxel array, leaving the project focused on the medical information rather than its low-level representation. section 12.3

DICOM-related data handling connects several coordinate and representation layers:

  • The CT scan becomes a three-dimensional voxel array with addressable indices. section 12.3
  • The patient coordinate system uses millimeters and defines positive X as patient-left, Y as posterior, and Z as toward the head; this orientation is abbreviated LPS. section 12.4.1
  • Metadata in the DICOM header relates patient coordinates to array indices, allowing anatomy locations to be mapped into the scan. section 12.4.1

Loading scan data through a library

A SimpleITK-based loader reads an image file and converts it into a NumPy array. The resulting object can expose 3D nodule-density data without requiring the application to implement a DICOM parser. section 12.3

Figure 12.4 Loading a CT scan produces a voxel array and a transformation from patient coordinates to array indices. This process is essential for converting raw data into a structured, machine-readable format suitable for analysis. The .mhd and .raw files provide the raw volumetric data, which is transformed into a 3D voxel array for easy indexing and processing.
figure

Shows the pipeline from raw scan files to a voxel array and the transformation needed for structured indexing. section 12.3

Figure 12.5 Using the transformation information to convert a nodule center coordinate in candidate coordinates (X,Y,Z) to an array index (I,R,C)
figure

Shows how a nodule location in patient coordinates becomes an array index. section 12.4.1

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Explains file parsing, voxel conversion, headers, coordinate conventions, and transformations, but defers DICOM’s detailed file specification.
Examples
Uses SimpleITK loading, NumPy conversion, voxel arrays, and nodule-coordinate transformations as concrete examples.
What it assumes
Assumes basic Python and array concepts while teaching file parsing, voxel indexing, and patient-coordinate conventions.
What you can do after
Apply it via an image parser to load CT data and map patient-space anatomy locations to voxel indices.
How it connects
Connects CT scans, voxel arrays, metadata, patient coordinate systems, image parsers, SimpleITK, and NumPy arrays.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.