ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > MD Component API Reference > MD Component Functions Reference > Data Set Functions > MED_DCM_DS_PixPadVal_set

This function is used to set the Pixel Padding Value that is to be used while displaying a 16-bit grayscale image.


Copy Code
        HIGEAR hIGear, 
        const BOOL Use_Pix_Padding, 
        const LONG Pix_Padding_Val, 
        const BYTE Show_PPV_as


Name Type Description
hIGear HIGEAR HIGEAR handle to the image for which you would like to set the value of the internal representation of the "Pixel Padding ValueData Element (0028,0120)".
Use_Pix_Padding const BOOL Set this to TRUE to use the value of Pixel Padding Value (0028,0120); FALSE to ignore the value of Pixel Padding Value.
Pix_Padding_Val const LONG Set this argument to the grayscale value to use for the image. This value will be stored in the Pixel Padding Value Data Element (0028,0120) of the internal Data Set. This new value is the value that will be locked into the 16x8 LUT when Pixel Padding is turned on.
Show_PPV_as const BYTE Set to the grayscale value that will be used to display pixels equal to the Pixel Padding Value.

Return Value:

Returns the number of ImageGear errors that occurred during the function call.

Supported Raster Image Formats:

This function does not process image pixels.

The image must have a DICOM DataSet attached to it. Use MED_DCM_DS_exists to check whether the image contains a DataSet.


Copy Code
AT_ERRCOUNT              nErrcount;
HIGEAR          hIGear;
LONG            Pix_Padding_Val;
BYTE            Show_PPV_as;
BOOL            Pref_use_pix_pad;
nErrcount = MED_DCM_DS_PixPadVal_set(hIGear, bPref_use_pix_pad, Pix_Padding_Val,


Here is a description of what this Data Element is used for and how ImageGear implements its use:

DICOM images sometimes contain a Data Element called "Pixel Padding Value" (PPV). The PPV is used mostly to fill in the corners of round images. DICOM provides a Tag for PPV which is (0028,0120). This Data Element stores a 16-bit grayscale value that is to be treated as the Pixel Padding Value. Any pixels in the image that have this value are not to be treated as meaningful objects-but as background color.

When ImageGear Medical loads a DICOM image that contains a PPV the value is captured and stored in the HDS, which is attached to the HIGEAR of the new image. In fact, 3 values are stored to the HDS: the PPV from the PPV Data Element, a flag indicating that a PPV was found in the file when it was loaded, and an 8-bit grayscale value to use to display pixels with this value. This function sets the values of these in-memory copies of the PPV data.

When Use_Pix_Padding is set to TRUE, pixels from the original image equal to the PPV are treated as background. All functions that fill the 16x8 LUT skip this value and place the Show_PPV_As value in the PPV slot of the table. This allows an application to adjust the contrast of the image while keeping the PPV or background constant. The background will be displayed with a grayscale value equal to that stored in Show_PPV_As. The PPV is also used for the IP functions. Functions like MED_IP_min_max() ignore pixel values that are equal to the PPV. (see below).

Use_Pix_Padding is initially set to TRUE if the loaded image contained the Pixel Padding Value Data Element (0028,0120). If this Data Element was not found then this defaults to FALSE

Pix_Padding_Val is initially set to the Data Field of the Pixel Padding Value Data Element (0028,0120) if it is found. If it is not it is set to default (NULL).

Show_PPV_As is not part of the PPV Data Element. This value always defaults to 64.

When the Pixel Padding Value is turned "on" (Use_Pix_Padding=TRUE) the MED_IP_min_max() function will know to ignore this value as it searches through the image for the brightest and darkest pixel value so that it avoids treating the Pixel Padding Value as the minimum or max pixel value. This error could easily occur because Pixel Padding Value is most often set to a very large or very small value so that it can be easily differentiated from the real pixel values.

To retrieve the Pixel Padding Value that is currently stored in the HIGEAR (not the one in the Data Set although them may have the same value) see MED_DCM_DS_PixPadVal_get().

Is this page helpful?
Yes No
Thanks for your feedback.