]> Creatis software - clitk.git/commitdiff
Debug try with ImageReslice update and autoCrop
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 9 Dec 2015 10:57:16 +0000 (11:57 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 9 Dec 2015 10:57:16 +0000 (11:57 +0100)
32 files changed:
common/clitkDicomRTStruct2ImageFilter.cxx
itk/clitkMeshToBinaryImageFilter.txx
tools/CMakeLists.txt
tools/clitkFooImage.cxx
tools/clitkFooImage.ggo
tools/clitkFooImageGenericFilter.h
tools/clitkFooImageGenericFilter.txx
tools/clitkSum.cxx [new file with mode: 0644]
tools/clitkSum.ggo [new file with mode: 0644]
tools/clitkSumGenericFilter.h [new file with mode: 0644]
tools/clitkSumGenericFilter.txx [new file with mode: 0644]
vv/CMakeLists.txt
vv/qt_ui/vvToolTest.ui [new file with mode: 0644]
vv/vvAnimatedGIFWriter.cxx
vv/vvBinaryImageOverlayActor.cxx
vv/vvImageContour.cxx
vv/vvLandmarksPanel.cxx
vv/vvMainWindow.cxx
vv/vvMesh.cxx
vv/vvMeshActor.cxx
vv/vvROIActor.cxx
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvSlicerManager.cxx
vv/vvSurfaceViewerDialog.cxx
vv/vvToolBinarize.cxx
vv/vvToolCropImage.cxx
vv/vvToolROIManager.cxx
vv/vvToolRigidReg.cxx
vv/vvToolTest.cxx [new file with mode: 0644]
vv/vvToolTest.h [new file with mode: 0644]
vv/vvToolWidgetBase.cxx

index 20a4b7009c14e8707b080b1225a615130ceec9b5..eb54bdc0b2cd626f7fca1c7f0a879890187f5656 100644 (file)
@@ -31,7 +31,6 @@
 #include <vtkImageStencil.h>
 #include <vtkLinearExtrusionFilter.h>
 #include <vtkMetaImageWriter.h>
-#include <vtkVersion.h>
 
 
 //--------------------------------------------------------------------
index b67cca0c96825563329c2a4534071956c6b4820e..3c3ccdb23d28337b838f71ebe9b4f71df765d46d 100644 (file)
@@ -140,7 +140,7 @@ GenerateData()
 #if VTK_MAJOR_VERSION <= 5
     sts->SetInput(extrude->GetOutput());
 #else
-    sts->SetInputData(extrude->GetOutput());
+    sts->SetInputConnection(extrude->GetOutputPort());
 #endif
     
     // When extrude ScaleFactor indicate the extrusion scaling (default = 1)
index 6bd72a3e62b55397fbaa4fb98de1aa2ce9e9a0a2..3bf89482b7c98064a3fc9a5ba1f975f2009f7806 100644 (file)
@@ -153,11 +153,6 @@ if(CLITK_BUILD_TOOLS)
   target_link_libraries(clitkUnsharpMask clitkCommon )
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkUnsharpMask)
 
-  WRAP_GGO(clitkFooImage_GGO_C clitkFooImage.ggo)
-  add_executable(clitkFooImage clitkFooImage.cxx ${clitkFooImage_GGO_C})
-  target_link_libraries(clitkFooImage clitkCommon )
-  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkFooImage)
-
   WRAP_GGO(clitkMedianImageFilter_GGO_C clitkMedianImageFilter.ggo)
   add_executable(clitkMedianImageFilter clitkMedianImageFilter.cxx ${clitkMedianImageFilter_GGO_C})
   target_link_libraries(clitkMedianImageFilter clitkMedianImageFilterLib clitkCommon)
@@ -251,6 +246,11 @@ if(CLITK_BUILD_TOOLS)
   target_link_libraries(clitkMIP clitkMIPLib clitkCommon)
   set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMIP)
 
+  WRAP_GGO(clitkSum_GGO_C clitkSum.ggo)
+  add_executable(clitkSum clitkSum.cxx ${clitkSum_GGO_C})
+  target_link_libraries(clitkSum clitkCommon)
+  set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSum)
+
   WRAP_GGO(clitkTransformLandmarks_GGO_C clitkTransformLandmarks.ggo)
   add_executable(clitkTransformLandmarks clitkTransformLandmarks.cxx ${clitkTransformLandmarks_GGO_C})
   target_link_libraries(clitkTransformLandmarks clitkCommon)
index 51d00ba4814f84d10e4d5dcef4d218db4be12573..046f6aab8b3b1e536f9acb20c46aad6b3b36b9ad 100644 (file)
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================**/
 
-/* =================================================
- * @file   clitkFooImageGenericFilter.txx
- * @author xxx <xxx@creatis.insa-lyon.fr>
- * @date   29 June 2029
- *
- * @brief FooImage an image
- *
- ===================================================*/
-
 // clitk
 #include "clitkFooImage_ggo.h"
 #include "clitkFooImageGenericFilter.h"
index 3d0c8dbf97d92ef173713193fba0761dcbf7a9a5..d85977318e339b55a582840972986bf8c0bda215 100644 (file)
@@ -10,9 +10,4 @@ option "imagetypes"   -       "Display allowed image types"     flag          off
 
 option "input"         i       "Input image filename"            string        required
 option "output"        o       "Output image filename"           string        required
-option "lower"         l       "Lower intensity (default=min), fg is greater than this value"    double        optional
-option "upper"         u       "Upper intensity (default=max), fg is lower than this value"      double        optional
 
-option "fg"                    -       "Foreground (FG) or 'inside' value"               double        optional        default="1"
-option "bg"                    -       "Background (BG) or 'ouside' value"               double        optional        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" optional
index e230f91b47f793e2549b44a7dd3d037fb9529c56..7578411864512546a8d46e2840a377154a037590 100644 (file)
@@ -15,8 +15,8 @@
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================**/
-#ifndef CLITKFooIMAGEGENERICFILTER_H
-#define CLITKFooIMAGEGENERICFILTER_H
+#ifndef clitkFooImageGenericFilter_h
+#define clitkFooImageGenericFilter_h
 #include "clitkIO.h"
 #include "clitkImageToImageGenericFilter.h"
 
index 88473a02a0f65e3b234d0eb24c0384912ad9ff90..1724454b17a10776e711227679ed46c999f17f27 100644 (file)
 #ifndef clitkFooImageGenericFilter_txx
 #define clitkFooImageGenericFilter_txx
 
-/* =================================================
- * @file   clitkFooImageGenericFilter.txx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date   29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
 // itk include
 #include "itkBinaryThresholdImageFilter.h"
 #include "itkMaskImageFilter.h"
@@ -95,40 +86,11 @@ FooImageGenericFilter<args_info_type>::UpdateWithInputImageType()
   typedef itk::BinaryThresholdImageFilter<InputImageType, OutputImageType> BinaryThresholdImageFilterType;
   typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New();
   thresholdFilter->SetInput(input);
-  thresholdFilter->SetInsideValue(mArgsInfo.fg_arg);
-
-  if (mArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast<PixelType>(mArgsInfo.lower_arg));
-  if (mArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast<PixelType>(mArgsInfo.upper_arg));
-
-  if (mArgsInfo.mode_arg == std::string("both")) {
-    thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg);
-    thresholdFilter->Update();
-
-    typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
-    this->template SetNextOutput<OutputImageType>(outputImage);
-  } else {
-    typename InputImageType::Pointer outputImage;
-    thresholdFilter->SetOutsideValue(0);
-    if (mArgsInfo.mode_arg == std::string("BG")) {
-      typedef itk::MaskImageFilter<InputImageType,OutputImageType> maskFilterType;
-      typename maskFilterType::Pointer maskFilter = maskFilterType::New();
-      maskFilter->SetInput1(input);
-      maskFilter->SetInput2(thresholdFilter->GetOutput());
-      maskFilter->SetOutsideValue(mArgsInfo.bg_arg);
-      maskFilter->Update();
-      outputImage = maskFilter->GetOutput();
-    } else {
-      typedef itk::MaskNegatedImageFilter<InputImageType,OutputImageType> maskFilterType;
-      typename maskFilterType::Pointer maskFilter = maskFilterType::New();
-      maskFilter->SetInput1(input);
-      maskFilter->SetInput2(thresholdFilter->GetOutput());
-      maskFilter->SetOutsideValue(mArgsInfo.fg_arg);
-      maskFilter->Update();
-      outputImage = maskFilter->GetOutput();
-    }
-    // Write/Save results
-    this->template SetNextOutput<InputImageType>(outputImage);
-  }
+  // Set filter members
+
+  // Write/Save results
+  typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
+  this->template SetNextOutput<OutputImageType>(outputImage);
 }
 //--------------------------------------------------------------------
 
diff --git a/tools/clitkSum.cxx b/tools/clitkSum.cxx
new file mode 100644 (file)
index 0000000..6a4e185
--- /dev/null
@@ -0,0 +1,45 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.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
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// clitk
+#include "clitkSum_ggo.h"
+#include "clitkSumGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkSum, args_info);
+  CLITK_INIT;
+
+  // Filter
+  typedef clitk::SumGenericFilter<args_info_clitkSum> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  filter->SetArgsInfo(args_info);
+  try {
+    filter->Update();
+  } catch(std::runtime_error e) {
+    std::cout << e.what() << std::endl;
+  }
+
+  return EXIT_SUCCESS;
+}// end main
+
+//--------------------------------------------------------------------
diff --git a/tools/clitkSum.ggo b/tools/clitkSum.ggo
new file mode 100644 (file)
index 0000000..e9938f2
--- /dev/null
@@ -0,0 +1,13 @@
+#File clitkSum.ggo
+package "clitkSum"
+version "1.0"
+purpose ""
+
+option "config"                -       "Config file"                     string        optional
+option "verbose"       v       "Verbose"                         flag          off
+
+option "imagetypes"    -       "Display allowed image types"     flag          off
+
+option "input"         i       "Input image filename"            string        required
+option "output"        o       "Output image filename"           string        required
+option "dimension"     d       "Dimension along which to sum"    int           yes
diff --git a/tools/clitkSumGenericFilter.h b/tools/clitkSumGenericFilter.h
new file mode 100644 (file)
index 0000000..acebb90
--- /dev/null
@@ -0,0 +1,69 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.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
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef clitkSumGenericFilter_h
+#define clitkSumGenericFilter_h
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+template<class args_info_type>
+class ITK_EXPORT SumGenericFilter:
+        public ImageToImageGenericFilter<SumGenericFilter<args_info_type> >
+{
+
+public:
+
+    //--------------------------------------------------------------------
+    SumGenericFilter();
+
+    //--------------------------------------------------------------------
+    typedef SumGenericFilter                   Self;
+    typedef itk::SmartPointer<Self>            Pointer;
+    typedef itk::SmartPointer<const Self>      ConstPointer;
+
+    //--------------------------------------------------------------------
+    // Method for creation through the object factory
+    // and Run-time type information (and related methods)
+    itkNewMacro(Self);
+    itkTypeMacro(SumGenericFilter, LightObject);
+
+    //--------------------------------------------------------------------
+    void SetArgsInfo(const args_info_type & a);
+
+    //--------------------------------------------------------------------
+    // Main function called each time the filter is updated
+    template<class InputImageType>
+    void UpdateWithInputImageType();
+
+protected:
+    template<unsigned int Dim> void InitializeImageType();
+    args_info_type mArgsInfo;
+
+}; // end class
+//--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkSumGenericFilter.txx"
+#endif
+
+#endif // #define clitkSumGenericFilter_h
diff --git a/tools/clitkSumGenericFilter.txx b/tools/clitkSumGenericFilter.txx
new file mode 100644 (file)
index 0000000..f7fb5f0
--- /dev/null
@@ -0,0 +1,97 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.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
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef clitkSumGenericFilter_txx
+#define clitkSumGenericFilter_txx
+
+// itk include
+#include <itkSumProjectionImageFilter.h>
+#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+SumGenericFilter<args_info_type>::SumGenericFilter():
+  ImageToImageGenericFilter<Self>("Sum")
+{
+  InitializeImageType<3>();
+  InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void SumGenericFilter<args_info_type>::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void SumGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+  mArgsInfo=a;
+  this->SetIOVerbose(mArgsInfo.verbose_flag);
+  if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
+
+  if (mArgsInfo.input_given) {
+    this->SetInputFilename(mArgsInfo.input_arg);
+  }
+  if (mArgsInfo.output_given) {
+    this->SetOutputFilename(mArgsInfo.output_arg);
+  }
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class InputImageType>
+void
+SumGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+
+  // Reading input
+  typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+  // Main filter
+  typedef typename InputImageType::PixelType PixelType;
+  const int Dim = InputImageType::ImageDimension;
+  typedef itk::Image<PixelType,Dim> ImageType;
+  typedef itk::Image<PixelType,Dim-1> OutputImageType;
+
+  // Filter
+  typedef itk::SumProjectionImageFilter<ImageType,OutputImageType> FilterType;
+  typename FilterType::Pointer filter = FilterType::New();
+  filter->SetProjectionDimension(mArgsInfo.dimension_arg);
+  filter->SetInput(input);
+  filter->Update();
+  this->template SetNextOutput<OutputImageType>(filter->GetOutput());
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkSumGenericFilter_txx
index 11c3b1f805cb1824426604dba1d941fc0900e771..5b849910908a215da9e0057fd69f645f3138e21a 100644 (file)
@@ -22,6 +22,7 @@ set(vv_TOOLS
   vvToolROIManager
   vvToolSegmentation
   ## these ones are for tests (not working)
+  # vvToolTest
   # vvToolFoo
   # vvToolFooWithWidgetBase
   # vvToolPlastimatch
diff --git a/vv/qt_ui/vvToolTest.ui b/vv/qt_ui/vvToolTest.ui
new file mode 100644 (file)
index 0000000..01279b5
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolTest</class>
+ <widget class="QWidget" name="vvToolTest">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>433</width>
+    <height>222</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Test sphere</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="Line" name="line_3">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 5dbf51abc300d251e94d48b880467229ed235f2a..0ab7cb806d5c7aa7100ea1e620b73169f3763c2a 100644 (file)
@@ -74,7 +74,7 @@ void vvAnimatedGIFWriter::End()
 #if VTK_MAJOR_VERSION <= 5
   quant->SetInput(RGBvolume->GetOutput());
 #else
-  quant->SetInputData(RGBvolume->GetOutput());
+  quant->SetInputConnection(RGBvolume->GetOutputPort());
 #endif
   quant->Update();
 
@@ -83,7 +83,7 @@ void vvAnimatedGIFWriter::End()
 #if VTK_MAJOR_VERSION <= 5
   cast->SetInput( quant->GetOutput() );
 #else
-  cast->SetInputData( quant->GetOutput() );
+  cast->SetInputConnection( quant->GetOutputPort() );
 #endif
   cast->SetOutputScalarTypeToUnsignedChar();
   cast->Update();
index dc953201cfba5755ed51378705455aed66cde0d7..1af316dedf168b7c28c256b73c84c4a157526c53 100644 (file)
 #include <vtkProperty.h>
 #include <vtkImageMapToRGBA.h>
 #include <vtkLookupTable.h>
+#include <vtkImageMapper3D.h>
 
 //------------------------------------------------------------------------------
 vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
-{
+{ //out << __func__ << endl;
   mTSlice = -1;
   mSlice = 0;
   mColor.resize(3);
@@ -52,7 +53,7 @@ vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
 
 //------------------------------------------------------------------------------
 vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
-{
+{ //out << __func__ << endl;
   mImageActorList.clear();
 }
 //------------------------------------------------------------------------------
@@ -60,7 +61,7 @@ vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::RemoveActors()
-{
+{ //out << __func__ << endl;
   for (unsigned int i = 0; i < mImageActorList.size(); i++) {
     if (mSlicer != 0) {
       if (mSlicer != NULL) {
@@ -78,7 +79,7 @@ void vvBinaryImageOverlayActor::RemoveActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
-{
+{ //out << __func__ << endl;
   mColor[0] = r;
   mColor[1] = g;
   mColor[2] = b;
@@ -88,7 +89,7 @@ void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
-{
+{ //out << __func__ << endl;
   mSlicer = slicer;
 }
 //------------------------------------------------------------------------------
@@ -96,7 +97,7 @@ void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
-{
+{ //out << __func__ << endl;
   if (!mSlicer) {
     std::cerr << "ERROR. Please use setSlicer before setSlicer in vvBinaryImageOverlayActor." << std::endl;
     exit(0);
@@ -143,7 +144,7 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
 #if VTK_MAJOR_VERSION <= 5
     mOverlayActor->SetInput(mOverlayMapper->GetOutput());
 #else
-    mOverlayActor->SetInputData(mOverlayMapper->GetOutput());
+    mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
 #endif
     mOverlayActor->SetPickable(0);
     mOverlayActor->SetVisibility(IsVisible);
@@ -163,7 +164,7 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetOpacity(double d)
-{
+{ //out << __func__ << endl;
   mAlpha = d;
 }
 //------------------------------------------------------------------------------
@@ -205,7 +206,7 @@ void vvBinaryImageOverlayActor::SetOpacity(double d)
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool modeBG)
-{
+{ //out << __func__ << endl;
   mImage = image;
   if (modeBG) {
     mBackgroundValue = bg;
@@ -221,7 +222,7 @@ void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::HideActors()
-{
+{ //out << __func__ << endl;
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   for(unsigned int i=0; i<mImageActorList.size(); i++) {
@@ -235,7 +236,7 @@ void vvBinaryImageOverlayActor::HideActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::ShowActors()
-{
+{ //out << __func__ << endl;
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   mTSlice = mSlicer->GetTSlice();
@@ -251,7 +252,7 @@ void vvBinaryImageOverlayActor::ShowActors()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::UpdateColor()
-{
+{ //out << __func__ << endl;
   mColorLUT->SetTableValue(1, mColor[0], mColor[1], mColor[2], mAlpha); // FG
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
     // how many intensity ?
@@ -270,7 +271,7 @@ void vvBinaryImageOverlayActor::UpdateColor()
 
 //------------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
-{
+{ //out << __func__ << endl;
   if (!mSlicer) return;
 
   if (!force) {
@@ -310,7 +311,7 @@ void vvBinaryImageOverlayActor::ComputeExtent(int orientation,
                                              int slice,
                                              int * inExtent,
                                              int * outExtent)
-{
+{ //out << __func__ << endl;
   switch (orientation) {
   case vtkImageViewer2::SLICE_ORIENTATION_XY:
     for(int i=0; i<4; i++) outExtent[i] = inExtent[i];
@@ -332,7 +333,7 @@ void vvBinaryImageOverlayActor::ComputeExtent(int orientation,
 
 //----------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::ComputeExtent(int * inExtent, int * outExtent, vtkImageData * image, vtkImageData * overlay)
-{
+{ //out << __func__ << endl;
   for(int i=0; i<3; i++) {
     double a = (image->GetOrigin()[i] + inExtent[i*2]*image->GetSpacing()[i] - 
                 overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
@@ -360,7 +361,7 @@ void vvBinaryImageOverlayActor::SetDisplayExtentAndCameraPosition(int orientatio
                                                                  int * extent,
                                                                  vtkImageActor * actor,
                                                                  double position)
-{
+{ //out << __func__ << endl;
   /* FIXME
      Error according to camera orientation
    */
index 8fb22ae4d000428bd0fb50317b2843fa22372c80..e391bbba61a1e6ba85da0d5186270da65e022b9e 100644 (file)
 #include <vtkImageData.h>
 #include <vtkPolyDataMapper.h>
 #include <vtkProperty.h>
+#include <vtkInformation.h>
 
 //------------------------------------------------------------------------------
 vvImageContour::vvImageContour()
-{
+{ //out << __func__ << endl;
   mTSlice = -1;
   mSlice = 0;
   mHiddenImageIsUsed = false;
@@ -45,7 +46,7 @@ vvImageContour::vvImageContour()
 
 //------------------------------------------------------------------------------
 vvImageContour::~vvImageContour()
-{
+{ //out << __func__ << endl;
   mSquaresActorList.clear();
 }
 //------------------------------------------------------------------------------
@@ -53,7 +54,7 @@ vvImageContour::~vvImageContour()
 
 //------------------------------------------------------------------------------
 void vvImageContour::RemoveActors()
-{
+{ //out << __func__ << endl;
   for (unsigned int i = 0; i < mSquaresActorList.size(); i++) {
     if (mSlicer != 0) {
       if (mSlicer!= NULL) {
@@ -70,7 +71,8 @@ void vvImageContour::RemoveActors()
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetSlicer(vvSlicer * slicer) {
+void vvImageContour::SetSlicer(vvSlicer * slicer) 
+{ //out << __func__ << endl;
   mSlicer = slicer;  
   // Create an actor for each time slice
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
@@ -81,7 +83,8 @@ void vvImageContour::SetSlicer(vvSlicer * slicer) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetImage(vvImage::Pointer image) {
+void vvImageContour::SetImage(vvImage::Pointer image) 
+{ //out << __func__ << endl;
   for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
 #if VTK_MAJOR_VERSION <= 5
     mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
@@ -96,7 +99,8 @@ void vvImageContour::SetImage(vvImage::Pointer image) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
+void vvImageContour::SetPreserveMemoryModeEnabled(bool b) 
+{ //out << __func__ << endl;
   // FastCache mode work only if threshold is always the same
   if (mDisplayModeIsPreserveMemory == b) return;
   mDisplayModeIsPreserveMemory = b;
@@ -116,9 +120,11 @@ void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::SetColor(double r, double g, double b) {
+void vvImageContour::SetColor(double r, double g, double b) 
+{ //out << __func__ << endl;
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
     mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
+    mSquaresActorList[i]->GetProperty()->SetOpacity(0.995);
   }
 }
 //------------------------------------------------------------------------------
@@ -126,7 +132,7 @@ void vvImageContour::SetColor(double r, double g, double b) {
 
 //------------------------------------------------------------------------------
 void vvImageContour::SetLineWidth(double w)
-{
+{ //out << __func__ << endl;
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
     mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
   }
@@ -135,7 +141,8 @@ void vvImageContour::SetLineWidth(double w)
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::HideActors() {
+void vvImageContour::HideActors() 
+{ //out << __func__ << endl;
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
@@ -146,7 +153,8 @@ void vvImageContour::HideActors() {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::ShowActors() {
+void vvImageContour::ShowActors() 
+{ //out << __func__ << endl;
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   mTSlice = mSlicer->GetTSlice();
@@ -158,7 +166,7 @@ void vvImageContour::ShowActors() {
 
 //------------------------------------------------------------------------------
 void vvImageContour::SetDepth(double d) 
-{ 
+{ //out << __func__ << endl;
   mDepth = d;
   // Move the actor to be visible
   double position[3] = {0, 0, 0};
@@ -171,7 +179,8 @@ void vvImageContour::SetDepth(double d)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvImageContour::Update(double value) {
+void vvImageContour::Update(double value) 
+{ //out << __func__ << endl;
   if (!mSlicer) return;
   if (mPreviousValue == value) {
     if (mPreviousSlice == mSlicer->GetSlice()) {
@@ -207,7 +216,8 @@ void vvImageContour::Update(double value) {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::UpdateWithPreserveMemoryMode() {
+void vvImageContour::UpdateWithPreserveMemoryMode() 
+{ //out << __func__ << endl;
   // Only change actor visibility if tslice change
   mPreviousTslice = mTSlice;
   mTSlice = mSlicer->GetTSlice();
@@ -223,14 +233,15 @@ void vvImageContour::UpdateWithPreserveMemoryMode() {
   if (mPreviousTslice != mTSlice) {
     if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff();
   }
-  
+
   mSlicer->Render();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::InitializeCacheMode() {
+void vvImageContour::InitializeCacheMode() 
+{ //out << __func__ << endl;
 clitkExceptionMacro("TODO : not implemented yet");
   mPreviousSlice = mPreviousOrientation = 0;
   int dim = mSlicer->GetImage()->GetNumberOfDimensions();
@@ -248,7 +259,8 @@ clitkExceptionMacro("TODO : not implemented yet");
 
 
 //------------------------------------------------------------------------------
-int vvImageContour::ComputeCurrentOrientation() {
+int vvImageContour::ComputeCurrentOrientation() 
+{ //out << __func__ << endl;
   // Get extent of image in the slicer
   int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
 
@@ -266,7 +278,8 @@ int vvImageContour::ComputeCurrentOrientation() {
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::UpdateWithFastCacheMode() {
+void vvImageContour::UpdateWithFastCacheMode() 
+{ //out << __func__ << endl;
 clitkExceptionMacro("TODO : not implemented yet");
 
   // Compute orientation
@@ -294,7 +307,8 @@ clitkExceptionMacro("TODO : not implemented yet");
 
 
 //------------------------------------------------------------------------------
-void vvImageContour::CreateNewActor(int numImage) {
+void vvImageContour::CreateNewActor(int numImage) 
+{ //out << __func__ << endl;
   vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
   vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
   vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
@@ -313,17 +327,17 @@ void vvImageContour::CreateNewActor(int numImage) {
     clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
 #endif
   }
-
 #if VTK_MAJOR_VERSION <= 5
   squares->SetInput(clipper->GetOutput());
   squaresMapper->SetInput(squares->GetOutput());
 #else
-  squares->SetInputData(clipper->GetOutput());
-  squaresMapper->SetInputData(squares->GetOutput());
+  squares->SetInputConnection(clipper->GetOutputPort(0));
+  squaresMapper->SetInputConnection(squares->GetOutputPort(0));
 #endif
   squaresMapper->ScalarVisibilityOff();
   squaresActor->SetMapper(squaresMapper);
   squaresActor->GetProperty()->SetColor(1.0,0,0);
+  squaresActor->GetProperty()->SetOpacity(0.995);
   squaresActor->SetPickable(0);
   squaresActor->VisibilityOff();
   mSlicer->GetRenderer()->AddActor(squaresActor);
@@ -341,10 +355,11 @@ void vvImageContour::UpdateActor(vtkActor * actor,
                                  vtkPolyDataMapper * mapper, 
                                  vtkMarchingSquares * squares, 
                                  vtkImageClip * clipper, 
-                                 double threshold, int orientation, int slice) {
+                                 double threshold, int orientation, int slice) 
+{ //out << __func__ << endl;
   // Set parameter for the MarchigSquare
   squares->SetValue(0, threshold);
-
+  squares->Update();
   // Get image extent
   int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
 
@@ -381,10 +396,10 @@ void vvImageContour::UpdateActor(vtkActor * actor,
     extent2 = extent;
     actor->VisibilityOn();
   }
+  
   clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
                                 extent2[3],extent2[4],extent2[5]);
-
+                                
   if (mHiddenImageIsUsed) delete extent2;
 
   // Move the actor to be visible
@@ -393,7 +408,6 @@ void vvImageContour::UpdateActor(vtkActor * actor,
   // DD(mDepth);
   // position[orientation] = -mDepth;
   // actor->SetPosition(position);
-  
   mapper->Update();
 }
 //------------------------------------------------------------------------------
index 99d8628b3e9f296cc7bcdba89c38c23bcbcef621..1c6d84a40976406d3e06312e37377cd8ff42deb2 100644 (file)
@@ -30,7 +30,7 @@
 
 //====================================================================
 vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
-{
+{ //out << __func__ << endl;
   setupUi(this);
 
   tableWidget->verticalHeader()->hide();
@@ -48,7 +48,7 @@ vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
 }
 
 void vvLandmarksPanel::Load()
-{
+{ //out << __func__ << endl;
   QString file = QFileDialog::getOpenFileName(this,tr("Load Landmarks"),
                  mCurrentPath.c_str(),tr("Landmarks ( *.txt *.pts)"));
   if (!file.isEmpty()) {
@@ -58,17 +58,17 @@ void vvLandmarksPanel::Load()
 }
 
 bool vvLandmarksPanel::LoadFromFile(std::vector<std::string> files)
-{
+{ //out << __func__ << endl;
   if (!mCurrentLandmarks->LoadFile(files))
     return false;
   
-  SetCurrentLandmarks(mCurrentLandmarks,2);
+  SetCurrentLandmarks(mCurrentLandmarks,0);
   emit UpdateRenderWindows();
   return true;
 }
 
 void vvLandmarksPanel::Save()
-{
+{ //out << __func__ << endl;
   QString file = QFileDialog::getSaveFileName(this,
                  tr("Save Landmarks"),
                  mCurrentPath.c_str(),tr("Landmarks ( *.txt)"));
@@ -81,7 +81,7 @@ void vvLandmarksPanel::Save()
 }
 
 void vvLandmarksPanel::SelectPoint()
-{
+{ //out << __func__ << endl;
   if (tableWidget->rowCount() > 0) {
     QList<QTableWidgetItem *> items = tableWidget->selectedItems();
     if (!items.empty()) {
@@ -100,7 +100,7 @@ void vvLandmarksPanel::SelectPoint()
 
 
 void vvLandmarksPanel::RemoveSelectedPoints()
-{
+{ //out << __func__ << endl;
   if (tableWidget->rowCount() > 0) {
     QList<QTableWidgetItem *> items = tableWidget->selectedItems();
     if (items.empty()) {
@@ -124,7 +124,7 @@ void vvLandmarksPanel::RemoveSelectedPoints()
 }
 
 void vvLandmarksPanel::RemoveAllPoints()
-{
+{ //out << __func__ << endl;
   mCurrentLandmarks->RemoveAll();
   tableWidget->clearContents();
   tableWidget->setRowCount(0);
@@ -132,12 +132,12 @@ void vvLandmarksPanel::RemoveAllPoints()
 }
 
 void vvLandmarksPanel::AddPoint()
-{
+{ //out << __func__ << endl;
   AddPoint(mCurrentLandmarks->GetNumberOfPoints()-1);
 }
 
 void vvLandmarksPanel::AddPoint(int landmarksIndex)
-{
+{ //out << __func__ << endl;
   int rowIndex = tableWidget->rowCount();
 //   DD(rowIndex);
   tableWidget->setRowCount(rowIndex+1);
@@ -176,10 +176,9 @@ void vvLandmarksPanel::AddPoint(int landmarksIndex)
 }
 
 void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
-{
+{ //out << __func__ << endl;
   if (time != lm->GetTime())
     return;
-  
   loadButton->setEnabled(1);
   saveButton->setEnabled(1);
   removeButton->setEnabled(1);
@@ -197,14 +196,14 @@ void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
 }
 
 void vvLandmarksPanel::SetCurrentImage(std::string filename)
-{
+{ //out << __func__ << endl;
   QString image = "<b>CurrentImage : </b>";
   image += vtksys::SystemTools::GetFilenameWithoutLastExtension(filename).c_str();
   nameLabel->setText(image);
 }
 
 void vvLandmarksPanel::CommentsChanged(int row, int column)
-{
+{ //out << __func__ << endl;
   if (column == 6) {
     mCurrentLandmarks->ChangeComments(row,std::string(tableWidget->item(row,column)->text().toStdString()));
     tableWidget->resizeColumnsToContents();
index 590f3dd6fb577e5007cabb9be3297a2ccccbedac..9ee7f8c2eb26e9d5133ade0a36704610fc47adb3 100644 (file)
@@ -3271,7 +3271,7 @@ void vvMainWindow::SaveScreenshotAllSlices()
 #if VTK_MAJOR_VERSION <= 5
     writer->SetInput(windowToImageFilter->GetOutput());
 #else
-    writer->SetInputData(windowToImageFilter->GetOutput());
+    writer->SetInputConnection(windowToImageFilter->GetOutputPort());
 #endif
     writer->Write();
   }
@@ -3329,7 +3329,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 #if VTK_MAJOR_VERSION <= 5
       imgwriter->SetInput(image);
 #else
-      imgwriter->SetInputData(image);
+      imgwriter->SetInputConnection(w2i->GetOutputPort());
 #endif
       imgwriter->SetFileName(fileName.toStdString().c_str());
       imgwriter->Write();
@@ -3403,7 +3403,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 #if VTK_MAJOR_VERSION <= 5
       vidwriter->SetInput(image);
 #else
-      vidwriter->SetInputData(image);
+      vidwriter->SetInputConnection(w2i->GetOutputPort());
 #endif
       vidwriter->SetFileName(fileName.toStdString().c_str());
       vidwriter->Start();
@@ -3416,7 +3416,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget)
 #if VTK_MAJOR_VERSION <= 5
         vidwriter->SetInput(w2i->GetOutput());
 #else
-        vidwriter->SetInputData(w2i->GetOutput());
+        vidwriter->SetInputConnection(w2i->GetOutputPort());
 #endif
         vidwriter->Write();
       }
@@ -3514,6 +3514,7 @@ void vvMainWindow::ShowLastImage()
     QTreeWidgetItem * item=DataTree->topLevelItem(DataTree->topLevelItemCount()-1);
     CurrentImageChanged(mSlicerManagers.back()->GetId()); //select new image
     item->setData(1,Qt::CheckStateRole,2); //show the new image in the first panel
+    //mSlicerManagers[GetSlicerIndexFromItem(item)]->GetSlicer(0)->SetActorVisibility("image", 0, 1); //Set the Last Image visibles
     DisplayChanged(item,1);
   }
 }
@@ -3653,13 +3654,13 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
   connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
 
 
+
+  InitSlicers();
   UpdateTree();
   qApp->processEvents();
-  InitSlicers();
-  ShowLastImage();
   InitDisplay();
+  ShowLastImage();
   qApp->processEvents();
-
   // End
   ImageInfoChanged();
   return slicer_manager;
index fd4faa84018f067ceffc71f137c1fd084f9aa649..e7045f58d84a19889f0f8abd97a4698587b237bb 100644 (file)
@@ -191,7 +191,7 @@ void vvMesh::ComputeMasks(vtkImageData* sample,bool extrude)
 #if VTK_MAJOR_VERSION <= 5
       sts->SetInput(extrude->GetOutput());
 #else
-      sts->SetInputData(extrude->GetOutput());
+      sts->SetInputConnection(extrude->GetOutputPort());
 #endif
     } else {
 #if VTK_MAJOR_VERSION <= 5
index 04ea49d70e7648404654a231b750cea03eba29fd..d8741aa5448cbc1e5cff6b5b4962267d3df0ba6d 100644 (file)
@@ -66,7 +66,7 @@ void vvMeshActor::Init(vvMesh::Pointer mesh,int time_slice,vvImage::Pointer vf)
 #if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mMarching->GetOutput());
 #else
-  mMapper->SetInputData(mMarching->GetOutput());
+  mMapper->SetInputConnection(mMarching->GetOutputPort());
 #endif
   //The following line allows to display the contour over the image
   //(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html)
index 74d588328865cdfa27ca192a0d44daf5cdcb7a3d..26f13f479df91a6a09fc478019b84d8a409fc71e 100644 (file)
@@ -32,7 +32,7 @@
 
 //------------------------------------------------------------------------------
 vvROIActor::vvROIActor()
-{
+{ //out << __func__ << endl;
   mIsVisible = true;
   mIsContourVisible = false;
   mOpacity = 0.5;
@@ -52,14 +52,14 @@ vvROIActor::vvROIActor()
 
 //------------------------------------------------------------------------------
 vvROIActor::~vvROIActor()
-{
+{ //out << __func__ << endl;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvROIActor::RemoveActors()
-{
+{ //out << __func__ << endl;
   for(unsigned int i= 0; i<mOverlayActors.size(); i++) {
     mOverlayActors[i]->RemoveActors();
   }
@@ -77,21 +77,23 @@ void vvROIActor::RemoveActors()
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetROI(clitk::DicomRT_ROI * s)
-{
+{ //out << __func__ << endl;
   mROI = s;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourWidth(int n) {
+void vvROIActor::SetContourWidth(int n) 
+{ //out << __func__ << endl;
   mContourWidth = n;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
+void vvROIActor::SetSlicerManager(vvSlicerManager * s) 
+{ //out << __func__ << endl;
   mSlicerManager = s;
 }
 //------------------------------------------------------------------------------
@@ -99,7 +101,7 @@ void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
 
 //------------------------------------------------------------------------------
 void vvROIActor::UpdateImage()
-{
+{ //out << __func__ << endl;
   mOverlayActors.clear();
   mImageContour.clear();
   Initialize(mDepth, mIsVisible);
@@ -110,7 +112,7 @@ void vvROIActor::UpdateImage()
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetVisible(bool b)
-{
+{ //out << __func__ << endl;
   mIsVisible = b;
   if (!b) { // remove actor
     for(unsigned int i= 0; i<mOverlayActors.size(); i++)
@@ -125,7 +127,8 @@ void vvROIActor::SetVisible(bool b)
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourVisible(bool b) {
+void vvROIActor::SetContourVisible(bool b) 
+{ //out << __func__ << endl;
   mIsContourVisible = b;
   if (!b) { // remove actor
     for(unsigned int i= 0; i<mImageContour.size(); i++) {
@@ -143,21 +146,24 @@ void vvROIActor::SetContourVisible(bool b) {
 
 
 //------------------------------------------------------------------------------
-bool vvROIActor::IsVisible() {
+bool vvROIActor::IsVisible() 
+{ //out << __func__ << endl;
   return mIsVisible;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-bool vvROIActor::IsContourVisible() {
+bool vvROIActor::IsContourVisible() 
+{ //out << __func__ << endl;
   return mIsContourVisible;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::Initialize(double depth, bool IsVisible) {
+void vvROIActor::Initialize(double depth, bool IsVisible) 
+{ //out << __func__ << endl;
   if (mROI->GetImage()) {
     mImageContour.clear();
     mOverlayActors.clear();
@@ -174,7 +180,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
       mImageContour[i]->SetLineWidth(mContourWidth);
       mImageContour[i]->SetPreserveMemoryModeEnabled(true);
       mImageContour[i]->SetDepth(mDepth+0.5);
-      mImageContour[i]->HideActors();
+      mImageContour[i]->ShowActors();
       
       mOverlayActors.push_back(vvBinaryImageOverlayActor::New());
 
@@ -195,7 +201,6 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
       mOverlayActors[i]->Initialize(IsVisible);      
       mOverlayActors[i]->SetDepth(mDepth);
     }
-
     connect(mSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
     //connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
     connect(mSlicerManager, SIGNAL(AVerticalSliderHasChanged(int, int)), SLOT(UpdateSlice(int, int)));
@@ -206,7 +211,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) {
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetDepth(double d)
-{
+{ //out << __func__ << endl;
   mDepth = d;
   if (!mSlicerManager) return;
   for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {  
@@ -220,7 +225,7 @@ void vvROIActor::SetDepth(double d)
 
 //------------------------------------------------------------------------------
 void vvROIActor::Update(bool force)
-{
+{ //out << __func__ << endl;
   if (!mSlicerManager) return;
   for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
     UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force);
@@ -231,7 +236,7 @@ void vvROIActor::Update(bool force)
 
 //------------------------------------------------------------------------------
 void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
-{
+{ //out << __func__ << endl;
   if (!mROI->GetImage())  return;
   if ((!mIsVisible) && (!mIsContourVisible)) return; 
   if (!mSlicerManager) {
@@ -251,14 +256,15 @@ void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetOpacity(double d)
-{
+{ //out << __func__ << endl;
   mOpacity = d;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetContourColor(double r, double v, double b) {
+void vvROIActor::SetContourColor(double r, double v, double b) 
+{ //out << __func__ << endl;
   mContourColor[0] = r;
   mContourColor[1] = v;
   mContourColor[2] = b;  
@@ -267,7 +273,8 @@ void vvROIActor::SetContourColor(double r, double v, double b) {
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::SetOverlayColor(double r, double v, double b) {
+void vvROIActor::SetOverlayColor(double r, double v, double b) 
+{ //out << __func__ << endl;
   if (mROI)
     mROI->SetDisplayColor(r,v,b);
 }
@@ -275,21 +282,24 @@ void vvROIActor::SetOverlayColor(double r, double v, double b) {
 
 
 //------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetContourColor() { 
+std::vector<double> & vvROIActor::GetContourColor() 
+{ //out << __func__ << endl;
   return mContourColor; 
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetOverlayColor() { 
+std::vector<double> & vvROIActor::GetOverlayColor() 
+{ //out << __func__ << endl;
   return mROI->GetDisplayColor();
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::UpdateColor() {
+void vvROIActor::UpdateColor() 
+{ //out << __func__ << endl;
   for(unsigned int i=0; i<mOverlayActors.size(); i++) {
     mOverlayActors[i]->SetOpacity(mOpacity);
     mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0],
@@ -309,7 +319,7 @@ void vvROIActor::UpdateColor() {
 
 //------------------------------------------------------------------------------
 double vvROIActor::GetOpacity()
-{
+{ //out << __func__ << endl;
   return mOpacity;
 }
 //------------------------------------------------------------------------------
@@ -317,7 +327,7 @@ double vvROIActor::GetOpacity()
 
 //------------------------------------------------------------------------------
 void vvROIActor::SetSelected(bool b)
-{
+{ //out << __func__ << endl;
   mIsSelected = b;
   if (b) {
     for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
@@ -335,7 +345,7 @@ void vvROIActor::SetSelected(bool b)
 
 //------------------------------------------------------------------------------
 void vvROIActor::CopyParameters(QSharedPointer<vvROIActor> roi)
-{
+{ //out << __func__ << endl;
   // Overlay
   SetVisible(roi->IsVisible());
   SetOpacity(roi->GetOpacity());
index 0a54a6a7db2c55fdf1e8236d76920c7b93ae726f..c35e8cc4bcd39d974e4018df2fd4ba9317785194 100644 (file)
@@ -128,7 +128,7 @@ vvSlicer::vvSlicer()
 #if VTK_MAJOR_VERSION <= 5
   pdm->SetInput(crossCursor->GetOutput());
 #else
-  pdm->SetInputData(crossCursor->GetOutput());
+  pdm->SetInputConnection(crossCursor->GetOutputPort(0));
 #endif
 
   pdmA = vtkSmartPointer<vtkActor2D>::New();
@@ -422,7 +422,6 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay)
 #else
     mOverlayReslice->SetInputData(0, mOverlay->GetFirstVTKImageData());
 #endif
-    mImageReslice->UpdateInformation();
     mOverlayReslice->Update();
 
     if (!mOverlayMapper)
@@ -430,7 +429,7 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay)
 #if VTK_MAJOR_VERSION <= 5
     mOverlayMapper->SetInput(mOverlayReslice->GetOutput());
 #else
-    mOverlayMapper->SetInputData(mOverlayReslice->GetOutput());
+    mOverlayMapper->SetInputConnection(mOverlayReslice->GetOutputPort(0));
 #endif
 
     if (!mOverlayActor) {
@@ -503,7 +502,7 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
 #if VTK_MAJOR_VERSION <= 5
     mFusionMapper->SetInput(mFusionReslice->GetOutput());
 #else
-    mFusionMapper->SetInputData(mFusionReslice->GetOutput());
+    mFusionMapper->SetInputConnection(mFusionReslice->GetOutputPort(0));
 #endif
     
     if (!mFusionActor) {
@@ -584,7 +583,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
     mAAFilter->SetInput(mVOIFilter->GetOutput());
 #else
     mVOIFilter->SetInputData(vf->GetFirstVTKImageData());
-    mAAFilter->SetInputData(mVOIFilter->GetOutput());
+    mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort());
 #endif
     ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
     mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
@@ -602,8 +601,8 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
     mGlyphFilter->SetInput(mAAFilter->GetOutput());
     mGlyphFilter->SetSource(mArrow->GetOutput());
 #else
-    mGlyphFilter->SetInputData(mAAFilter->GetOutput());
-    mGlyphFilter->SetSourceData(mArrow->GetOutput());
+    mGlyphFilter->SetInputConnection(mAAFilter->GetOutputPort());
+    mGlyphFilter->SetSourceConnection(mArrow->GetOutputPort());
 #endif
     mGlyphFilter->ScalingOn();
     mGlyphFilter->SetScaleModeToScaleByVector();
@@ -625,7 +624,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf)
 #if VTK_MAJOR_VERSION <= 5
     mVFMapper->SetInput(mGlyphFilter->GetOutput());
 #else
-    mVFMapper->SetInputData(mGlyphFilter->GetOutput());
+    mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
 #endif
     mVFMapper->ImmediateModeRenderingOn();
     mVFMapper->SetLookupTable(mVFColorLUT);
@@ -679,8 +678,8 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
 #else
     mLandClipper->SetInputData(mLandmarks->GetOutput());
 
-    mLandGlyph->SetSourceData(mCross->GetOutput());
-    mLandGlyph->SetInputData(mLandClipper->GetOutput());
+    mLandGlyph->SetSourceConnection(mCross->GetOutputPort());
+    mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort());
 #endif
     //mLandGlyph->SetIndexModeToScalar();
     //mLandGlyph->SetRange(0,1);
@@ -695,6 +694,7 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
     //mLandMapper->ScalarVisibilityOff();
 
     mLandActor->SetMapper(mLandMapper);
+    mLandActor->GetProperty()->SetOpacity(0.995);
     mLandActor->GetProperty()->SetColor(255,10,212);
     mLandActor->SetPickable(0);
     mLandActor->SetVisibility(true);
@@ -840,7 +840,6 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
 #else
       mOverlayReslice->SetInputData( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
 #endif
-
       // Update overlay transform
       mConcatenatedOverlayTransform->Identity();
       mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[mCurrentOverlayTSlice]);
@@ -1072,7 +1071,7 @@ int vvSlicer::GetOrientation()
 
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateDisplayExtent()
-{ cout << __func__ << endl;
+{ //out << __func__ << endl;
   vtkImageData *input = this->GetInput();
   
   if (!input || !this->ImageActor) {
@@ -1096,9 +1095,18 @@ void vvSlicer::UpdateDisplayExtent()
   
   // Image actor
   this->ImageActor->SetVisibility(mImageVisibility);
-#if VTK_MAJOR_VERSION <= 5
   this->ImageActor->SetDisplayExtent(w_ext);
-#else
+#if VTK_MAJOR_VERSION >= 6
+//mSlicingTransform->Print(cout);
+//GetImage()->GetTransform()[0]->Print(cout);
+//mSlicingTransform = GetImage()->GetTransform()[0];
+//mImageReslice->SetResliceTransform(mSlicingTransform);
+//mImageReslice->AutoCropOutputOff();
+//mImageReslice->Update();
+int* extentTest = mImageReslice->GetOutput()->GetExtent();
+cout<< extentTest[0] << " " << extentTest[1] << " " <<  extentTest[2] << " " <<  extentTest[3] << " " <<  extentTest[4] << " " <<  extentTest[5] << endl;
+//this->GetInput()->Print(cout);
+//GetImageActor()->GetMapper()->Print(cout);
   vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
   try {
     mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
@@ -1109,14 +1117,18 @@ void vvSlicer::UpdateDisplayExtent()
   }
   if (mFirstSetSliceOrientation) {
     copyExtent(ext, mRegisterExtent);
-    this->ImageActor->SetDisplayExtent(w_ext); //initialisation
   } else {
     int w_croppingRegion[6];
-    copyExtent(mRegisterExtent, w_croppingRegion);
-    this->ImageActor->SetDisplayExtent(w_ext);
+    if (mUseReducedExtent) {
+        copyExtent(extentTest, w_croppingRegion);
+    } else {
+        copyExtent(extentTest, w_croppingRegion);
+    }
+    cout << "w_ext : " << w_ext[0] << " " << w_ext[1] << " " << w_ext[2] << " " << w_ext[3] << " " << w_ext[4] << " " << w_ext[5] << endl;
     w_croppingRegion[ this->SliceOrientation*2   ] = this->Slice;
     w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice;
     mapperOpenGL->SetCroppingRegion(w_croppingRegion);
+    cout << "w_croppingRegion : " << w_croppingRegion[0] << " " << w_croppingRegion[1] << " " << w_croppingRegion[2] << " " << w_croppingRegion[3] << " " << w_croppingRegion[4] << " " << w_croppingRegion[5] << endl;
   }
 #endif
   
@@ -1134,7 +1146,7 @@ void vvSlicer::UpdateDisplayExtent()
 #if VTK_MAJOR_VERSION <= 5
     bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
 #else
-    bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+    bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
 #endif
     mOverlayActor->SetVisibility(!out);
     mOverlayActor->SetDisplayExtent( overExtent );
@@ -1154,7 +1166,7 @@ void vvSlicer::UpdateDisplayExtent()
 #if VTK_MAJOR_VERSION <= 5
     bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
 #else
-    bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+    bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
 #endif
     mFusionActor->SetVisibility(!out);
     mFusionActor->SetDisplayExtent( fusExtent );
@@ -1194,17 +1206,18 @@ void vvSlicer::UpdateDisplayExtent()
 #if VTK_MAJOR_VERSION <= 5
     bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
 #else
-    bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+    bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
 #endif
     mVFActor->SetVisibility(!out);
     mVOIFilter->SetVOI(vfExtent);
     int orientation[3] = {1,1,1};
     orientation[this->SliceOrientation] = 0;
     mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]);
-    mVFMapper->Update();
-
     position[this->SliceOrientation] += offset;
     mVFActor->SetPosition(position);
+    mVFActor->GetProperty()->SetOpacity(0.995);
+    mVFMapper->Update();
+
   }
   else if(mVF)
     mVFActor->SetVisibility(false);
@@ -1550,7 +1563,7 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImag
 #if VTK_MAJOR_VERSION <= 5
   accFilter->SetInput(voiFilter->GetOutput());
 #else
-  accFilter->SetInputData(voiFilter->GetOutput());
+  accFilter->SetInputConnection(voiFilter->GetOutputPort(0));
 #endif
   accFilter->Update();
 
@@ -1593,7 +1606,7 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, doubl
 
 //----------------------------------------------------------------------------
 void vvSlicer::Render()
-{ cout << __func__ << endl;
+{ //out << __func__ << endl;
   if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
     legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
     legend->UseOpacityOn();
@@ -1739,7 +1752,6 @@ void vvSlicer::Render()
 #else
     mOverlayMapper->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
 #endif
-       mOverlayActor->Print(cout);
     mOverlayMapper->Update();
   }
   if (mFusion && mFusionActor->GetVisibility()) {
@@ -1753,7 +1765,7 @@ void vvSlicer::Render()
   if (mLandMapper)
     UpdateLandmarks();
 
-  this->GetRenderWindow()->Render();
+    this->GetRenderWindow()->Render();
 }
 //----------------------------------------------------------------------------
 
index 48d14de3c80272cdcdfccd2a2fadf359a5ace108..1818e6c190c812e85f32a2db8d76e354eb63872b 100644 (file)
@@ -148,7 +148,6 @@ public:
   double* GetCursorPosition() {
     return mCursor;
   }
-
   vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
   vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
   vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
index d2bf5f2fc3f4437c376d877bad4ced81b868831f..cc99762fafc2466a2c789305953f0123392d173b 100644 (file)
@@ -1704,7 +1704,7 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
       y_index <= extentImageReslice[3]+0.5 &&\r
       z_index >= extentImageReslice[4]-0.5 &&\r
       z_index <= extentImageReslice[5]+0.5) {\r
-    double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);\r
+    double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mSlicers[0]->GetTSlice()], x_index, y_index, z_index);\r
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
     emit LandmarkAdded();\r
   }\r
index f50cb09ed34845c8d8172b82f227a06cd2917cbb..e8a6acb231dc06bc6f01cd790a60f85b0b201aa9 100644 (file)
@@ -114,7 +114,7 @@ void vvSurfaceViewerDialog::LoadSurface()
 #if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
 #else
-  mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
 #endif
 
   if (!mActor) {
@@ -147,7 +147,7 @@ void vvSurfaceViewerDialog::NextTime()
 #if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
 #else
-  mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
 #endif
   mMapper->Modified();
   renderWidget->GetRenderWindow()->Render();
@@ -161,7 +161,7 @@ void vvSurfaceViewerDialog::PreviousTime()
 #if VTK_MAJOR_VERSION <= 5
   mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
 #else
-  mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+  mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
 #endif
   mMapper->Modified();
   renderWidget->GetRenderWindow()->Render();
index 9859d01adcc101812cd644e4e15b966fbc657f9c..2e693d14c03e8c761e18c74c807bf5c5d1d8e232 100644 (file)
@@ -31,6 +31,7 @@
 #include <vtkImageClip.h>
 #include <vtkRenderWindow.h>
 
+
 //------------------------------------------------------------------------------
 // Create the tool and automagically (I like this word) insert it in
 // the main window menu.
@@ -40,7 +41,7 @@ ADD_TOOL(vvToolBinarize);
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::Initialize()
-{
+{ //out << __func__ << endl;
   SetToolName("Binarize");
   SetToolMenuName("Binarize");
   SetToolIconFilename(":/common/icons/binarize.png");
@@ -54,7 +55,7 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
   :vvToolWidgetBase(parent,f),
    vvToolBase<vvToolBinarize>(parent),
    Ui::vvToolBinarize()
-{
+{ //out << __func__ << endl;
   // GUI Initialization
   Ui_vvToolBinarize::setupUi(mToolWidget);
   mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
@@ -82,14 +83,14 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f)
 
 //------------------------------------------------------------------------------
 vvToolBinarize::~vvToolBinarize()
-{
+{ //out << __func__ << endl;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::InteractiveDisplayToggled(bool b)
-{
+{ //out << __func__ << endl;
   mInteractiveDisplayIsEnabled = b;
   if (!mInteractiveDisplayIsEnabled) {
     RemoveVTKObjects();
@@ -108,7 +109,7 @@ void vvToolBinarize::InteractiveDisplayToggled(bool b)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::RemoveVTKObjects()
-{
+{ //out << __func__ << endl;
   for(unsigned int i=0; i<mImageContour.size(); i++) {
     mImageContour[i]->HideActors();
     mImageContourLower[i]->HideActors();    
@@ -121,7 +122,7 @@ void vvToolBinarize::RemoveVTKObjects()
 
 //------------------------------------------------------------------------------
 bool vvToolBinarize::close()
-{
+{ //out << __func__ << endl;
   // RemoveVTKObjects();
   return vvToolWidgetBase::close();
 }
@@ -129,7 +130,8 @@ bool vvToolBinarize::close()
 
 
 //------------------------------------------------------------------------------
-void vvToolBinarize::closeEvent(QCloseEvent *event) {
+void vvToolBinarize::closeEvent(QCloseEvent *event)
+{ //out << __func__ << endl;
   RemoveVTKObjects();
   event->accept();
 }
@@ -138,7 +140,7 @@ void vvToolBinarize::closeEvent(QCloseEvent *event) {
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::reject()
-{
+{ //out << __func__ << endl;
   // DD("vvToolBinarize::reject");
   RemoveVTKObjects();
   return vvToolWidgetBase::reject();
@@ -148,7 +150,7 @@ void vvToolBinarize::reject()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::enableLowerThan(bool b)
-{
+{ //out << __func__ << endl;
   if (!b) {
     mThresholdSlider1->resetMaximum();
     for(unsigned int i=0; i<mImageContour.size(); i++) {
@@ -169,7 +171,7 @@ void vvToolBinarize::enableLowerThan(bool b)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::useFGBGtoggled(bool)
-{
+{ //out << __func__ << endl;
   if (!mCheckBoxUseBG->isChecked() && !mCheckBoxUseFG->isChecked())
     mCheckBoxUseBG->toggle();
 }
@@ -182,7 +184,7 @@ void vvToolBinarize::useFGBGtoggled(bool)
 //   DD(m.size());
 // }
 void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
   mCurrentSlicerManager = m;
 
   // Specific for this gui
@@ -214,7 +216,7 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
     mImageContour.push_back(vvImageContour::New());
     mImageContour[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
     mImageContour[i]->SetColor(1.0, 0.0, 0.0);
-    mImageContour[i]->SetDepth(100); // to be in front of (whe used with ROI tool)
+    mImageContour[i]->SetDepth(0); // to be in front of (whe used with ROI tool)
     mImageContourLower.push_back(vvImageContour::New());
     mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
     mImageContourLower[i]->SetColor(0.0, 0.0, 1.0);
@@ -231,7 +233,6 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
   connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int)));
 
   //  connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
-  
   InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
 }
 //------------------------------------------------------------------------------
@@ -250,21 +251,21 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::UpdateOrientation(int slicer,int orientation)
-{
+{ //out << __func__ << endl;
   Update(slicer);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::UpdateSlice(int slicer,int slices)
-{
+{ //out << __func__ << endl;
   Update(slicer);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::Update(int slicer)
-{
+{ //out << __func__ << endl;
   if (!mInteractiveDisplayIsEnabled) return;
   if (!mCurrentSlicerManager) close();
   mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
@@ -275,7 +276,7 @@ void vvToolBinarize::Update(int slicer)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::GetArgsInfoFromGUI()
-{
+{ //out << __func__ << endl;
 
   /* //KEEP THIS FOR READING GGO FROM FILE
      int argc=1;
@@ -330,11 +331,11 @@ void vvToolBinarize::GetArgsInfoFromGUI()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::apply()
-{
+{ //out << __func__ << endl;
   if (!mCurrentSlicerManager) close();
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-  GetArgsInfoFromGUI();
-
+  GetArgsInfoFromGUI();  
+  
   // Main filter
   clitk::BinarizeImageGenericFilter::Pointer filter =
     clitk::BinarizeImageGenericFilter::New();
@@ -342,8 +343,9 @@ void vvToolBinarize::apply()
   filter->SetArgsInfo(mArgsInfo);
   filter->Update();
 
+
   // Output
-  vvImage::Pointer output = filter->GetOutputVVImage();
+  vvImage::Pointer output = filter->GetOutputVVImage();  
   std::ostringstream osstream;
   osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
   AddImage(output,osstream.str());
@@ -355,7 +357,7 @@ void vvToolBinarize::apply()
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::valueChangedT2(double v)
-{
+{ //out << __func__ << endl;
   //  DD("valueChangedT2");
   if (mRadioButtonLowerThan->isChecked()) {
     mThresholdSlider1->SetMaximum(v);
@@ -371,7 +373,7 @@ void vvToolBinarize::valueChangedT2(double v)
 
 //------------------------------------------------------------------------------
 void vvToolBinarize::valueChangedT1(double v)
-{
+{ //out << __func__ << endl;
   //  DD("valueChangedT1");
   if (!mCurrentSlicerManager) close();
   mThresholdSlider2->SetMinimum(v);
index 539e30ef9ea892727b49348220e9e9e8c2333eae..19297d33332efd7d211d4f8a36d10eb5f3de3233 100644 (file)
@@ -99,7 +99,7 @@ void vvToolCropImage::closeEvent(QCloseEvent *event)
 {
   if(mCurrentSlicerManager){
 //     Reset extends
-    for(int i=0; i<mExtentSize; i++){
+    for(int i=0; i<6; i++){
       mReducedExtent[i] = mInitialExtent[i];
     }
     UpdateExtent();
@@ -191,8 +191,10 @@ void vvToolCropImage::InputIsSelected(vvSlicerManager * slicer)
   }
 
 //   Set initial sliders values
-  std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
+  int w_ext[6], imsize[3];
+  mCurrentSlicerManager->GetSlicer(0)->GetRegisterExtent(w_ext);
   for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
+    imsize[dim] = w_ext[2*dim+1] - w_ext[2*dim] +1;
     mSliders[dim*2]->setMaximum(imsize[dim]-1);
     mSliders[dim*2+1]->setMaximum(imsize[dim]-1);
     mSliders[dim*2+1]->setValue(imsize[dim]-1);
index c86b4b2018fa89496b042f7780a5b6948e03039c..ef83846510c33683d403359b41169ec11456dee3 100644 (file)
@@ -22,7 +22,6 @@
 #include "vvImageWriter.h"
 #include "vvROIActor.h"
 #include "vvSlicer.h"
-#include "vvROIActor.h"
 #include "vvMeshReader.h"
 #include "vvStructSelector.h"
 #include "vvToolManager.h"
@@ -54,7 +53,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f)
   QWidget(parent->GetTab()),
   vvToolBase<vvToolROIManager>(parent),
   Ui::vvToolROIManager()
-{
+{ //out << __func__ << endl;
   // Store parent
   mMainWindow = parent;
 
@@ -94,7 +93,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f)
 
 //------------------------------------------------------------------------------
 vvToolROIManager::~vvToolROIManager()
-{
+{ //out << __func__ << endl;
   mROIActorsList.clear();
 }
 //------------------------------------------------------------------------------
@@ -102,7 +101,8 @@ vvToolROIManager::~vvToolROIManager()
 
 //------------------------------------------------------------------------------
 // STATIC
-void vvToolROIManager::Initialize() {
+void vvToolROIManager::Initialize()
+{ //out << __func__ << endl;
   SetToolName("ROIManager");
   SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
   SetToolIconFilename(":/common/icons/tool-roi.png");
@@ -115,7 +115,7 @@ void vvToolROIManager::Initialize() {
 
 //------------------------------------------------------------------------------
 void  vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
-{
+{ //out << __func__ << endl;
   // Check if we need to start a new tool or read in the state file to load
   if (ReadStateFlag == false) {
     // Select the current image as the target
@@ -221,7 +221,7 @@ void  vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
-{
+{ //out << __func__ << endl;
   // Initialization
   mCurrentSlicerManager = m;
   mCurrentImage = mCurrentSlicerManager->GetImage();
@@ -244,7 +244,7 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
   if (m == mCurrentSlicerManager) {
     close();
     return;
@@ -255,7 +255,7 @@ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::close()
-{
+{ //out << __func__ << endl;
   disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
   disconnect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
   disconnect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
@@ -280,8 +280,8 @@ void vvToolROIManager::close()
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
-
+void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m)
+{ //out << __func__ << endl;
   if (mCurrentSlicerManager == NULL) return;
   if (m == NULL) return;
   if (m != mCurrentSlicerManager) hide();
@@ -294,7 +294,7 @@ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::Open()
-{
+{ //out << __func__ << endl;
   // Open images
   QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)";
   Extensions += ";;All Files (*)";
@@ -315,7 +315,7 @@ void vvToolROIManager::Open()
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::OpenBinaryImage(QStringList & filename)
-{
+{ //out << __func__ << endl;
   if (filename.size() == 0) return;
 
   vvProgressDialog p("Reading ROI ...", true);
@@ -359,7 +359,7 @@ void vvToolROIManager::OpenBinaryImage(QStringList & filename)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::OpenDicomImage(std::string filename)
-{
+{ //out << __func__ << endl;
   // GUI selector of roi
   vvMeshReader reader;
   reader.SetFilename(filename);
@@ -411,7 +411,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
                                 std::string name,
                                 std::string filename,
                                 double BG, bool modeBG)
-{
+{ //out << __func__ << endl;
   // Check Dimension
   int dim = mCurrentImage->GetNumberOfDimensions();
   int bin_dim = binaryImage->GetNumberOfDimensions();
@@ -467,7 +467,8 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
   // CheckBox for "All"
   if (actor->IsVisible()) mNumberOfVisibleROI++;
   if (actor->IsContourVisible()) mNumberOfVisibleContourROI++;
-
+  AllVisibleContourROIToggled(true);
+  
   // Add ROI in tree
   mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(mTree)));
   QTreeWidgetItem * w = mTreeWidgetList.back().data();
@@ -492,7 +493,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage,
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::UpdateAllContours()
-{
+{ //out << __func__ << endl;
   if (mCurrentSlicerManager == NULL) return;
   // Render loaded ROIs (the first is sufficient)
   for(unsigned int i=0; i<mROIList.size(); i++) {
@@ -504,7 +505,8 @@ void vvToolROIManager::UpdateAllContours()
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::UpdateAllROIStatus() {
+void vvToolROIManager::UpdateAllROIStatus()
+{ //out << __func__ << endl;
   int nbVisible = 0;
   int nb = mROIList.size();
   for(int i=0; i<nb; i++) {
@@ -528,7 +530,8 @@ void vvToolROIManager::UpdateAllROIStatus() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::SelectedItemChangedInTree() {
+void vvToolROIManager::SelectedItemChangedInTree()
+{ //out << __func__ << endl;
   // Search which roi is selected
   QList<QTreeWidgetItem *> l = mTree->selectedItems();
   if (l.size() == 0) {
@@ -610,7 +613,8 @@ void vvToolROIManager::SelectedItemChangedInTree() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::VisibleROIToggled(bool b) {
+void vvToolROIManager::VisibleROIToggled(bool b)
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
   mCurrentROIActor->SetVisible(b);
@@ -621,7 +625,8 @@ void vvToolROIManager::VisibleROIToggled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::VisibleContourROIToggled(bool b) {
+void vvToolROIManager::VisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
   mCurrentROIActor->SetContourVisible(b);
@@ -632,7 +637,8 @@ void vvToolROIManager::VisibleContourROIToggled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::OpacityChanged(int v) {
+void vvToolROIManager::OpacityChanged(int v)
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetOpacity((double)v/100.0);
   mCurrentROIActor->UpdateColor();
@@ -642,7 +648,8 @@ void vvToolROIManager::OpacityChanged(int v) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleROIToggled(int b) {
+void vvToolROIManager::AllVisibleROIToggled(int b)
+{ //out << __func__ << endl;
   bool status = false;
   if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
       (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked))  status = true;
@@ -659,7 +666,8 @@ void vvToolROIManager::AllVisibleROIToggled(int b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
+void vvToolROIManager::AllVisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
   bool status = false;
   if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
       (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked))  status = true;
@@ -677,7 +685,8 @@ void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeColor() {
+void vvToolROIManager::ChangeColor()
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   QColor color;
   color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
@@ -702,7 +711,8 @@ void vvToolROIManager::ChangeColor() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourColor() {
+void vvToolROIManager::ChangeContourColor()
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   QColor color;
   color.setRgbF(mCurrentROIActor->GetContourColor()[0],
@@ -719,7 +729,8 @@ void vvToolROIManager::ChangeContourColor() {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourWidth(int n) {
+void vvToolROIManager::ChangeContourWidth(int n)
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetContourWidth(n);
   mCurrentROIActor->UpdateColor();
@@ -729,7 +740,8 @@ void vvToolROIManager::ChangeContourWidth(int n) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ChangeDepth(int n) {
+void vvToolROIManager::ChangeDepth(int n)
+{ //out << __func__ << endl;
   if (mCurrentROIActor == NULL) return;
   mCurrentROIActor->SetDepth(n);
   // mCurrentROIActor->UpdateImage(); // FIXME
@@ -742,7 +754,8 @@ void vvToolROIManager::ChangeDepth(int n) {
 
 
 //------------------------------------------------------------------------------
-void vvToolROIManager::ReloadCurrentROI() {
+void vvToolROIManager::ReloadCurrentROI()
+{ //out << __func__ << endl;
   if (mCurrentROI->GetFilename() == "") {
     return; // do nothing (contour from rt struct do not reload)
   }
@@ -783,7 +796,7 @@ void vvToolROIManager::ReloadCurrentROI() {
 
 //------------------------------------------------------------------------------
 void  vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
-{
+{ //out << __func__ << endl;
   // Get index of the image
   int n = mMainWindow->GetSlicerManagers().size();
   int index=-1;
@@ -829,7 +842,7 @@ void  vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::ReadXMLInformation()
-{
+{ //out << __func__ << endl;
   std::string value="";
   mInitialImageIndex = -1;
   while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) {
@@ -851,7 +864,7 @@ void vvToolROIManager::ReadXMLInformation()
 
 //------------------------------------------------------------------------------
 void vvToolROIManager::ReadXMLInformation_ROI()
-{
+{ //out << __func__ << endl;
   QString s;
   std::string value="";
   QSharedPointer<vvROIActor> param = QSharedPointer<vvROIActor>(new vvROIActor);
index 644920b4435fa420e35c7d33664c5ad9697a5c2e..0c4199325904b32d212f1dd093764ce068573cc2 100644 (file)
@@ -359,6 +359,7 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
   vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
   // TODO SR and BP: check on the list of transforms and not the first only
   mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix);
+  //mCurrentSlicerManager->GetSlicer(2)->GetSlicingTransform()->SetMatrix(matrix);
   transform->Update();
   Render();
   dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
@@ -409,7 +410,7 @@ void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
       rotSliders[i]->setValue(iAngle);
       rotSliders[i]->blockSignals(false);
     }
-  }
+  }cout << euler->GetParameters()[0+3] << " " << euler->GetParameters()[1+3] << " " << euler->GetParameters()[2+3] << endl;
 }
 //------------------------------------------------------------------------------
 
@@ -460,7 +461,7 @@ void vvToolRigidReg::ExtentMax(const double pointExtent[8][4], double maxExtent[
 //------------------------------------------------------------------------------
 void vvToolRigidReg::Render()
 { //out << __func__ << endl;
-#if VTK_MAJOR_VERSION > 5
+#if VTK_MAJOR_VERSION > 7
 double translationValues[4], translationValuesUpdate[4];
 mCurrentSlicerManager->GetImage()->GetTransform()[0]->Print(cout);
 vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix();
@@ -486,7 +487,7 @@ for (int i=0; i<4; ++i) {
 
 #endif
 for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
-#if VTK_MAJOR_VERSION > 
+#if VTK_MAJOR_VERSION > 7
     double pointExtent[8][4], pointExtentUpdate[8][4], pointOverlayExtent[8][4], pointOverlayExtentUpdate[8][4], centre[3], translation[3];
     std::vector<int> w_ext;
     w_ext=mCurrentSlicerManager->GetImage()->GetSize();
diff --git a/vv/vvToolTest.cxx b/vv/vvToolTest.cxx
new file mode 100644 (file)
index 0000000..e583ac4
--- /dev/null
@@ -0,0 +1,306 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.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
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+  ===========================================================================**/
+
+// vv
+#include "vvToolTest.h"
+#include "vvSlicerManager.h"
+#include "vvSlicer.h"
+#include "vvToolInputSelectorWidget.h"
+
+// clitk
+#include "clitkBinarizeImageGenericFilter.h"
+
+// vtk
+#include <vtkImageActor.h>
+#include <vtkCamera.h>
+#include <vtkImageClip.h>
+#include <vtkRenderWindow.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkRenderer.h>
+#include <vtkSphereSource.h>
+#include <vtkProperty.h>
+
+
+//------------------------------------------------------------------------------
+// Create the tool and automagically (I like this word) insert it in
+// the main window menu.
+ADD_TOOL(vvToolTest);
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::Initialize()
+{ cout << __func__ << endl;
+  SetToolName("Test");
+  SetToolMenuName("Test");
+  SetToolIconFilename(":/common/icons/binarize.png");
+  SetToolTip("try to display a sphere.");
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::vvToolTest(vvMainWindowBase * parent, Qt::WindowFlags f)
+  :vvToolWidgetBase(parent,f),
+   vvToolBase<vvToolTest>(parent),
+   Ui::vvToolTest()
+{ cout << __func__ << endl;
+  // GUI Initialization
+
+  // Connect signals & slots
+  
+  // Main filter
+  mFilter = clitk::BinarizeImageGenericFilter::New();
+
+  // Set how many inputs are needed for this tool
+  AddInputSelector("Select one image", mFilter);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::~vvToolTest()
+{ cout << __func__ << endl;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+/*
+void vvToolTest::InteractiveDisplayToggled(bool b)
+{ cout << __func__ << endl;
+  mInteractiveDisplayIsEnabled = b;
+  if (!mInteractiveDisplayIsEnabled) {
+    RemoveVTKObjects();
+  } else {
+    for(unsigned int i=0; i<mImageContour.size(); i++) {
+      mImageContour[i]->ShowActors();
+      if (mRadioButtonLowerThan->isChecked())
+        mImageContourLower[i]->ShowActors();
+    }
+    if (mCurrentSlicerManager)
+      mCurrentSlicerManager->Render();
+  }
+}
+*/
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvToolTest::close()
+{ cout << __func__ << endl;
+  return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::reject()
+{ cout << __func__ << endl;
+  // DD("vvToolBinarize::reject");
+  return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+void vvToolTest::InputIsSelected(vvSlicerManager * m)
+{ cout << __func__ << endl;
+  mCurrentSlicerManager = m;
+
+
+  vtkSmartPointer<vtkSphereSource> sphereSource = 
+      vtkSmartPointer<vtkSphereSource>::New();
+  sphereSource->SetCenter(0, 0, 0);
+  //sphereSource->SetCenter(235.351, 175.781, 141.0);
+  sphereSource->SetRadius(10.0);
+  sphereSource->Update();
+  vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
+      vtkSmartPointer<vtkPolyDataMapper>::New();
+  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());
+  vtkSmartPointer<vtkActor> sphereActor = 
+      vtkSmartPointer<vtkActor>::New();
+  sphereActor->SetMapper(sphereMapper);
+  sphereActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
+  sphereActor->GetProperty()->SetOpacity(0.995);
+  sphereActor->SetPosition(235.351, 175.781, -10);
+  
+  
+  // VTK Renderer
+  vtkSmartPointer<vtkRenderer> sphereRenderer = 
+      vtkSmartPointer<vtkRenderer>::New();
+  // Add Actor to renderer
+  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->AddActor(sphereActor);
+  }
+  //sphereRenderer->AddActor(sphereActor); //mettre le vvSlicer
+   
+  // VTK/Qt wedded
+  //this->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);
+
+  // VTK objects for interactive display
+  valueChangedT1();
+
+  //connect(mThresholdSlider1, SIGNAL(valueChanged(double)), this, SLOT(valueChangedT1()));
+
+  connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+  connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+  
+  connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateSlice(int, int)));
+
+  //  connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
+  //InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// void vvToolBinarize::LeftButtonReleaseEvent(int slicer) {
+//   DD("LeftButtonReleaseEvent");
+//   for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+//     if (i == slicer);
+//     mCurrentSlicerManager->GetSlicer(i)->GetRenderWindow()->Render();
+//   }
+// }
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::apply()
+{ cout << __func__ << endl;
+  if (!mCurrentSlicerManager) close();
+  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+  //GetArgsInfoFromGUI();  
+  
+  // Main filter
+
+
+
+  // Output
+  QApplication::restoreOverrideCursor();
+  close();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::UpdateSlice(int slicer,int slices)
+{ cout << __func__ << endl;
+  Update(slicer);
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::Update(int slicer)
+{ cout << __func__ << endl;
+  if (!mCurrentSlicerManager) close();
+  mCurrentSlicerManager->Render();
+  //mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/* void vvToolTest::GetArgsInfoFromGUI()
+{ cout << __func__ << endl;
+
+  /* //KEEP THIS FOR READING GGO FROM FILE
+     int argc=1;
+     std::string a = "toto";
+     char * const* argv = new char*;
+     //a.c_str();
+     struct cmdline_parser_params p;
+     p.check_required = 0;
+     int good = cmdline_parser_ext(argc, argv, &args_info, &p);
+     DD(good);
+  */
+/*  cmdline_parser_clitkBinarizeImage_init(&mArgsInfo); // Initialisation to default
+  bool inverseBGandFG = false;
+
+  mArgsInfo.lower_given = 1;
+  mArgsInfo.lower_arg = mThresholdSlider1->GetValue();
+  if (mRadioButtonLowerThan->isChecked()) {
+    mArgsInfo.upper_given = 1;
+    mArgsInfo.upper_arg = mThresholdSlider2->GetValue();
+    if (mArgsInfo.upper_arg<mArgsInfo.lower_arg) {
+      mArgsInfo.upper_given = 0;
+      DD("TODO : lower thres greater than greater thres ! Ignoring ");
+    }
+  }
+
+  mArgsInfo.fg_arg = mFGSlider->GetValue();
+  mArgsInfo.bg_arg = mBGSlider->GetValue();
+
+  if (inverseBGandFG) {
+    mArgsInfo.fg_arg = mFGSlider->GetValue();
+    mArgsInfo.bg_arg = mBGSlider->GetValue();
+  }
+  mArgsInfo.fg_given = 1;
+  mArgsInfo.bg_given = 1;
+
+  if (mCheckBoxUseBG->isChecked()) {
+    if (mCheckBoxUseFG->isChecked()) mArgsInfo.mode_arg = (char*)"both";
+    else mArgsInfo.mode_arg = (char*)"BG";
+  } else mArgsInfo.mode_arg = (char*)"FG";
+
+  mArgsInfo.verbose_flag = false;
+
+  // // Required (even if not used)
+  // mArgsInfo.input_given = 0;
+  // mArgsInfo.output_given = 0;
+
+  // mArgsInfo.input_arg = new char;
+  // mArgsInfo.output_arg = new char;
+} */
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::valueChangedT1()
+{ cout << __func__ << endl;
+  //  DD("valueChangedT1");
+  if (!mCurrentSlicerManager) close();
+  for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+    //mImageContour[i]->Update(v);
+  }
+  mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
diff --git a/vv/vvToolTest.h b/vv/vvToolTest.h
new file mode 100644 (file)
index 0000000..f28a181
--- /dev/null
@@ -0,0 +1,62 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to: 
+  - University of LYON              http://www.universite-lyon.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
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef VVTOOLTEST_H
+#define VVTOOLTEST_H
+
+#include <QtUiPlugin/QDesignerExportWidget>
+
+#include "vvToolBase.h"
+#include "vvToolWidgetBase.h"
+#include "vvImageContour.h"
+#include "ui_vvToolTest.h"
+
+
+//------------------------------------------------------------------------------
+class vvToolTest:
+  public vvToolWidgetBase,
+  public vvToolBase<vvToolTest>,
+  private Ui::vvToolTest 
+{
+  Q_OBJECT
+    public:
+  vvToolTest(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
+  ~vvToolTest();
+
+  //-----------------------------------------------------
+  static void Initialize();
+  //void GetArgsInfoFromGUI();
+  virtual void InputIsSelected(vvSlicerManager * m);
+
+  //-----------------------------------------------------
+  public slots:
+  virtual bool close();
+  virtual void reject();
+  virtual void apply();
+  void UpdateSlice(int slicer,int slices);
+  void valueChangedT1();
+
+ protected:
+  Ui::vvToolTest ui;
+  
+  void Update(int slicer);
+
+}; // end class vvToolTest
+//------------------------------------------------------------------------------
+
+#endif
+
index 6abc741ac47917b8fe6f671492a2b0398e957300..6d89fcf2092dd1c32ddc25eeaa6d5f25da2cd1f7 100644 (file)
@@ -38,7 +38,7 @@ bool vvToolWidgetBase::mIsAnotherToolWaitInput = false;
 vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, bool initialize):
   QWidget(parent, f),
   Ui::vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
   mMainWindow = parent;
   setAttribute(Qt::WA_DeleteOnClose);
   if (initialize) Initialization();
@@ -116,7 +116,7 @@ vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f,
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::Initialization() 
-{
+{ //out << __func__ << endl;
   mCurrentSlicerManager = 0;
   mIsInitialized = false;
   mFilter = 0;
@@ -139,14 +139,14 @@ void vvToolWidgetBase::Initialization()
 
 //------------------------------------------------------------------------------
 vvToolWidgetBase::~vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::keyPressEvent(QKeyEvent *event) 
-{
+{ //out << __func__ << endl;
   if (event->key() == Qt::Key_Escape) {
     reject();
     event->accept();
@@ -164,7 +164,7 @@ void vvToolWidgetBase::keyPressEvent(QKeyEvent *event)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::accept()
-{
+{ //out << __func__ << endl;
   apply();
 }
 //------------------------------------------------------------------------------
@@ -172,7 +172,7 @@ void vvToolWidgetBase::accept()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::reject()
-{
+{ //out << __func__ << endl;
   close();
 }
 //------------------------------------------------------------------------------
@@ -180,7 +180,7 @@ void vvToolWidgetBase::reject()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip)
-{
+{ //out << __func__ << endl;
   int j=0;
   mFilter = f;
   mSlicerManagersCompatible.clear();
@@ -219,7 +219,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFil
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
-{
+{ //out << __func__ << endl;
   mSlicerManagersCompatible.clear();
   for(unsigned int i=0; i<mMainWindow->GetSlicerManagers().size(); i++) {
     mSlicerManagersCompatible.push_back(mMainWindow->GetSlicerManagers()[i]);
@@ -245,7 +245,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::HideInputSelector()
-{
+{ //out << __func__ << endl;
   mToolInputSelectionWidget->hide();
 }
 //------------------------------------------------------------------------------
@@ -253,7 +253,7 @@ void vvToolWidgetBase::HideInputSelector()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::show()
-{
+{ //out << __func__ << endl;
   if (!mIsInitialized) {
     mToolInputSelectionWidget->Initialize();
     mIsInitialized = true;
@@ -265,7 +265,7 @@ void vvToolWidgetBase::show()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::closeEvent(QCloseEvent *event) 
-{
+{ //out << __func__ << endl;
   mIsAnotherToolWaitInput = false;
   if (isWindow()) {
     event->accept();//return QWidget::close();
@@ -292,7 +292,7 @@ void vvToolWidgetBase::closeEvent(QCloseEvent *event)
 
 //------------------------------------------------------------------------------
 bool vvToolWidgetBase::close()
-{
+{ //out << __func__ << endl;
   QApplication::restoreOverrideCursor();
   return QWidget::close();
 }
@@ -301,7 +301,7 @@ bool vvToolWidgetBase::close()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
   mToolInputSelectionWidget->AnImageIsBeingClosed(m);
   if (m == mCurrentSlicerManager) {
     close();
@@ -312,7 +312,7 @@ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::SwapCurrentWidget()
-{
+{ //out << __func__ << endl;
   mStaticWidgetForTab->setUpdatesEnabled(false);
   QList<QObject*> l =mStaticWidgetForTab->children(); 
   for(int i=1; i<l.size(); i++) {
@@ -331,7 +331,7 @@ void vvToolWidgetBase::SwapCurrentWidget()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
   if (!isWindow()) { // When the tool is not in a window, it is in a tab : we only display if needed
     if (mCurrentSlicerManager == NULL) return;
     if (mToolWidget == NULL) return;
@@ -349,14 +349,14 @@ void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InitializeInputs()
-{
+{ //out << __func__ << endl;
 }
 //------------------------------------------------------------------------------
 
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected()
-{
+{ //out << __func__ << endl;
   mMainButtonBox->setEnabled(true);
   std::vector<vvSlicerManager*> & l = mToolInputSelectionWidget->GetSelectedInputs();
   mCurrentSlicerManager = l[0];
@@ -372,7 +372,7 @@ void vvToolWidgetBase::InputIsSelected()
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
   std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) if you use one single input" << std::endl;
   exit(0);
 }
@@ -381,7 +381,7 @@ void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
 
 //------------------------------------------------------------------------------
 void vvToolWidgetBase::InputIsSelected(std::vector<vvSlicerManager*> & l)
-{
+{ //out << __func__ << endl;
   mMainButtonBox->setEnabled(true);
   if (l.size() == 1) InputIsSelected(l[0]);
   else {