Parameters
- MinValue
- The lowest pixel value to be included
- MaxValue
- The highest pixel value to be included
- BinSize
- The number of adjacent pixel values to be grouped into each bin
Return Value
An integer array containing the distribution.
DicomImage image = new DicomImage("your_dicom_image.dcm"); int minPixelValue = 0; int maxPixelValue = 3000; int binSize = 50; int[] histogram = image.Histogram(minPixelValue, maxPixelValue, binSize); // Example output: // histogram[0] = 55772 -> 55,772 pixels have values between 0-49 // histogram[1] = 0 -> No pixels have values between 50 - 99 // Printing histogram values (mapping index to HU range) for (int i = 0; i < histogram.Length; i++) { int lowerBound = minPixelValue + (i * binSize); int upperBound = lowerBound + binSize - 1; Console.WriteLine($"Bin {lowerBound} to {upperBound}: {histogram[i]} pixels"); }