# Histogram Python

**URL:** https://discourse.itk.org/t/histogram-python/2480
**Category:** Algorithms
**Created:** [December 6, 2019, 8:24am UTC](https://discourse.itk.org/t/histogram-python/2480 "2019-12-06T08:24:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fraca](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/f19dbf/32.png) [@fraca](https://discourse.itk.org/u/fraca)
#### Post date: [December 6, 2019, 8:24am UTC](https://discourse.itk.org/t/histogram-python/2480/1 "2019-12-06T08:24:10Z")

</div>

Hi, i’m trying to write these lines in Python but i dont’t know how to declare the variables (size,upperbound,lowerbound,measurement). Can you help me?

> typedef itk::Statistics::Histogram\<PixelType, 1\> HistogramType;  
> PixelType minValue = itk::NumericTraits::max();  
> PixelType maxValue = itk::NumericTraits::NonpositiveMin();  
> HistogramType::Pointer histogram = HistogramType::New();  
> HistogramType::SizeType size;  
> HistogramType::MeasurementVectorType lowerBound;  
> HistogramType::MeasurementVectorType upperBound;  
> size[0] = 100;  
> lowerBound.Fill(minValue);  
> upperBound.Fill(maxValue);  
> histogram-\>Initialize(size,lowerBound,upperBound);  
> histogram-\>SetToZero();  
> HistogramType::MeasurementVectorType measurement;  
> typedef HistogramType::MeasurementType MeasurementType;  
> measurement[0] = itk::NumericTraits::Zero;

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [December 6, 2019, 2:59pm UTC](https://discourse.itk.org/t/histogram-python/2480/2 "2019-12-06T14:59:48Z")

</div>

These two histogram examples have Python code:  
[HistogramCreationAndBinAccess](https://itk.org/ITKExamples/src/Numerics/Statistics/HistogramCreationAndBinAccess/Documentation.html)  
[AdaptiveHistogramEqualizationImageFilter](https://itk.org/ITKExamples/src/Numerics/Statistics/HistogramCreationAndBinAccess/Documentation.html)  
Please take a look.
