diff --git a/app/Operations/MICD.cpp b/app/Operations/MICD.cpp index 03232e87cc1fc77e98b2676e646f972e0646e1c0..d04ee25ea5cccf0c405857a6a80560077fef5aef 100644 --- a/app/Operations/MICD.cpp +++ b/app/Operations/MICD.cpp @@ -45,7 +45,7 @@ MICD::~MICD() } -string MICD::execute( const GrayscaleImage *im, Prediction prediction_alg, Image **err_image, Image **recons_image, double Q ) { +string MICD::execute( const GrayscaleImage *im, Prediction prediction_alg, imagein::ImageDouble **err_image, Image **recons_image, double Q ) { char buffer[255]; if( quantdef == NULL ) { throw "Error in MICD::execute:\nquantdef = NULL"; @@ -66,7 +66,7 @@ string MICD::execute( const GrayscaleImage *im, Prediction prediction_alg, Image set_levels(); codlq(0); /* allocation mmoire pour l'image d'erreur de prdiction */ - GrayscaleImage *error_prediction_image = new GrayscaleImage(nbc, nbl); + ImageDouble *error_prediction_image = new ImageDouble(nbc, nbl, 1); Image *reconstructed_image = new GrayscaleImage(*im); // File these images with all values of zero long wcounter, hcounter; @@ -135,8 +135,6 @@ string MICD::execute( const GrayscaleImage *im, Prediction prediction_alg, Image int tempvalue; tempvalue = ier + 128; - if( tempvalue > 255 ) tempvalue = 255; - if( tempvalue < 0 ) tempvalue = 0; po = tempvalue; error_prediction_image->setPixelAt( j, i, po ); tempvalue = pred + ireco; @@ -156,7 +154,6 @@ string MICD::execute( const GrayscaleImage *im, Prediction prediction_alg, Image } } - /* affichage des rsultats */ sprintf(buffer, "\nL'entropie de l'image d'erreur de prediction vaut : %lf\n",h); returnval = returnval + buffer; diff --git a/app/Operations/MICD.h b/app/Operations/MICD.h index c54b9fa82bfd776033628b185c98b469d80eb0b2..16a1d8a15b0f28338a42b940ea8424f452adae58 100644 --- a/app/Operations/MICD.h +++ b/app/Operations/MICD.h @@ -30,7 +30,7 @@ public: MICD(); enum Prediction {PX_EQ_A, PX_EQ_B, PX_EQ_APC, PX_EQ_Q}; virtual ~MICD(); - std::string execute( const imagein::GrayscaleImage *im, Prediction prediction_alg, imagein::Image **err_image, imagein::Image **recons_image, double Q = 0 ); + std::string execute(const imagein::GrayscaleImage *im, Prediction prediction_alg, imagein::ImageDouble **err_image, imagein::Image **recons_image, double Q = 0 ); void setQuantification( Quantification* tquantdef ); private: std::string print_iloiqu(); diff --git a/app/Operations/MICDDialog.cpp b/app/Operations/MICDDialog.cpp index ca87540404c5ec314f653717af6a12e9937c5cd3..b43c67c3142e2c4726196645f10ff71915124a25 100644 --- a/app/Operations/MICDDialog.cpp +++ b/app/Operations/MICDDialog.cpp @@ -55,7 +55,6 @@ Quantification* MICDDialog::getQuantification() const { catch(std::exception&) { return NULL; } - } MICD::Prediction MICDDialog::getPrediction() const { diff --git a/app/Operations/MICDEncodingOp.cpp b/app/Operations/MICDEncodingOp.cpp index 19e5e2f9ac7e878c442c1ecb64856dbc84c172ea..3f16cf4619102402e274671ce0283977cf56edf9 100644 --- a/app/Operations/MICDEncodingOp.cpp +++ b/app/Operations/MICDEncodingOp.cpp @@ -43,21 +43,23 @@ void MICDEncodingOp::operator()(const imagein::Image* img, const std::map<const QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec()); - if(code!=QDialog::Accepted) return; + if(code != QDialog::Accepted) return; MICD micd; try { micd.setQuantification(dialog->getQuantification()); } catch(const char* str) { - QMessageBox::critical(NULL, qApp->translate("MICD", "Error while loading quantification file"), qApp->translate("MICD", "The specified quantification file could not be opened !")); + QMessageBox::critical(NULL, qApp->translate("MICD", "Error while loading quantification file"), + qApp->translate("MICD", "The specified quantification file could not be opened !")); return; } GrayscaleImage* image = Converter<GrayscaleImage>::convert(*img); - Image *errorImage, *reconstructedImage; + Image *reconstructedImage; + ImageDouble *errorImage; string s = micd.execute(image, dialog->getPrediction(), &errorImage, &reconstructedImage, dialog->getQ()); outText(s); - outImage(errorImage, qApp->translate("MICD", "Error image").toStdString()); + outDoubleImage(errorImage, qApp->translate("MICD", "Error image").toStdString()); outImage(reconstructedImage, qApp->translate("MICD", "Reconstructed image").toStdString()); } diff --git a/core/Operation.cpp b/core/Operation.cpp index 1d78a0cc3538ba025169ad734587eaf3ba2d0d4d..59b8f3280f006319c32e874c99f0a17ca577c341 100644 --- a/core/Operation.cpp +++ b/core/Operation.cpp @@ -68,7 +68,7 @@ void GenericOperation::outImage(imagein::Image* img, string title) { this->outImgWnd(wnd, title); } -void GenericOperation::outDoubleImage(imagein::Image_t<double>* img, string title, bool norm, bool log, double logScale, bool abs) { +void GenericOperation::outDoubleImage(imagein::ImageDouble* img, string title, bool norm, bool log, double logScale, bool abs) { DoubleImageWindow* wnd = new DoubleImageWindow(img, QString(), norm, log, logScale, abs); this->outImgWnd(wnd, title); } diff --git a/core/Operation.h b/core/Operation.h index 148a194161baae8f8d9f168211c19f26e9a93662..73ce8090391e422c62691b9de4819634caf71a1f 100644 --- a/core/Operation.h +++ b/core/Operation.h @@ -120,7 +120,7 @@ class GenericOperation { * @param logScale The logarithm scale constant to apply if the Image is displayed using log. scale (value from 8^-3 to 8^3, see genericinterface::DoubleImageWindow for more details). * @param abs wether to display an absolute value version of the Image (doesn't affect the data contained in the image, compatible with any other options). */ - void outDoubleImage(imagein::Image_t<double>* img, std::string title = "", bool norm=false, bool log=false, double logScale = 1., bool abs = false); + void outDoubleImage(imagein::ImageDouble* img, std::string title = "", bool norm=false, bool log=false, double logScale = 1., bool abs = false); /**