Leadtools.Dicom Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
SetImage Method
See Also 
Leadtools.Dicom Namespace > DicomDataSet Class : SetImage Method




element
An item in the Data Set.
image
Image to set.
compression
Indicates the type of compression to use.
photometric
Photometric constant.
bitsPerPixel
Value that represents the resulting image pixel depth. Possible values are:
ValueMeaning
0Keep the original file's pixel depth (do not convert).
1 to 8The specified bits per pixel in the resultant image.
1212 bits per pixel in the resultant image.
1616 bits per pixel in the resultant image.
2424 bits per pixel in the resultant image.
3232 bits per pixel in the resultant image.
qualityFactor
The quality factor (Q factor) is a number that determines the degree of loss in the compression process. You can set a value from 2 to 255, where 2 is the highest quality and 255 is the most compression.
flags
Flags that control the behaviour of this method.
Replaces the image(s) in a Pixel Data element.

Syntax

Visual Basic (Declaration) 
Public Sub SetImage( _
   ByVal element As DicomElement, _
   ByVal image As RasterImage, _
   ByVal compression As DicomImageCompressionType, _
   ByVal photometric As DicomImagePhotometricInterpretationType, _
   ByVal bitsPerPixel As Integer, _
   ByVal qualityFactor As Integer, _
   ByVal flags As DicomSetImageFlags _
) 
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim element As DicomElement
Dim image As RasterImage
Dim compression As DicomImageCompressionType
Dim photometric As DicomImagePhotometricInterpretationType
Dim bitsPerPixel As Integer
Dim qualityFactor As Integer
Dim flags As DicomSetImageFlags
 
instance.SetImage(element, image, compression, photometric, bitsPerPixel, qualityFactor, flags)

Parameters

element
An item in the Data Set.
image
Image to set.
compression
Indicates the type of compression to use.
photometric
Photometric constant.
bitsPerPixel
Value that represents the resulting image pixel depth. Possible values are:
ValueMeaning
0Keep the original file's pixel depth (do not convert).
1 to 8The specified bits per pixel in the resultant image.
1212 bits per pixel in the resultant image.
1616 bits per pixel in the resultant image.
2424 bits per pixel in the resultant image.
3232 bits per pixel in the resultant image.
qualityFactor
The quality factor (Q factor) is a number that determines the degree of loss in the compression process. You can set a value from 2 to 255, where 2 is the highest quality and 255 is the most compression.
flags
Flags that control the behaviour of this method.

Example

For an example, refer to GetImage.

Remarks

This method replaces all the images in the Pixel Data Element with the image referenced by image.

Most DICOM files will only have one Data Element of type DicomTagType.PixelData. Therefore, in most instances you can set element to null, since the method will automatically replace the images of the only Pixel Data Element in the file. If element is not null, it must point to the Pixel Data Element itself.

To replace only one image within the Pixel Data Element, call the DeleteImage and InsertImage methods.

If the DICOM file is DicomClassType.BasicDirectory, the file may contain more than one Pixel Data Element. In this case you must specify in element the Pixel Data Element in which the images will be replaced.

For a table of possible Compression, Photometric, BitsPerPixel, and Quality Factor combinations, refer to Compression Table.

For more options when using the JPEG 2000 compression, refer to Jpeg2000Options.

This method will either insert, delete or update one or more of the following elements:

TagName
(7FE0,0010)Pixel Data.
(0002,0010)Transfer Syntax UID.
(0028,0101)Bits Stored.
(0028,0100)Bits Allocated.
(0028,0102)High Bit.
(0028,0103)Pixel Representation.
(0028,0010)Rows.
(0028,0011)Columns.
(0028,0002)Samples per Pixel.
(0028,0006)Planar Configuration.
(0028,0004)Photometric Interpretation.
(0028,0106)Smallest Image Pixel Value.
(0028,0107)Largest Image Pixel Value.
(0028,1101)Red Palette Color Lookup Table Descriptor.
(0028,1102)Green Palette Color Lookup Table Descriptor.
(0028,1103)Blue Palette Color Lookup Table Descriptor.
(0028,1201)Red Palette Color Lookup Table Data.
(0028,1202)Green Palette Color Lookup Table Data.
(0028,1203)Blue Palette Color Lookup Table Data.
(0028,1199)Palette Color Lookup Table UID.
(0028,1052)Rescale Intercept.
(0028,1053)Rescale Slope.
(0028,1054)Rescale Type.
(0028,1221)Segmented Red Palette Color Lookup Table Data.
(0028,1222)Segmented Green Palette Color Lookup Table Data.
(0028,1223)Segmented Blue Palette Color Lookup Table Data.
(0028,3010)VOI LUT Sequence.
(0028,1050)Window Center.
(0028,1051)Window Width.
(0028,1055)Window Center & Width Explanation.
(0028,0008)Number of Frames.
(0054,0070)Time Slot Vector.

This method is indifferent to the pixel data restrictions imposed by the various DICOM IOD classes; for example, this method will allow the user to insert a colored image into a "Digital X-Ray Image Storage" Data Set.

This method will always insert a "Number of Frames" (0028, 0008) element and set its value.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Dicom requires a Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features