Histogram

To create a DICOM Image Histogram Module, users of DicomObjects can use the DicomImage.Histogram method, which returns an array containing the distribution of the raw pixel values.

[Declaration]
DicomImage.Histogram(Min, Max, BinSize)

[Parameters]

  • Min as Long Integer - The lowest pixel value to be included.
  • Max as Long Integer - The highest pixel value to be included.
  • BinSize as Long Integer - The number of adjacent pixel values to be grouped into each Bin

[Return Value]
A variant array of Long Integers containing the distribution of raw pixel values, the index of the array is 1-based.


[Explanations]

  • How to decide Min and Max
    • DicomImage.MinimumPixelValue and DicomImage.MaximumPixelValue methods could be used to decide the minimum and maximum values of the pixel data. This approach is not very efficient as they are big operations in DicomObjects.
    • A better way of deciding the Min and Max is to use "Bits Stored" (0028, 0101) and "Pixel Representation" (0028, 0103): N = Bits Stored (0028, 0101); Pixel Representation (0028, 0103) indicates whether the pixel data value is signed or unsigned. If signed then the pixel data range is (- 2^(N-1)) to (2^(N-1)). And if unsigned, the pixel data range is 0 to (2^N – 1).
  • What is BinSize
    • The BinSize is the value people choose to define how many pixel values get put into each returned bin, so for instance if you have Min=10 and Binsize=5, then the bins are: 10-14, 15-19, 20-24, Etc.
  • What is in the returned array
    • The returned variant array of Long Integers contains the distribution of raw pixel values. For example we have a pixel data at range 10 - 24, the BinSize is set to 5 so that we have 3 bins: 10-14, 15-19, 20-24. A returned array of [30,40,50] means 30 pixel data are within the value range (10-14), 40 pixel data within the value range (15-19) and 50 pixel data within the value range (20-24). You can then feed the info into a chart control to get the Histogram graph.
Relevance: