diff --git a/app/Operations/BinaryMaskOp.cpp b/app/Operations/BinaryMaskOp.cpp index dd4ef225d54eea08ca5c62d9ad78d224f5540cef..90dc868c5cf3a640b09a884177a86f46864d948a 100644 --- a/app/Operations/BinaryMaskOp.cpp +++ b/app/Operations/BinaryMaskOp.cpp @@ -80,6 +80,10 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd, const Image_t<double>* dblImg = imgBox->getDblImage(imgBox->currentText().toStdString()); if(dblImg == nullptr) return; mask = new Image_t<double>(*dblImg); + if(mask->getHeight() != dblImg->getHeight() || mask->getWidth() != dblImg->getWidth()) + QMessageBox::information(nullptr, qApp->translate("BinaryMaskOp", "warning Apply Mask"), + qApp->translate("BinaryMaskOp", + "you have performed a mask operation between two images of different sizes")); } else return; @@ -100,6 +104,11 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd, *it = *it / max; } + if(mask->getHeight() != img->getHeight() || mask->getWidth() != img->getWidth()) + QMessageBox::information(nullptr, qApp->translate("BinaryMaskOp", "warning Apply Mask"), + qApp->translate("BinaryMaskOp", + "you have performed a mask operation between two images of different sizes")); + const unsigned int width = min(mask->getWidth(), img->getWidth()); const unsigned int height = min(mask->getHeight(), img->getHeight()); auto* resImg = new Image_t<double>(width, height, img->getNbChannels()); diff --git a/app/Operations/SplitColorOp.cpp b/app/Operations/SplitColorOp.cpp index 1f100272aa4a4c4ea7990282a95e5cf4142c2a3f..6c2120693b1821c8ff576d39430b9b66710e4b9b 100644 --- a/app/Operations/SplitColorOp.cpp +++ b/app/Operations/SplitColorOp.cpp @@ -17,6 +17,7 @@ * along with ImageINSA. If not, see <http://www.gnu.org/licenses/>. */ #include <GrayscaleImage.h> +#include <QMessageBox> #include "SplitColorOp.h" #include "../Tools.h" @@ -33,9 +34,14 @@ SplitColorOp::SplitColorOp() : Operation(qApp->translate("Operations", "Split co } void SplitColorOp:: operator()(const imagein::Image* image, const std::map<const imagein::Image*, std::string>&) { + if(image->getNbChannels()==1){ + QMessageBox::warning(nullptr, qApp->translate("Operations", "The operation cannot be applied on this image"), + qApp->translate("Operations", "The image is not in color.")); + return; + } for(unsigned int c = 0; c < image->getNbChannels(); ++c) { - GrayscaleImage* resImg = new GrayscaleImage(image->getWidth(), image->getHeight()); + auto* resImg = new GrayscaleImage(image->getWidth(), image->getHeight()); for(unsigned int j = 0; j < resImg->getHeight(); ++j) { for(unsigned int i = 0; i < resImg->getWidth(); ++i) { resImg->setPixel(i, j, image->getPixel(i, j, c)); diff --git a/lib/detiq-t b/lib/detiq-t index 2a63e6517079b78bff5d9ae1fb48d30e32dca653..4e8b354dbc606f52edfabe5370010acdc011c5f4 160000 --- a/lib/detiq-t +++ b/lib/detiq-t @@ -1 +1 @@ -Subproject commit 2a63e6517079b78bff5d9ae1fb48d30e32dca653 +Subproject commit 4e8b354dbc606f52edfabe5370010acdc011c5f4