Creating Secondary Capture Images
Any ‘valid’ Dicom Image is a conglomeration of Pixel data and several mandatory data attributes. To generate a Secondary Capture (SC) Image from existing non-Dicom image then all that is required is to load the required image into a DicomImage using the import function and then adding on the appropriate attributes. Dicom Objects will automatically take care of all the attributes relating to the pixel data (Group 0x0028).
Part 3 of the Dicom Standard Contains Table A.8-1"SC Image IOD Modules". which gives the mandatory modules required to create a Valid DicomImage from a Secondary Capture. The Mandatory Modules are:
Patient Modules (C.7.1.1)
- Patient’s Name (0010,0010) Patient’s full name.(Must be created but can be left blank if unknown)
- Patient ID (0010,0020) Primary hospital identification number or code for the patient.(Must be created but can be left blank if unknown)
- Patient’s Birth Date (0010,0030) Birth date of the patient.(Must be created but can be left blank if unknown)
- Patient’s Sex (0010,0040) Sex of the named patient.(Must be created but can be left blank if unknown)
- Patient Species Description (0010,2201) 1C The species of the patient. (Required if the patient is an animal)
General Study (C.7.2.1)
- Study Instance UID (0020,000D) Unique identifier for the Study.
- Study Date (0008,0020) Date the Study started. (Must be created but can be left blank if unknown)
- Study Time (0008,0030) Time the Study started. (Must be created but can be left blank if unknown)
- Referring Physician’s Name (0008,0090) Name of the patient’s referring physician (Must be created but can be left blank if unknown)
- Study ID (0020,0010) User or equipment generated Study identifier. (Must be created but can be left blank if unknown)
- Accession Number (0008,0050) A RIS generated number that identifies the order for the Study. (Must be created but can be left blank if unknown)
General Series (C.7.3.1)
- Modality (0008,0060) Type of equipment that originally acquired the data used to create the images in this Series.
- Series Instance UID (0020,000E) Unique identifier of the Series.
- Series Number (0020,0011) A number that identifies this Series. (Must be created but can be left blank if unknown)
- Laterality (0020,0060) Laterality of (paired) body part examined.(Required if the body part examined is a paired structure)
SC Equipment (C.8.6.1)
- Conversion Type (0008,0064) Describes the kind of image conversion
General Image (C.7.6.1)
- Instance Number (0020,0013) A number that identifies this image.(Must be created but can be left blank if unknown)
- Patient Orientation (0020,0020) Patient direction of the rows and columns of the image. Required if image does not require Image Orientation
- Content Date (0008,0023) The date the image pixel data creation started. Required if image is part of a series in which the images are temporally related
- Content Time (0008,0033) The time the image pixel data creation started. Required if image is part of a series in which the images are temporally related
Image Pixel (C.7.6.3) : These attributes are handled automatically by DicomObjects on use of the import method
SC Image (C.8.6.2) : No mandatory attributes
SOP Common (C.12.1)
- SOP Class UID (0008,0016) Uniquely identifies the SOP Class.
- SOP Instance UID (0008,0018) Uniquely identifies the SOP Instance.
- Specific Character Set (0008,0005) Character Set that expands or replaces the Basic Graphic Set. Required if an expanded or replacement character set is used.
If the image is being created from scratch (rather than by using the import method on an existing image) then Image Pixel attributes must be added explicitly as must the pixel data.
The code fragment bellow will add arbitrary values onto an existing image file (gif, jpg, bmp, etc) and turn it into a Secondary capture Dicom image file.
DicomObjects.NET
DicomImage im = new DicomImage(new Bitmap(fileToImport));
// Add Patient Module
im.Name = "test patient";
im.PatientID = "123456";
im.DateOfBirth = DateTime.Now;
im.Sex = "O";
// Add General Study Module
im.StudyUID = DicomGlobal.NewUID();
im.DataSet.Add(Keyword.StudyDate, DateTime.Now);
im.DataSet.Add(Keyword.StudyTime, DateTime.Now);
im.DataSet.Add(Keyword.ReferringPhysicianName, "Doctor A");
im.DataSet.Add(Keyword.StudyID, "1");
im.AccessionNumber = "";
// Add General Series Module
im.DataSet.Add(Keyword.Modality, "OT");
im.SeriesUID = DicomGlobal.NewUID();
im.DataSet.Add(Keyword.SeriesNumber, "");
// Add SC Equipment Module
im.DataSet.Add(Keyword.ConversionType, "SI");
// Add General Image Module
im.DataSet.Add(Keyword.InstanceNumber, "");
im.DataSet.Add(Keyword.PatientOrientation, "");
// Add SOP Common Module
im.SOPClass = SOPClasses.SecondaryCapture;
im.InstanceUID = DicomGlobal.NewUID();
// Save File onto Disk
im.Write("c:SecondaryCaptured.dcm", TransferSyntaxes.ImplicitVRLittleEndian);
DicomObjects.COM
Dim g As New DicomGlobal
fileToImport = "D:Usersqian.MEDCONNECTDesktopSample ImagesCT.JPEG"
Dim im As New DicomImage
' Import image file
im.FileImport fileToImport
' Add Patient Module
im.Name = "test patient"
im.PatientID = "123456"
im.DateOfBirth = Now
im.Sex = "O"
' Add General Study Module
im.StudyUID = g.NewUID
im.Attributes.Add &H8, &H20, Now
im.Attributes.Add &H8, &H30, Now
im.Attributes.Add &H8, &H90, "foo"
im.Attributes.Add &H20, &H10, "1"
im.AccessionNumber = ""
' Add General Series Module
im.Attributes.Add &H8, &H60, "OT"
im.SeriesUID = g.NewUID
im.Attributes.Add &H20, &H11, ""
' Add SC Equipment Module
im.Attributes.Add &H8, &H64, "SI"
' Add General Image Module
im.Attributes.Add &H20, &H13, ""
im.Attributes.Add &H20, &H20, ""
' Add SOP Common Module
im.SOPClass = "1.2.840.10008.5.1.4.1.1.7"
im.InstanceUID = g.NewUID
' Save File onto Disk
im.WriteFile "c:SecondaryCaptured.dcm", True, "1.2.840.10008.1.2.1"