Digital Imaging and Communications in Medicine

application/dicom

Safe

Magic Bytes

Offset: 128
44 49 43 4D

Digital Imaging and Communications in Medicine (DICOM) is an international standard for medical imaging and related information, maintained by the National Electrical Manufacturers Association (NEMA). It is the primary format for storing and transmitting medical data from imaging modalities, including CT scans, MRIs, and ultrasounds, across healthcare networks and archival systems. Files typically contain sensitive patient metadata, necessitating strict adherence to privacy regulations and data encryption standards during handling.

Extension

.dcm

MIME Type

application/dicom

Byte Offset

128

Risk Level

Safe

Validation Code

How to validate .dcm files in Python

Python
def is_dcm(file_path: str) -> bool:
    """
    Check if file is a valid DCM by magic bytes.
    Signature offset: 128 bytes
    """
    signature = bytes([0x44, 0x49, 0x43, 0x4D])
    with open(file_path, "rb") as f:
        f.seek(128)
        return f.read(4) == signature

How to validate .dcm files in Node.js

Node.js
function isDCM(buffer: Buffer): boolean {
  // Signature offset: 128 bytes
  const signature = Buffer.from([0x44, 0x49, 0x43, 0x4D]);
  if (buffer.length < 132) return false;
  return buffer.subarray(128, 132).equals(signature);
}
Go
func IsDCM(data []byte) bool {
    // Signature offset: 128 bytes
    signature := []byte{0x44, 0x49, 0x43, 0x4D}
    if len(data) < 132 {
        return false
    }
    return bytes.Equal(data[128:132], signature)
}

API Endpoint

GET /api/v1/dcm
curl https://filesignature.org/api/v1/dcm

Related Formats