2
votes

Does anyone have ANY information on creating a valid DICOM file with DCMTK?

1.2.840.10008.1.2.4.100 MPEG2 Main Profile Main Level
1.2.840.10008.1.2.4.102 MPEG-4 AVC/H.264 High Profile / Level 4.1    
1.2.840.10008.1.2.4.103 MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1

I understand that MPEG-4 is not currently released, but it in their development branch. I would assume that the process of creating an MPEG2 would be similar to MPEG-4?

Just to clarify, are the transfer syntaxs mentioned above multi-frame videos, where each frame (mpeg, h.264, etc) is wrapped as a DICOM image to create mutli-frame DICOM image? Or, do you simply take the mp4 file, and put some DICOM headers into the beginning of the file?

Anyways, does anyone have some sample code for creating a valid DCM file from either MPEG2 or MPEG4?

3
I have to yet to come across MPEG-4 or h.264 video in a dicom file, but doesn't mean somebody somewhere isn't using those types of encodings. Typically for dicom video, it is intra-frame encoding, where each frame is individually compressed/encoded and stored as a dicom item within a dicom sequence, see the concept encapsulated transfer syntaxes in the standard.Chris O
Chris, you are talking about multiframe DICOM objects, typically used (among others) in cardiovascular systems. I think Paul refers to real mpeg2 or mpeg4 video sequences, more like captures from endoscopy video systems.jap1968
@jap1968 Yes, you are correct, my experience is center around cardiovascular modalities.Chris O

3 Answers

2
votes

The current snapshot of the DCMTK contains all Transfer Syntax UIDs, i.e. the definition of what is listed in part 6 of the DICOM standard, which include various flavors of MPEG-2 and MPEG-4. Part 5 of the DICOM standard clearly describes how these transfer syntaxes are to be used, e.g. what the requirements for an MPEG data stream are and how the stream is to be encapsulated into the DICOM Pixel Data element.

By the way, DCMTK-related questions are probably better posted to the public discussion forum at http://forum.dcmtk.org/.

1
votes

With regard to MPEG-4 AVC/H.264 High Profile / Level 4.1, you should read (at least) the relevant section in Part 5 of the DICOM standard: http://medical.nema.org/medical/dicom/current/output/chtml/part05/sect_8.2.7.html

0
votes

NOTE: This answer has been fully edited on 20150407

I have done some tests to create mpeg4 DICOM video with the dcm4che2 toolkit. I assume that the same could be done in a similar manner with the DCMTK tools.

Answering to your second question, a DICOM video is just a video file (which must be compliant with some given constraints according to the video type) with some necessary DICOM data elements (attributes).

One way to obtain a DICOM video file is to create first an XML file containing the necessary DICOM data elements, and then to combine the XML file with the original video file. You will end up having a supposedly compliant DICOM instance containig the original video encapsulated in the (7FE0,0010) data element.

Your XML file will be something more or less like this:

<?xml version="1.0" encoding="UTF-8"?>
<dicom>
<attr tag="00020002" vr="UI" name="MediaStorageSOPClassUID">1.2.840.10008.5.1.4.1.1.77.1.4.1</attr>
<attr tag="00020003" vr="UI" name="MediaStorageSOPInstanceUID">1.3.51.5146.1682.20140505.1225531.197</attr>
<attr tag="00020010" vr="UI" name="TransferSyntaxUID">1.2.840.10008.1.2.4.102</attr>
<attr tag="00020012" vr="UI" name="ImplementationClassUID">1.2.40.0.13.1.1</attr>
<attr tag="00020013" vr="SH" name="ImplementationVersionName">dcm4che-1.4.18</attr>
<attr tag="00080005" vr="CS" name="SpecificCharacterSet">ISO_IR 100</attr>
<attr tag="00080008" vr="CS" name="ImageType">DERIVED\PRIMARY</attr>
<attr tag="00080012" vr="DA" name="InstanceCreationDate">20140505</attr>
<attr tag="00080013" vr="TM" name="InstanceCreationTime">135531</attr>
<attr tag="00080016" vr="UI" name="SOPClassUID">1.2.840.10008.5.1.4.1.1.77.1.4.1</attr>
<attr tag="00080018" vr="UI" name="SOPInstanceUID">1.3.51.5146.1682.20140505.1225531.197</attr>
<attr tag="00080020" vr="DA" name="StudyDate">20140505</attr>
<attr tag="00080022" vr="DA" name="AcquisitionDate">20140505</attr>
<attr tag="00080030" vr="TM" name="StudyTime">135531</attr>
<attr tag="00080032" vr="TM" name="AcquisitionTime">135531</attr>
<attr tag="00080050" vr="SH" name="AccessionNumber">2014505093198485</attr>
<attr tag="00080060" vr="CS" name="Modality">XC</attr>
<attr tag="00080070" vr="LO" name="Manufacturer">Test MFR</attr>
<attr tag="00080090" vr="PN" name="ReferringPhysicianName">Test^^^Dr^</attr>
<attr tag="00081030" vr="LO" name="StudyDescription">Test video HD</attr>
<attr tag="0008103e" vr="LO" name="SeriesDescription">Test video 720p</attr>
<attr tag="00082218" vr="SQ" vm="1" name="AnatomicRegionSequence">
  <item>
    <attr tag="00080100" vr="SH" name="CodeValue">T-32000</attr>
    <attr tag="00080102" vr="SH" name="CodingSchemeDesignator">SRT</attr>
    <attr tag="00080104" vr="LO" name="CodeMeaning">Heart</attr>
  </item>
</attr>
<attr tag="00100010" vr="PN" name="PatientName">Smith^John^^Test^</attr>
<attr tag="00100020" vr="LO" name="PatientID">100539</attr>
<attr tag="00100030" vr="DA" name="PatientBirthDate">19700101</attr>
<attr tag="00100040" vr="CS" name="PatientSex">M</attr>
<attr tag="00180040" vr="IS" name="CineRate">30</attr>
<attr tag="00181063" vr="DS" name="FrameTime">33.33</attr>
<attr tag="0020000d" vr="UI" name="StudyInstanceUID">1.3.51.0.7.633920140505.6339234439.633987.633918098</attr>
<attr tag="0020000e" vr="UI" name="SeriesInstanceUID">1.3.51.5146.11682.20140505.122553197</attr>
<attr tag="00200010" vr="SH" name="StudyID">00000001</attr>
<attr tag="00200011" vr="IS" name="SeriesNumber">1</attr>
<attr tag="00200013" vr="IS" name="InstanceNumber">1</attr>
<attr tag="00200020" vr="CS" name="PatientOrientation"></attr>
<attr tag="00280002" vr="US" name="SamplesPerPixel">3</attr>
<attr tag="00280004" vr="CS" name="PhotometricInterpretation">YBR_PARTIAL_420</attr>
<attr tag="00280006" vr="US" name="PlanarConfiguration">0</attr>
<attr tag="00280008" vr="IS" name="NumberOfFrames">1080</attr>
<attr tag="00280009" vr="AT" name="FrameIncrementPointer">00181063</attr>
<attr tag="00280010" vr="US" name="Rows">720</attr>
<attr tag="00280011" vr="US" name="Columns">1280</attr>
<attr tag="00280100" vr="US" name="BitsAllocated">8</attr>
<attr tag="00280101" vr="US" name="BitsStored">8</attr>
<attr tag="00280102" vr="US" name="HighBit">7</attr>
<attr tag="00280103" vr="US" name="PixelRepresentation">0</attr>
<attr tag="00282110" vr="CS" name="LossyImageCompression">01</attr>
<attr tag="00400555" vr="SQ" name="AcquisitionContextSequence"></attr>
<attr tag="7FE00010" vr="OB">
  <item />
  <item src="test_720p.mp4"/>
</attr>
</dicom>

Once you have the XML file, combine it with the video file in order to obtain the DICOM file:

$ xml2dcm -d -t 1.2.840.10008.1.2.4.102 -x test_720.xml -o test_720.dcm

The resulting file has been tested with the dciodvfy tool and it seems to be a valid part 10 DICOM file.

Now, you can try to store this DICOM file into your PACS:

$ dcmsnd -L TEST [email protected]:11112 test_720.dcm 

I have tested it, being able to recover and to reproduce the video with the Weasis DICOM viewer.

Some additional information just to clarify

You can find additional information in this thread on the comp.protocols.dicom newsgroups.