Skip to content
Snippets Groups Projects
Commit 78d865fc authored by Sacha Percot-Tétu's avatar Sacha Percot-Tétu
Browse files

Corrected a bug in Quantification file managment

parent 45b57330
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ Quantification::Quantification(std::string filename) {
file >> s;
if(s.compare("Quant_Level_File") != 0) throw exception();
file >> this->size;
// this->size++;
this->size++;
if(this->size < 2) throw exception();
threshold = new int[this->size - 1];
values = new imagein::Image::depth_t[this->size];
......@@ -57,7 +57,7 @@ Quantification::Quantification(std::string filename) {
void Quantification::saveAs(std::string filename) {
ofstream file(filename.c_str(), fstream::out);
file << "Quant_Level_File" << endl;
file << this->size << endl;
file << (this->size - 1) << endl;
for(int i = 0; i < size - 1; ++i) {
double n = threshold[i];
file << n << endl;
......
......@@ -120,7 +120,7 @@ void QuantificationWidget::setQuantif(Quantification q) {
}
void QuantificationWidget::CentralWidget::setQuantif(Quantification q) {
this->_nThreshold = q.size;
this->_nThreshold = q.size - 1;
for(int i = 0; i < q.size - 1; ++i) {
_thresholdBoxes[i]->setValue(q.threshold[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment