Skip to content

Commit

Permalink
Re #142: Fixed the isodose color in 2d viewer. It probably has someth…
Browse files Browse the repository at this point in the history
…ing to do with the scalar and normals computation. Once I modified the pipeline to generate the polydata, it works fine now. I guess slicer requires certain properties to be properly computed for vtkpolydata in order for the 2D viewer to display the intersection correctly.

git-svn-id: https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/src@336 25a7314f-c4c8-4314-9936-a25f8480a772
  • Loading branch information
wangk committed Oct 4, 2012
1 parent b7024ee commit dc07b61
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Isodose/Logic/vtkSlicerIsodoseModuleLogic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <vtkPolyDataNormals.h>
#include <vtkLookupTable.h>
#include <vtkColorTransferFunction.h>
#include <vtkWindowedSincPolyDataFilter.h>

// STD includes
#include <cassert>
Expand Down Expand Up @@ -335,6 +336,9 @@ int vtkSlicerIsodoseModuleLogic::ComputeIsodose()
marchingCubes->SetInput(changeInfo->GetOutput());
marchingCubes->SetNumberOfContours(1);
marchingCubes->SetValue(0, isoLevel);
marchingCubes->ComputeScalarsOff();
marchingCubes->ComputeGradientsOff();
marchingCubes->ComputeNormalsOff();
marchingCubes->Update();

vtkSmartPointer<vtkPolyData> isoPolyData= marchingCubes->GetOutput();
Expand All @@ -346,13 +350,25 @@ int vtkSlicerIsodoseModuleLogic::ComputeIsodose()

vtkSmartPointer<vtkDecimatePro> decimate = vtkSmartPointer<vtkDecimatePro>::New();
decimate->SetInput(triangleFilter->GetOutput());
decimate->SetTargetReduction(0.9);
decimate->SetTargetReduction(0.6);
decimate->SetFeatureAngle(60);
decimate->SplittingOff();
decimate->PreserveTopologyOn();
decimate->SetMaximumError(1);
decimate->Update();

vtkSmartPointer<vtkWindowedSincPolyDataFilter> smootherSinc = vtkSmartPointer<vtkWindowedSincPolyDataFilter>::New();
smootherSinc->SetPassBand(0.1);
smootherSinc->SetInput(decimate->GetOutput() );
smootherSinc->SetNumberOfIterations(2);
smootherSinc->FeatureEdgeSmoothingOff();
smootherSinc->BoundarySmoothingOff();
smootherSinc->Update();

vtkSmartPointer<vtkPolyDataNormals> normals = vtkSmartPointer<vtkPolyDataNormals>::New();
normals->SetInput(decimate->GetOutput());
normals->SetFeatureAngle(45);
normals->SetInput(smootherSinc->GetOutput());
normals->ComputePointNormalsOn();
normals->SetFeatureAngle(60);
normals->Update();

vtkSmartPointer<vtkMRMLModelDisplayNode> displayNode = vtkSmartPointer<vtkMRMLModelDisplayNode>::New();
Expand Down

0 comments on commit dc07b61

Please sign in to comment.