X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolImageArithm.cxx;h=0f6221bb9623d07b4c9598c73b1c0b952d4e0736;hb=cbe5a471e16307e956e4cf5653a61cd5d83c4ee3;hp=ad6343ed15c288e2ec55afab74b96a9d2157e8d5;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/vv/vvToolImageArithm.cxx b/vv/vvToolImageArithm.cxx index ad6343e..0f6221b 100644 --- a/vv/vvToolImageArithm.cxx +++ b/vv/vvToolImageArithm.cxx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #include "vvToolImageArithm.h" #include "vvSlicer.h" @@ -82,7 +82,6 @@ void vvToolImageArithm::InputIsSelected(vvSlicerManager * l) { mInput1 = l; mTwoInputs = false; - // DD("Single input"); mGroupBoxTwoInputs->setEnabled(false); mGroupBoxOneInput->setEnabled(true); } @@ -92,7 +91,6 @@ void vvToolImageArithm::InputIsSelected(vvSlicerManager * l) //------------------------------------------------------------------------------ void vvToolImageArithm::GetArgsInfoFromGUI() { - // DD("GetArgsInfoFromGUI"); mArgsInfo.input1_given = false; if (mTwoInputs) { mArgsInfo.input2_given = true; @@ -143,19 +141,27 @@ void vvToolImageArithm::apply() inputs.push_back(mInput2->GetImage()); // Check input type - if (inputs[0]->GetScalarTypeAsString() != inputs[1]->GetScalarTypeAsString()) { + if (inputs[0]->GetScalarTypeAsITKString() != inputs[1]->GetScalarTypeAsITKString()) { std::cerr << "Sorry inputs should have the same pixeltype." << std::endl; - std::cerr << "Input1 = " << inputs[0]->GetScalarTypeAsString() << std::endl; - std::cerr << "Input2 = " << inputs[1]->GetScalarTypeAsString() << std::endl; + std::cerr << "Input1 = " << inputs[0]->GetScalarTypeAsITKString() << std::endl; + std::cerr << "Input2 = " << inputs[1]->GetScalarTypeAsITKString() << std::endl; QApplication::restoreOverrideCursor(); - QMessageBox::information(this, "Wrong image type","Sorry, could not perform operation. Please select inputs with same pixe type."); + QMessageBox::information(this, "Wrong image type","Sorry, could not perform operation. Please select inputs with same pixel type."); + close(); + return; + } + + // Check size + if (!mInput1->GetImage()->HaveSameSizeAndSpacingThan(mInput2->GetImage())) { + std::cerr << "Sorry inputs should have the same size and spacing." << std::endl; + QApplication::restoreOverrideCursor(); + QMessageBox::information(this, "Wrong images size","Sorry, could not perform operation. Please select inputs with same size and spacing."); close(); return; } } else { // Input inputs.push_back(mInput1->GetImage()); - DD("Single input"); } // Main filter