How to make DICOM files from external Images
Very often we get questions about how to create DICOM files from externally imported images, such as BMP, JPG and Tiff, etc. Following are things which we have done for you during the file import and things you need to fill in to make the output a VALID DICOM file.
Call DicomImage.FileImport method to import external Images
Please note all group and element numbers below are in Hex format.
Contents |
Attributes already set by DicomObjects during File Import:
(0008,0018) : SOP Instance UID (0020,000D) : Study Instance UID (0020,000E) : Series Instance UID (0028,0002) : Samples per Pixel (0028,0004) : Photometric Interpretation (0028,0006) : Planar Configuration (0028,0010) : Rows (0028,0011) : Columns (0028,0100) : Bits Allocated (0028,0101) : Bits Stored (0028,0102) : High Bit (0028,0103) : Pixel Representation (0028,1050) : Window Center (0028,1051) : Window Width (7FE0,0010) : Pixel Data
Attributes you need to set before writting the Image out:
And use one of the following methods to add new attributes:
- COM
- DicomImage.Attributes.Add
- .NET
- DicomImage.DataSet.Add
Type 1 attributes
(MUST be present and MUST have valid value):
(0008,0016) : SOP Class UID : 1.2.840.10008.5.1.4.1.1.7
(0008,0064) : Conversion Type :
DV = Digitized Video
DI = Digital Interface
DF = Digitized Film
WSD = Workstation
SD = Scanned Document
SI = Scanned Image
DRW = Drawing
SYN = Synthetic Image
Type 2 attributes
(MUST be present but can have null value)
(0010,0010) : Patient Name (0010,0020) : Patient ID (0010,0030) : Patient Date of Birth (0010,0040) : Patient Sex (0008,0020) : Study Date (0008,0030) : Study Time (0008,0050) : Accession Number (0008,0090) : Referring Physician's Name (0020,0010) : Study ID (0020,0011) : Series Number (0020,0013) : Instance Number (0020,0020) : Patient Orientation
Then call one of the following methods to write image onto disk:
- COM
- DicomImage.WriteFile
- .NET
- DicomImage.Write
Note: For anybody who wishes to import external images and write them out as DICOM image files, we strongly suggest you to use DVT to validate your output files before you starting to use them or send them elsewhere.