]> Creatis software - clitk.git/commitdiff
fix MIP bug
authorschaerer <schaerer>
Thu, 1 Apr 2010 13:54:35 +0000 (13:54 +0000)
committerschaerer <schaerer>
Thu, 1 Apr 2010 13:54:35 +0000 (13:54 +0000)
vv/vvMainWindow.cxx
vv/vvMaximumIntensityProjection.cxx
vv/vvMaximumIntensityProjection.h

index 029df0fd26433e9f562ff330ff9c5e2234f68245..422f3ef977cc3c3ed2db42e7718e288f390d14ee 100644 (file)
@@ -341,7 +341,8 @@ void vvMainWindow::ComputeMIP()
   vvSlicerManager* selected_slicer = mSlicerManagers[GetSlicerIndexFromItem(DataTree->selectedItems()[0])];
   QFileInfo info(selected_slicer->GetFileName().c_str());
   mip.Compute(selected_slicer);
-  AddImage(mip.GetOutput(),info.path().toStdString()+"/"+info.completeBaseName().toStdString()+"_mip.mhd");
+  if (!mip.error)
+      AddImage(mip.GetOutput(),info.path().toStdString()+"/"+info.completeBaseName().toStdString()+"_mip.mhd");
 }
 //------------------------------------------------------------------------------
 
index 08f0dcddf0955412b76bda548c3994e2fa8e0ac3..8baeb5545c7665e8e4af1a8fdfba25722795a9ad 100644 (file)
@@ -24,6 +24,7 @@
 #include "vvToITK.h"
 #include "vvFromITK.h"
 #include "vvMaximumIntensityProjection.h"
+#include <QMessageBox>
 
 void vvMaximumIntensityProjection::Compute(vvSlicerManager * slicer_manager)
 {
@@ -32,10 +33,15 @@ if (clitk::IsSameType<TYPE>(image->GetScalarTypeAsString())) { this->Update_With
     std::string list = clitk::CreateListOfTypes<short>();
     vvImage::Pointer image=slicer_manager->GetSlicer(0)->GetImage();
     TRY_TYPE(float);
+    TRY_TYPE(double);
+    TRY_TYPE(int);
+    TRY_TYPE(unsigned int);
     TRY_TYPE(short);
-    std::cerr << "Error, I don't know the type '" << image->GetScalarTypeAsString() << "' for the input image. "
-        << std::endl << "Known types are " << list << std::endl;
-    exit(0);
+    TRY_TYPE(unsigned short);
+    TRY_TYPE(char);
+    TRY_TYPE(unsigned char);
+    QMessageBox::warning(0,"Unsupported image type",QString("Error, I don't know the type")+QString(image->GetScalarTypeAsString().c_str()) +QString("' for the input image.\nKnown types are ") + QString(list.c_str()));
+    error=true;
 #undef TRY_TYPE
 }
 
@@ -51,7 +57,8 @@ void vvMaximumIntensityProjection::Update_WithPixelType(vvImage::Pointer image)
             Update_WithDimAndPixelType<PixelType,4>(image);
             break;;
         default:
-            DD("Error: dimension not handled.");
+            QMessageBox::warning(0,"Unsupported image dimension",QString("Unsupported image dimension. Supported dimensions are 3 and 4"));
+            error=true;
     }
 }
 
index 48051cb552f874d65bf6ea818159538b55b357eb..6da17f0f52658b5bc04510fa83f57bfef31367e0 100644 (file)
@@ -27,6 +27,7 @@ public:
     ///Computes the MIP image on the given vvImage
     void Compute(vvSlicerManager*);
     vvImage::Pointer GetOutput() {return mOutputImage;};
+    bool error;
 
 protected:
     template<class PixelType,int Dim> void Update_WithDimAndPixelType(vvImage::Pointer);