/*========================================================================= Program: bbtk Module: $RCSfile: bbvtkIsoSurfaceExtractor.cxx,v $ Language: C++ Date: $Date: 2008/04/18 12:59:52 $ Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ /** * \file * \brief */ #ifdef _USE_VTK_ #include "vtkProperty.h" #include "bbvtkIsoSurfaceExtractor.h" #include "bbvtkPackage.h" namespace bbvtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,IsoSurfaceExtractor) BBTK_BLACK_BOX_IMPLEMENTATION(IsoSurfaceExtractor,bbtk::AtomicBlackBox); void IsoSurfaceExtractor::bbUserConstructor() { Init(); std::vector colour; colour.push_back(1.0); colour.push_back(1.0); colour.push_back(0.5); bbSetInputColour(colour); } void IsoSurfaceExtractor::bbUserCopyConstructor() { Init(); } void IsoSurfaceExtractor::Init() { firsttime=true; bbSetInputIn(NULL); // bbSetInputInVtkObject(NULL); // bbSetInputRenderer(NULL); bbSetInputIsovalue(400); bbSetInputOpacity(1); marchingcubes = vtkMarchingCubes::New(); polydatamapper = vtkPolyDataMapper::New(); vtkactor = vtkActor::New(); polydatamapper->SetInput(marchingcubes->GetOutput()); vtkactor->SetMapper(polydatamapper); polydatamapper->ScalarVisibilityOff(); polydatamapper->ImmediateModeRenderingOn(); } //--------------------------------------------------------------------- void IsoSurfaceExtractor::DoProcess() { // bbGetInputIn()->Print(std::cout); // Visualisation - result volume marchingcubes->SetInput( bbGetInputIn() ); marchingcubes->SetValue(0, bbGetInputIsovalue() ); marchingcubes->Update(); // if (_2_isoActorMC6!=NULL) // { // bbGetInputRenderer()->RemoveActor(vtkactor); // } vtkactor->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] ); vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); bbSetOutputOut( vtkactor ); // Interface Update /* if ((firsttime==true) && (bbGetInputRenderer()!=NULL )) { firsttime=false; bbGetInputRenderer()->AddActor( vtkactor ); } */ } } // EO namespace bbtk #endif //_USE_VTK_