int main()
{
using MeasurementType = float;
using FrequencyType = FrequencyContainerType::AbsoluteFrequencyType;
constexpr unsigned int numberOfComponents = 2;
FrequencyContainerType >;
HistogramType::Pointer histogram = HistogramType::New();
histogram->SetMeasurementVectorSize( numberOfComponents );
size.Fill(3);
HistogramType::MeasurementVectorType lowerBound( numberOfComponents );
HistogramType::MeasurementVectorType upperBound( numberOfComponents );
lowerBound[0] = 1.1;
lowerBound[1] = 2.6;
upperBound[0] = 7.1;
upperBound[1] = 8.6;
histogram->Initialize(size, lowerBound, upperBound );
histogram->SetFrequency(0UL, static_cast<FrequencyType>(0.0));
histogram->SetFrequency(1UL, static_cast<FrequencyType>(2.0));
histogram->SetFrequency(2UL, static_cast<FrequencyType>(3.0));
histogram->SetFrequency(3UL, static_cast<FrequencyType>(2.0f));
histogram->SetFrequency(4UL, static_cast<FrequencyType>(0.5f));
histogram->SetFrequency(5UL, static_cast<FrequencyType>(1.0f));
histogram->SetFrequency(6UL, static_cast<FrequencyType>(5.0f));
histogram->SetFrequency(7UL, static_cast<FrequencyType>(2.5f));
histogram->SetFrequency(8UL, static_cast<FrequencyType>(0.0f));
index[0] = 0;
index[1] = 2;
std::cout << "Frequency of the bin at index " << index
<< " is " << histogram->GetFrequency(index)
<< ", and the bin's instance identifier is "
<< histogram->GetInstanceIdentifier(index) << std::endl;
HistogramType::MeasurementVectorType mv( numberOfComponents );
mv[0] = 4.1;
mv[1] = 5.6;
index.Fill(1);
std::cout << "Measurement vector at the center bin is "
<< histogram->GetMeasurementVector(index) << std::endl;
std::cout << "Index of the measurement vector " << mv
<< " is " << resultingIndex << std::endl;
std::cout << "Instance identifier of index " << index
<< " is " << histogram->GetInstanceIdentifier(index)
<< std::endl;
index.Fill(100);
if ( histogram->IsIndexOutOfBounds(index) )
{
std::cout << "Index " << index << " is out of bounds." << std::endl;
}
std::cout << "Number of bins = " << histogram->Size()
<< " Total frequency = " << histogram->GetTotalFrequency()
<< " Dimension sizes = " << histogram->GetSize() << std::endl;
std::cout << "50th percentile along the first dimension = "
<< histogram->Quantile(0, 0.5) << std::endl;
return EXIT_SUCCESS;
}