2 /*=========================================================================
5 Module: $RCSfile: bbvtkIsoSurfaceExtractor.cxx,v $
7 Date: $Date: 2008/04/24 12:56:41 $
8 Version: $Revision: 1.5 $
10 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
11 l'Image). All rights reserved. See Doc/License.txt or
12 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notices for more information.
18 =========================================================================*/
27 #include "vtkProperty.h"
29 #include "bbvtkIsoSurfaceExtractor.h"
30 #include "bbvtkPackage.h"
34 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,IsoSurfaceExtractor)
35 BBTK_BLACK_BOX_IMPLEMENTATION(IsoSurfaceExtractor,bbtk::AtomicBlackBox);
37 void IsoSurfaceExtractor::bbUserConstructor()
40 std::vector<double> colour;
41 colour.push_back(1.0);
42 colour.push_back(1.0);
43 colour.push_back(0.5);
44 bbSetInputColour(colour);
47 void IsoSurfaceExtractor::bbUserCopyConstructor()
52 void IsoSurfaceExtractor::Init()
57 // bbSetInputInVtkObject(NULL);
58 bbSetInputRenderer(NULL);
59 bbSetInputIsovalue(400);
62 marchingcubes = vtkMarchingCubes::New();
63 polydatamapper = vtkPolyDataMapper::New();
64 vtkactor = vtkActor::New();
66 polydatamapper->SetInput(marchingcubes->GetOutput());
67 vtkactor->SetMapper(polydatamapper);
69 polydatamapper->ScalarVisibilityOff();
70 polydatamapper->ImmediateModeRenderingOn();
73 //---------------------------------------------------------------------
75 void IsoSurfaceExtractor::DoProcess()
77 // bbGetInputIn()->Print(std::cout);
78 // Visualisation - result volume
79 marchingcubes->SetInput( bbGetInputIn() );
80 marchingcubes->SetValue(0, bbGetInputIsovalue() );
81 marchingcubes->Update();
83 vtkactor->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] );
86 vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
87 bbSetOutputOut( vtkactor );
90 if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
93 bbGetInputRenderer()->AddActor( vtkactor );
96 } // EO namespace bbtk