]> Creatis software - clitk.git/commitdiff
binarize
authordsarrut <dsarrut>
Sun, 7 Feb 2010 08:49:38 +0000 (08:49 +0000)
committerdsarrut <dsarrut>
Sun, 7 Feb 2010 08:49:38 +0000 (08:49 +0000)
filters/clitkBinarizeImage.ggo
filters/clitkBinarizeImageGenericFilter.txx
vv/vvMainWindow.cxx
vv/vvToolBinarize.cxx
vv/vvToolBinarize.h

index c4620da18f96111e0ba685745c6d2da2d2088feb..9f655b660360837b73df2b421b388fe5d7bb9ec8 100644 (file)
@@ -16,3 +16,4 @@ option "upper"        u       "Upper intensity (default=max), fg is lower than this va
 option "fg"                    -       "Foreground (FG) or 'inside' value"               double        no      default="1"
 option "bg"                    -       "Background (BG) or 'ouside' value"               double        no      default="0"
 option "mode"          -       "Use FG and/or BG values (if FG, the BG is replaced by the input image values)" values="FG","BG","both"  default="both" no
+
index 80837bd05900ac59d4351bac0e4672c8e7cf9873..56d85e968dd82605a4495b40a0d4a2a94777961e 100644 (file)
@@ -93,6 +93,27 @@ namespace clitk
     DD(mArgsInfo.bg_given);
     DD(mArgsInfo.mode_arg);
 
+// <<<<<<< clitkBinarizeImageGenericFilter.txx
+//     DD(mArgsInfo.useFG_flag);
+//     DD(mArgsInfo.useBG_flag);
+
+//     thresholdFilter->SetInsideValue(mArgsInfo.fg_arg);
+
+//     // Keep BG value to 0 if maskFilterType is used after
+//     if (mArgsInfo.useBG_flag && mArgsInfo.useFG_flag) {
+//       thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg);
+//     }
+//     else {
+//       DD("0");
+//       thresholdFilter->SetOutsideValue(0);
+//     }
+
+//     // thresholdFilter->Update();
+
+//     // If no BG or no FG : new image, copy input with MaskImageFilter
+//     // If setFG -> FG BG have been changed
+//     if (mArgsInfo.useBG_flag && mArgsInfo.useFG_flag) {
+// =======
     /* Three modes : 
        - FG -> only use FG value for pixel in the Foreground (or Inside), keep input values for outside
        - BG -> only use BG value for pixel in the Background (or Outside), keep input values for inside
@@ -101,6 +122,7 @@ namespace clitk
       if (mArgsInfo.mode_arg == std::string("both")) {
       thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg);
       thresholdFilter->Update();
+      //>>>>>>> 1.5
       typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
       this->template SetNextOutput<OutputImageType>(outputImage);
     }
index 2cb28703e381aa1d6600aae56ca0170f90e3e07a..7e955c0167b365079317407779f3f60fa697188a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvMainWindow.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/06 15:38:13 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2010/02/07 08:49:41 $
+  Version:   $Revision: 1.8 $
   Author :   Pierre Seroul (pierre.seroul@gmail.com)
 
   Copyright (C) 200COLUMN_IMAGE_NAME
@@ -115,10 +115,10 @@ vvMainWindow::vvMainWindow() {
   this->setContextMenuPolicy(Qt::CustomContextMenu);
   contextActions.resize(0);
   QAction* actionOpen_new_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/fileopen.png")),
-                                                        tr("Open new Image"));
+                                                        tr("O&pen new Image"));
+  actionOpen_new_image->setShortcut(QKeySequence(tr("Ctrl+O")));
   connect(actionOpen_new_image,SIGNAL(triggered()),this,SLOT(OpenImages()));
   contextActions.push_back(actionOpen_new_image);
-  actionOpen_new_image->setShortcut("Ctrl+O");//Qt::CTRL & Qt::Key_O);
   contextMenu.addSeparator();
 
   QAction* actionClose_Image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")),
index c5f209de7e161434fac593b755f8e06aabdfbae4..9a45d1ceacc5d64b1a25c2fa99bc556c2b55b69a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolBinarize.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/02/06 15:38:14 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2010/02/07 08:49:42 $
+  Version:   $Revision: 1.6 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2008
@@ -66,10 +66,15 @@ vvToolBinarize::vvToolBinarize(QWidget * parent, Qt::WindowFlags f)
   connect(mCheckBoxUseBG, SIGNAL(toggled(bool)), this, SLOT(useFGBGtoggled(bool)));
 
   // VTK objects
+  /*
   mClipper = vtkImageClip::New();
   mSquares1 = vtkMarchingSquares::New();
   mSquaresMapper1 = vtkPolyDataMapper::New();
   mSquaresActor1 = vtkActor::New();
+  */
+  mImageContour = new vvImageContour;
+
+  //new vector of contours
 
   // Initialize some widget
   mThresholdSlider1->SetText("");
@@ -77,7 +82,6 @@ vvToolBinarize::vvToolBinarize(QWidget * parent, Qt::WindowFlags f)
   mFGSlider->SetText("Foreground value");
   mBGSlider->SetText("Background value");
 
-
   // Disable main widget while input image is not selected
   toolMainWidget->setEnabled(false);
 
@@ -143,18 +147,21 @@ void vvToolBinarize::InputIsSelected() {
   DD(mCurrentSliceManager->NumberOfSlicers());
   //    mClipper->SetInput(mCurrentSliceManager->GetSlicer(0)->GetInput());
   DD(mCurrentImage->GetFirstVTKImageData());
-  DD(mClipper);
+  //  DD(mClipper);
   DD(mCurrentSliceManager->GetSlicer(0));
+  mImageContour->setSlicer(mCurrentSliceManager->GetSlicer(0));
+
+  /*
   mClipper->SetInput(mCurrentImage->GetFirstVTKImageData());
-  
   mSquares1->SetInput(mClipper->GetOutput());
   mSquaresMapper1->SetInput(mSquares1->GetOutput());
+  mSquaresMapper1->ScalarVisibilityOff();
   mSquaresActor1->SetMapper(mSquaresMapper1);
   mSquaresActor1->GetProperty()->SetColor(1.0,0,0);
   mSquaresActor1->SetPickable(0);
   mCurrentSliceManager->GetSlicer(0)->GetRenderer()->AddActor(mSquaresActor1);
   mSquares1->Update();
-  
+  */
   
   DD("VTK end");
   
@@ -174,62 +181,63 @@ void vvToolBinarize::UpdateSlice(int slicer,int slices) {
 
   // !! signal update slice pas tjs quand move slicer ???
 
-
-   int slice = mCurrentSliceManager->GetSlicer(0)->GetSlice();
-    //int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice();
-    mClipper->SetInput(mCurrentSliceManager->GetSlicer(0)->GetInput());
-    int* extent = mCurrentSliceManager->GetSlicer(0)->GetImageActor()->GetDisplayExtent();
-    mClipper->SetOutputWholeExtent(extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]);
-    int i;
-    for (i = 0; i < 6;i = i+2)
-    {
-        if (extent[i] == extent[i+1])
-        {
-            break;
-        }
-    }
-
-    switch (i)
-    {
-    case 0:
-        if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[0] > slice)
-        {
-            mSquaresActor1->SetPosition(1,0,0);
-            // mSquaresActor2->SetPosition(1,0,0);
-        }
-        else
-        {
-            mSquaresActor1->SetPosition(-1,0,0);
-            // mSquaresActor2->SetPosition(-1,0,0);
-        }
-        break;
-    case 2:
-        if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[1] > slice)
-        {
-            mSquaresActor1->SetPosition(0,1,0);
-          //   mSquaresActor2->SetPosition(0,1,0);
-        }
-        else
-        {
-            mSquaresActor1->SetPosition(0,-1,0);
-            // mSquaresActor2->SetPosition(0,-1,0);
-        }
-        break;
-    case 4:
-        if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[2] > slice)
-        {
-            mSquaresActor1->SetPosition(0,0,1);
-            // mSquaresActor2->SetPosition(0,0,1);
-        }
-        else
-        {
-            mSquaresActor1->SetPosition(0,0,-1);
-            // mSquaresActor2->SetPosition(0,0,-1);
-        }
-        break;
-    }
-    mSquares1->Update();
-   //  mSquares2->Update();
+  mImageContour->update();
+
+  // int slice = mCurrentSliceManager->GetSlicer(0)->GetSlice();
+  // //int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice();
+  // mClipper->SetInput(mCurrentSliceManager->GetSlicer(0)->GetInput());
+  // int* extent = mCurrentSliceManager->GetSlicer(0)->GetImageActor()->GetDisplayExtent();
+  // mClipper->SetOutputWholeExtent(extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]);
+  // int i;
+  // for (i = 0; i < 6;i = i+2)
+  //   {
+  //       if (extent[i] == extent[i+1])
+  //     {
+  //           break;
+  //     }
+  //   }
+  
+  // switch (i)
+  //   {
+  //   case 0:
+  //     if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[0] > slice)
+  //       {
+  //     mSquaresActor1->SetPosition(1,0,0);
+  //     // mSquaresActor2->SetPosition(1,0,0);
+  //       }
+  //       else
+  //       {
+  //           mSquaresActor1->SetPosition(-1,0,0);
+  //           // mSquaresActor2->SetPosition(-1,0,0);
+  //       }
+  //       break;
+  //   case 2:
+  //       if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[1] > slice)
+  //       {
+  //           mSquaresActor1->SetPosition(0,1,0);
+  //         //   mSquaresActor2->SetPosition(0,1,0);
+  //       }
+  //       else
+  //       {
+  //           mSquaresActor1->SetPosition(0,-1,0);
+  //           // mSquaresActor2->SetPosition(0,-1,0);
+  //       }
+  //       break;
+  //   case 4:
+  //       if (mCurrentSliceManager->GetSlicer(0)->GetRenderer()->GetActiveCamera()->GetPosition()[2] > slice)
+  //       {
+  //           mSquaresActor1->SetPosition(0,0,1);
+  //           // mSquaresActor2->SetPosition(0,0,1);
+  //       }
+  //       else
+  //       {
+  //           mSquaresActor1->SetPosition(0,0,-1);
+  //           // mSquaresActor2->SetPosition(0,0,-1);
+  //       }
+  //       break;
+  //   }
+  //   mSquares1->Update();
+  //  //  mSquares2->Update();
 
     mCurrentSliceManager->Render(); 
 }
index b40b267cfbc764cb33b05ec6893afd108027aae8..50ca44bdc46f8e336bd5d23a8c17cc35e35c5def 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: vvToolBinarize.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/06 15:38:14 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/02/07 08:49:42 $
+  Version:   $Revision: 1.4 $
   Author :   David Sarrut (david.sarrut@creatis.insa-lyon.fr)
 
   Copyright (C) 2010
@@ -32,6 +32,7 @@
 #include <QDialog>
 
 #include "vvToolBase.h"
+#include "vvImageContour.h"
 #include "ui_vvToolBinarize.h"
 #include "clitkBinarizeImage_ggo.h"
 
@@ -94,6 +95,13 @@ class vvToolBinarize:
   vtkPolyDataMapper* mSquaresMapper1;
   vtkActor* mSquaresActor1;
 
+  vvImageContour * mImageContour;
+
+  /* vtkImageClip* mClipper; */
+  /* vtkMarchingSquares* mSquares1; */
+  /* vtkPolyDataMapper* mSquaresMapper1; */
+  /* vtkActor* mSquaresActor1; */
+
 }; // end class vvToolBinarize
 //------------------------------------------------------------------------------