mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-20 19:39:17 -05:00
merge conflict + update ghoul ref
This commit is contained in:
+1
-1
Submodule ext/ghoul updated: 9bb5ce6bf4...5ef066647c
@@ -70,7 +70,12 @@ public:
|
||||
void generateEqualizer();
|
||||
Histogram equalize();
|
||||
float equalize (float);
|
||||
float entropy();
|
||||
|
||||
/**
|
||||
* Entropy is a measure of histogram dispersion.
|
||||
* @return entropy value
|
||||
*/
|
||||
float entropy() const;
|
||||
|
||||
float highestBinValue(bool equalized, int overBins=0);
|
||||
float binWidth();
|
||||
|
||||
@@ -91,7 +91,7 @@ bool DataSphere::initialize(){
|
||||
readTransferFunctions(_transferFunctionsFile.value());
|
||||
|
||||
setPropertyCallbacks();
|
||||
_useHistogram.setValue(true);
|
||||
//_useHistogram.setValue(true);
|
||||
_autoFilter.setValue(true);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DataProcessor";
|
||||
const int NumBins = 512;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -82,7 +83,7 @@ float DataProcessor::processDataPoint(float value, int option){
|
||||
|
||||
float v;
|
||||
if(_useHistogram){
|
||||
v = histogram->equalize(normalizeWithStandardScore(value, mean, sd, glm::vec2(_fitValues[option])))/(float)512;
|
||||
v = histogram->equalize(normalizeWithStandardScore(value, mean, sd, glm::vec2(_fitValues[option])))/(float)NumBins;
|
||||
// v = histogram->equalize(value)/(float)512;
|
||||
}else{
|
||||
v = normalizeWithStandardScore(value, mean, sd, _normValues);
|
||||
@@ -128,27 +129,32 @@ void DataProcessor::calculateFilterValues(std::vector<int> selectedOptions){
|
||||
float mean, standardDeviation, filterMid, filterWidth;
|
||||
|
||||
_filterValues = glm::vec2(0.0);
|
||||
if(numSelected <= 0) return;
|
||||
if (numSelected <= 0) return;
|
||||
|
||||
if(!_histograms.empty()){
|
||||
for(int option : selectedOptions){
|
||||
if(!_useHistogram){
|
||||
if (!_histograms.empty()) {
|
||||
for (int option : selectedOptions) {
|
||||
if (!_useHistogram) {
|
||||
mean = (1.0/_numValues[option])*_sum[option];
|
||||
standardDeviation = _standardDeviation[option];
|
||||
histogram = _histograms[option];
|
||||
|
||||
filterMid = histogram->highestBinValue(_useHistogram);
|
||||
filterWidth = mean+histogram->binWidth();
|
||||
|
||||
filterMid = normalizeWithStandardScore(filterMid, mean, standardDeviation, _normValues);
|
||||
//filterWidth = histogram->binWidth();
|
||||
|
||||
filterWidth = fabs(0.5-normalizeWithStandardScore(filterWidth, mean, standardDeviation, _normValues));
|
||||
//filterWidth = fabs(normalizeWithStandardScore(filterWidth, mean, standardDeviation, _normValues));
|
||||
//atleast one pixel value width. 1/512 above mid and 1/512 below mid => 1/256 filtered
|
||||
filterWidth = std::min(filterWidth, 1.0f/512.0f);
|
||||
filterMid = normalizeWithStandardScore(filterMid, mean, standardDeviation, _normValues);
|
||||
//filterMid += filterWidth;
|
||||
}else{
|
||||
Histogram hist = _histograms[option]->equalize();
|
||||
filterMid = hist.highestBinValue(true);
|
||||
std::cout << filterMid << std::endl;
|
||||
filterWidth = 1.f/512.f;
|
||||
filterWidth = std::min(1.f / (float)NumBins, 1.0f/512.0f);
|
||||
}
|
||||
|
||||
std::cout << "filtermid: " << filterMid << std::endl;
|
||||
std::cout << "filterwidth: " << filterWidth << std::endl;
|
||||
_filterValues += glm::vec2(filterMid, filterWidth);
|
||||
|
||||
}
|
||||
@@ -194,7 +200,7 @@ void DataProcessor::add(std::vector<std::vector<float>>& optionValues, std::vect
|
||||
float max = normalizeWithStandardScore(_max[i], mean, _standardDeviation[i], glm::vec2(_fitValues[i]));
|
||||
|
||||
if(!_histograms[i]){
|
||||
_histograms[i] = std::make_shared<Histogram>(min, max, 512);
|
||||
_histograms[i] = std::make_shared<Histogram>(min, max, NumBins);
|
||||
}
|
||||
else{
|
||||
//Re normalize all the values in the old histogram
|
||||
@@ -227,7 +233,17 @@ void DataProcessor::add(std::vector<std::vector<float>>& optionValues, std::vect
|
||||
}
|
||||
|
||||
_histograms[i]->generateEqualizer();
|
||||
<<<<<<< Updated upstream
|
||||
|
||||
=======
|
||||
|
||||
// std::cout << std::endl;
|
||||
// _histograms[i]->print();
|
||||
// std::cout << std::endl;
|
||||
// std::cout << "Eq: ";
|
||||
Histogram hist = _histograms[i]->equalize();
|
||||
hist.print();
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ float Histogram::equalize(float value){
|
||||
return _equalizer[bin];
|
||||
}
|
||||
|
||||
float Histogram::entropy(){
|
||||
float Histogram::entropy() const {
|
||||
float entropy;
|
||||
for(int i = 0; i < _numBins; i++){
|
||||
if(_data[i] != 0)
|
||||
@@ -316,10 +316,10 @@ void Histogram::print() const {
|
||||
|
||||
float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
int highestBin = 0;
|
||||
float highestValue = 0;
|
||||
float highestValue = 0.0f;
|
||||
|
||||
for(int i=0; i<_numBins; i++){
|
||||
float value = 0;
|
||||
float value = 0.0f;
|
||||
int num = 0;
|
||||
for(int j=0; j<overBins; j++){
|
||||
if(i-j>0){
|
||||
@@ -334,6 +334,7 @@ float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
|
||||
value += _data[i];
|
||||
value /= (float)++num;
|
||||
//value = _data[i];
|
||||
|
||||
if(value > highestValue){
|
||||
highestBin = i;
|
||||
@@ -341,9 +342,8 @@ float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!equalized){
|
||||
float low = _minValue + float(highestBin) / _numBins * (_maxValue - _minValue);
|
||||
float low = _minValue + (float(highestBin) / _numBins) * (_maxValue - _minValue);
|
||||
float high = low + (_maxValue - _minValue) / float(_numBins);
|
||||
return (high+low)/2.0;
|
||||
}else{
|
||||
@@ -353,7 +353,7 @@ float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
}
|
||||
|
||||
float Histogram::binWidth(){
|
||||
return (_maxValue-_minValue)/_numBins;
|
||||
return (_maxValue-_minValue)/float(_numBins);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Histogram& hist){
|
||||
|
||||
Reference in New Issue
Block a user