Image Processing Toolbox User's Guide Previous page   Next Page

Example: Creating a New Series

When writing a modified image to a DICOM file, you might want to make the modified image the start of a new series. In the DICOM standard, images can be organized into series. When you write an image with metadata to a DICOM file, dicomwrite puts the image in the same series by default. To create a new series, you must assign a new DICOM unique identifier to the SeriesInstanceUID metadata field. This example illustrates this process:

  1. Read an image from a DICOM file into the MATLAB workspace.
  1. To view the image, use either of the toolbox display functions, imshow or imtool. Because the DICOM image data is signed 16-bit data, you must use the autoscaling syntax.

  1. Read the metadata from the same DICOM file.
  1. To identify which series an image belongs to, view the value of the SeriesInstanceUID field.

  1. You typically only start a new DICOM series when you modify the image in some way. This example removes all the text from the image.
  1. The example finds the maximum and minimum values of all pixels in the image. The pixels that form the white text characters are set to the maximum pixel value.

    To remove these text characters, the example sets all pixels with the maximum value to the minimum value.

    View the processed image.

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

  1. Set the value of the SeriesInstanceUID field in the metadata associated with the original DICOM file to the generated value.
  2. 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 image you write is part of a new series.
  1. To verify this operation, view the image and the SeriesInstanceUID metadata field in the new file.


Previous page  Writing Image Data or Metadata to a DICOM File Image Arithmetic Next page

© 1994-2005 The MathWorks, Inc.