DicomObjects Reference
DicomObjects Reference / DicomImage Object / Pixels Property
In This Topic
    Pixels Property
    In This Topic
    Description
    Accesses pixeldata as an array
    Property type
    Read-write property
    Syntax
    Visual Basic
    Public Property Pixels As Variant
    Remarks

    This returns an array of either bytes or short integers, depending on the size of the native data.  The data returned is unaffected by the display parameters.
    The first two dimensions of the array returned are those of  the image itself, the third being the number of frames (as returned by FrameCount). 
    If the data has more than one sample per pixel (e.g. RGB images), then the format of the array returned depends on the planar configuration (0028,0006).  If this is 0 (colour-by-pixel), then the 1st (horizontal) dimension of the array is multiplied by the number of samples, whereas if the planar configuration is 1 (colour-by-plane), then it is the 2nd (vertical) dimension that is increased.  This ensures that each “row” of pixels remains intact.

    When writing to this property, either a 1, 2 or 3 dimensional array will be accepted, and will be interpreted as a byte or word stream, varying the first dimension fastest, then the others in order.
    Note that Visual Basic can have a problem distinguishing between function parameters and array indices if an attempt is made to create the pixel array and access a specific pixel value in the same statement.  e.g.
    x=image.pixels(1,1,1)
    will generate an error, stating that the numbers of parameters is incorrect, and this should therefore be changed to:

    pix=image.pixels
    x=pix(1,1,1)
    Similar problems may occur in other languages, and the same solution is recommended.

    See Also