Main Content

Create New DICOM Series

This example shows how to create a new DICOM series for a modified DICOM image.

In the DICOM standard, images can be organized into series. By default, when you write an image with metadata to a DICOM file, dicomwrite puts the image in the same series. You typically only start a new DICOM series when you modify the image in some way. To make the modified image the start of a new series, assign a new DICOM unique identifier to the SeriesInstanceUID metadata field.

Read an image from a DICOM file into the workspace.

I = dicomread('CT-MONO2-16-ankle.dcm');

Display the image. Because the DICOM image data is signed 16-bit data, automatically scale the display range so that the minimum pixel value is black and the maximum pixel value is white.

imshow(I,'DisplayRange',[])

Read the metadata from the DICOM file.

info = dicominfo('CT-MONO2-16-ankle.dcm');

To identify the series an image belongs to, view the value of the SeriesInstanceUID property.

info.SeriesInstanceUID
ans = 
'1.2.840.113619.2.1.2411.1031152382.365.736169244'

This example modifies the image by removing all of the text from the image. Text in the image appears white. Find the maximum value of all pixels in the image, which corresponds to the white text.

textValue = max(I(:));

The background of the image appears black. Find the minimum value of all pixels in the image, which corresponds to the background.

backgroundValue = min(I(:));

To remove the text, set all pixels with the maximum value to the minimum value.

Imodified = I;
Imodified(Imodified == textValue) = backgroundValue;

View the processed image.

imshow(Imodified,'DisplayRange',[])

To write the modified image as a new series, you need a new DICOM unique identifier (UID). Generate a new UID using the dicomuid function. dicomuid is guaranteed to generate a unique UID.

uid = dicomuid
uid = 
'1.3.6.1.4.1.9590.100.1.2.207659117042575763227728704072535641607'

Set the value of the SeriesInstanceUID field in the metadata associated with the original DICOM file to the generated value.

info.SeriesInstanceUID = uid;

Write the modified image to a new DICOM file, specifying the modified metadata structure, info, as an argument. Because you set the SeriesInstanceUID value, the written image is part of a new series.

dicomwrite(Imodified,'ankle_newseries.dcm',info);

To verify this operation, view the image and the SeriesInstanceUID metadata field in the new file.

See Also

Apps

Functions

Related Topics