]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git://git.creatis.insa-lyon.fr/clitk
authorBenoît Presles <benoit.presles@netcourrier.com>
Tue, 23 Oct 2012 17:40:55 +0000 (19:40 +0200)
committerBenoît Presles <benoit.presles@netcourrier.com>
Tue, 23 Oct 2012 17:40:55 +0000 (19:40 +0200)
1  2 
vv/CMakeLists.txt
vv/vvSlicer.cxx

diff --combined vv/CMakeLists.txt
index 3a12e03553284530d580793a9b541624a0319982,8fb0ac5c5c45234e2b24c66e42b18d08a88f1691..331751b2644a64310efbc92a2aa7a5a9acdd6a05
@@@ -79,7 -79,6 +79,7 @@@ SET(vv_SRC
    vvSlicer.cxx
    vvLandmarks.cxx
    vvLandmarksGlyph.cxx
 +  vvClipPolyData.cxx
    vvGlyphSource.cxx
    vvGlyph2D.cxx
    vvSlicerManager.cxx
@@@ -90,8 -89,6 +90,6 @@@
    vvMeshActor.cxx
    vvMeshReader.cxx
    vvMidPosition.cxx
-   vvImageMapToWLColors.cxx
-   vvThreadedFilter.cxx
    vvImageContour.cxx
    vvBinaryImageOverlayActor.cxx
    vvStructureSetActor.cxx
@@@ -115,7 -112,6 +113,6 @@@ QT4_WRAP_CPP(vv_SRC
    vvHelpDialog.h  
    vvQDicomSeriesSelector.h 
    vvSlicerManager.h
-   vvThreadedFilter.h
    vvStructureSetActor.h
    vvROIActor.h
    vvToolCreatorBase.h
diff --combined vv/vvSlicer.cxx
index 924eb1d8161d096452e7849df145da07c17fa1d9,a915a6b84b1b616e16430e23dad84853e2d7eee3..4cf5a17e130ab70e3b14edc8851b585bdd5fb811
@@@ -21,7 -21,6 +21,6 @@@
  #include "vvSlicerManagerCommand.h"
  #include "vvGlyphSource.h"
  #include "vvGlyph2D.h"
- #include "vvImageMapToWLColors.h"
  
  #include <vtkTextProperty.h>
  #include <vtkTextActor.h>
@@@ -41,7 -40,6 +40,7 @@@
  #include <vtkDataArray.h>
  #include <vtkFloatArray.h>
  #include <vtkClipPolyData.h>
 +#include <vtkActor2DCollection.h>
  #include <vtkGlyph3D.h>
  #include <vtkMath.h>
  #include <vtkCursor3D.h>
@@@ -138,9 -136,6 +137,6 @@@ vvSlicer::vvSlicer(
    this->GetRenderer()->AddActor(legend);
    showFusionLegend = false;
  
-   this->WindowLevel->Delete();
-   this->WindowLevel = vvImageMapToWLColors::New();
    this->InstallPipeline();
  
    mLinkOverlayWindowLevel = true;
@@@ -581,40 -576,36 +577,40 @@@ void vvSlicer::SetLandmarks(vvLandmarks
  
      if (!mCross)
        mCross = vtkSmartPointer<vtkCursor3D>::New();
 +      if (!mClipBox)
 +      mClipBox = vtkSmartPointer<vtkBox>::New();
 +    if (!mLandClipper)
 +      mLandClipper = vtkSmartPointer<vvClipPolyData>::New();
 +    if (!mLandGlyph)
 +      mLandGlyph = vtkSmartPointer<vtkGlyph3D>::New();
 +    if (!mLandMapper)
 +      mLandMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
 +    if (!mLandActor)
 +      mLandActor = vtkSmartPointer<vtkActor>::New();
 +
      mCross->SetFocalPoint(0.0,0.0,0.0);
      mCross->SetModelBounds(-10,10,-10,10,-10,10);
      mCross->AllOff();
      mCross->AxesOn();
  
 -    if (!mLandGlyph)
 -      mLandGlyph = vtkSmartPointer<vtkGlyph3D>::New();
 +    mLandClipper->SetClipFunction(mClipBox);
 +    mLandClipper->InsideOutOn();
 +    mLandClipper->SetInput(mLandmarks->GetOutput());
 +
      mLandGlyph->SetSource(mCross->GetOutput());
 -    mLandGlyph->SetInput(landmarks->GetOutput());
 +    mLandGlyph->SetInput(mLandClipper->GetOutput());
      //mLandGlyph->SetIndexModeToScalar();
 -    mLandGlyph->SetRange(0,1);
 -    mLandGlyph->ScalingOff();
 -
 -    mLandGlyph->SetColorModeToColorByScalar();
 +    //mLandGlyph->SetRange(0,1);
 +    //mLandGlyph->ScalingOff();
  
 -    if (!mClipBox)
 -      mClipBox = vtkSmartPointer<vtkBox>::New();
 -    if (!mLandClipper)
 -      mLandClipper = vtkSmartPointer<vtkClipPolyData>::New();
 -    mLandClipper->InsideOutOn();
 -    mLandClipper->SetInput(mLandGlyph->GetOutput());
 -    mLandClipper->SetClipFunction(mClipBox);
 +    //mLandGlyph->SetColorModeToColorByScalar();
 +    
 +    mLandGlyph->SetScaleModeToDataScalingOff();
 +    mLandGlyph->SetIndexModeToOff();
  
 -    if (!mLandMapper)
 -      mLandMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
 -    mLandMapper->SetInputConnection(mLandClipper->GetOutputPort());
 +    mLandMapper->SetInputConnection(mLandGlyph->GetOutputPort());
      //mLandMapper->ScalarVisibilityOff();
  
 -    if (!mLandActor)
 -      mLandActor = vtkSmartPointer<vtkActor>::New();
      mLandActor->SetMapper(mLandMapper);
      mLandActor->GetProperty()->SetColor(255,10,212);
      mLandActor->SetPickable(0);
@@@ -1453,38 -1444,13 +1449,38 @@@ void vvSlicer::UpdateLandmarks(
  {
    vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
    if (pd->GetPoints()) {
 -    mLandGlyph->SetRange(0,1);
 -    mLandGlyph->Modified();
 -    mLandGlyph->Update();
 +    //mLandGlyph->SetRange(0,1);
 +    //mLandGlyph->Modified();
 +    //mLandGlyph->Update();
  
      mClipBox->Modified();
      mLandClipper->Update();
      mLandMapper->Update();
 +    //Let's add the captions
 +    //First remove all captions:
 +    for(unsigned int i=0;i<mLandLabelActors.size();i++) {
 +      this->Renderer->RemoveActor2D(mLandLabelActors[i]);
 +      //allActors2D->Remove (mLandLabelActors[i]);
 +    }
 +    mLandLabelActors.clear();
 +    //Next add the captions to the displayed points
 +    for (vtkIdType id=0; id<mLandClipper->GetOutput()->GetNumberOfPoints(); id++) {
 +        double *position = mLandClipper->GetOutput()->GetPoint(id);
 +      vtkStdString label = static_cast<vtkStringArray*>(mLandClipper->GetOutput()->GetPointData()->GetAbstractArray("labels"))->GetValue(id);
 +      vtkSmartPointer<vtkCaptionActor2D> label_actor = vtkSmartPointer<vtkCaptionActor2D>::New();
 +      label_actor->SetCaption(label);
 +      label_actor->SetAttachmentPoint(position);
 +      label_actor->GetCaptionTextProperty()->SetColor(1,0,0);
 +      label_actor->GetCaptionTextProperty()->SetOrientation(33.333333);
 +      label_actor->GetCaptionTextProperty()->SetFontFamilyToTimes();
 +      label_actor->GetCaptionTextProperty()->SetBold(0);
 +      label_actor->GetCaptionTextProperty()->SetFontSize(6);
 +      label_actor->BorderOff();
 +      label_actor->LeaderOff();
 +      label_actor->ThreeDimensionalLeaderOff();
 +      mLandLabelActors.push_back(label_actor);
 +      this->Renderer->AddActor2D(mLandLabelActors[id]);
 +     }
    }
  
  }