Issue with Extracting Multi-Frame DICOM to Single-Frame DICOMs for visualize MPR in RadiAnt DICOM Viewer

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Christeen Jose
Posts: 2
Joined: Thu, 2025-01-30, 09:29

Issue with Extracting Multi-Frame DICOM to Single-Frame DICOMs for visualize MPR in RadiAnt DICOM Viewer

#1 Post by Christeen Jose »

I am working on a project where I need to extract individual frames from a multi-frame DICOM file and save them as separate single-frame DICOM files. I am using DCMTK to accomplish this, and the following is my approach:
  • Registering Decoders : I register the necessary decoders (DJDecoderRegistration and DcmRLEDecoderRegistration) for handling compressed DICOM images.
  • Loading the DICOM File: I use DcmFileFormat to load the multi-frame DICOM file.
  • Creating an Output Directory: I ensure that the output directory is clean by removing any existing files and then creating a fresh directory.
  • Checking Dataset Validity: I retrieve the dataset from the loaded file and ensure it is valid.
  • Decompressing if Required: If the dataset is compressed, I attempt to decompress it using chooseRepresentation(EXS_LittleEndianExplicit, nullptr).
  • Extracting Number of Frames:
    • I first try findAndGetUint16(DCM_NumberOfFrames, numFrames).
    • If that fails, I attempt to get the frame count from DCM_PerFrameFunctionalGroupsSequence.
    • If both fail, I return an error.
  • Extracting Pixel Data:
    • I retrieve the DCM_PixelData element.
    • I determine the uncompressed frame size.
    • I allocate memory for each frame.
  • Saving Individual Frames:
    • I iterate over each frame, create a new DcmFileFormat object, and copy the dataset.
    • I remove multi-frame attributes like DCM_NumberOfFrames, DCM_SharedFunctionalGroupsSequence, and DCM_PerFrameFunctionalGroupsSequence.
    • I generate a new SOPInstanceUID for each frame.
    • I set the DCM_InstanceNumber sequentially.
    • I extract the frame data using getUncompressedFrame() and store it in the new dataset.
    • I save the new single-frame DICOM file in the specified directory.
  • Final Cleanup: I unregister the decoders to free resources.


  • Issue Faced:
    • The extracted single-frame DICOM slices are correctly saved and can be opened individually.
    • However, when trying to view them in RadiAnt DICOM Viewer, the MPR (Multi-Planar Reconstruction) functionality does not work.

I would like to resolve this problem. Any insights or suggestions would be greatly appreciated.

J. Riesmeier
DCMTK Developer
Posts: 2560
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Issue with Extracting Multi-Frame DICOM to Single-Frame DICOMs for visualize MPR in RadiAnt DICOM Viewer

#2 Post by J. Riesmeier »

First of all, did you check if your resulting files are valid, e.g. using dciodvfy? Are the images displayed (as single frames) by a common DICOM viewer or are you able to render them with DCMTK's dcm2pnm/dcm2img?

Furthermore, which SOP Class did you use for your DICOM files? Are spatial information available, e.g. position in 3D space, which are needed for MPR...

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1517
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Issue with Extracting Multi-Frame DICOM to Single-Frame DICOMs for visualize MPR in RadiAnt DICOM Viewer

#3 Post by Marco Eichelberg »

Since the description of your approach does not mention the position information, I would suspect that this is the root cause. For MPR, each DICOM image needs contain information that exactly describes its position and orientation in 3D space, e.g. Image Position (Patient) and Image Orientation (Patient). If you do not update these, then all slices will have the same location in 3D space, that cannot work.

Christeen Jose
Posts: 2
Joined: Thu, 2025-01-30, 09:29

Re: Issue with Extracting Multi-Frame DICOM to Single-Frame DICOMs for visualize MPR in RadiAnt DICOM Viewer

#4 Post by Christeen Jose »

Thank you so much Marco Eichelberg and J. Riesmeier...The problem was due to the slice position and Image Position (Patient) ...Now I resolved those situations. Thank you guys for immense support.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests