SetCompressedPixelFile


Directly importing compressed data into DICOM is possible by the _SetCompressedPixelFile_ method which maps an external file as the compressed pixel data of that DicomImage instance.  Unlike the import method, this just sets the pixel data and nothing else, so it is required to update the rest yourself (e.g. bit depth, frame count, etc).

Example code snippet with dummy values :

 int width = 1280;
 int height=720;
 int frameRate=25; // 25 frames per seconds for example
 float duration = 5;  // 5 seconds the total duration of video, for example
 string transferSyntax = "1.2.840.10008.1.2.4.XX"; // .103 for mp4
 DicomImage img = new DicomImage();
 img.SetCompressedPixelFile(MP4 filename, 0, transferSyntax);

the following attributes are set according to DICOM Standard MPEG-4 requirements:

 img.DataSet.Add(Keyword.SamplesPerPixel, 3);
 img.DataSet.Add(Keyword.PhotometricInterpretation, "YBR PARTIAL 420");
  img.DataSet.Add(Keyword.BitsAllocated, 8);
 img.DataSet.Add(Keyword.BitsStored, 8);
 img.DataSet.Add(Keyword.HighBit, 7);
 img.DataSet.Add(Keyword.PixelRepresentation, 0);
 img.DataSet.Add(Keyword.CineRate, frameRate);
 img.DataSet.Add(Keyword.Rows, height);
 img.DataSet.Add(Keyword.Columns, width);
 img.DataSet.Add(Keyword.NumberOfFrames, (int)(frameRate \* duration));
 img.SOPClass = DicomObjects.DicomUIDs.SOPClasses.SecondaryCapture; // appropriate SOP Class required
 img.InstanceUID = DicomGlobal.NewUID();

Add other DICOM attributes like name, dob, sex study Instance UID, series Instance UID etc, to make a valid DICOM instance, according to the specified SOP Class UID.

Here is a list of DICOM attributes that are required to make valid DICOM secondary capture SOP class instance: Creating Secondary Capture Images



We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE