/*=========================================================================
Program: bbtk
- Module: $RCSfile: bbvtkIsoSurfaceExtractor.cxx,v $
+ Module: $RCSfile: bbvtkPolydataToActor.cxx,v $
Language: C++
- Date: $Date: 2009/12/18 12:38:33 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2009/05/28 08:55:44 $
+ Version: $Revision: 1.15 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include "vtkProperty.h"
#include "vtkLinearTransform.h"
-#include "bbvtkIsoSurfaceExtractor.h"
+#include "bbvtkPolydataToActor.h"
#include "bbvtkPackage.h"
namespace bbvtk
{
- BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,IsoSurfaceExtractor)
- BBTK_BLACK_BOX_IMPLEMENTATION(IsoSurfaceExtractor,bbtk::AtomicBlackBox);
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolydataToActor)
+ BBTK_BLACK_BOX_IMPLEMENTATION(PolydataToActor,bbtk::AtomicBlackBox);
- void IsoSurfaceExtractor::bbUserSetDefaultValues()
+ void PolydataToActor::bbUserSetDefaultValues()
{
- // printf("EED %p IsoSurfaceExtractor::bbUserConstructor \n", this);
firsttime=true;
std::vector<double> colour;
colour.push_back(1.0);
bbSetInputColour(colour);
bbSetInputIn(NULL);
- // bbSetInputInVtkObject(NULL);
bbSetInputRenderer(NULL);
bbSetInputTransform(NULL);
bbSetInputIsovalue(400);
bbSetInputOpacity(1);
- marchingcubes = NULL;
polydatamapper = NULL;
vtkactor = NULL;
}
//---------------------------------------------------------------------
- void IsoSurfaceExtractor::bbUserInitializeProcessing()
+ void PolydataToActor::bbUserInitializeProcessing()
{
- marchingcubes = vtkMarchingCubes::New();
polydatamapper = vtkPolyDataMapper::New();
vtkactor = vtkActor::New();
- polydatamapper->SetInput(marchingcubes->GetOutput());
+// polydatamapper->SetInput(marchingcubes->GetOutput());
vtkactor->SetMapper(polydatamapper);
polydatamapper->ScalarVisibilityOff();
}
//---------------------------------------------------------------------
- void IsoSurfaceExtractor::bbUserFinalizeProcessing()
+ void PolydataToActor::bbUserFinalizeProcessing()
{
- if (marchingcubes!=NULL)
- {
- marchingcubes->Delete();
- marchingcubes=NULL;
- }
-
-
if (polydatamapper!=NULL)
{
polydatamapper->Delete();
polydatamapper=NULL;
}
-
if (vtkactor!=NULL)
{
vtkactor->Delete();
vtkactor=NULL;
- }
-
-
-
-
+ }
}
//---------------------------------------------------------------------
- void IsoSurfaceExtractor::DoProcess()
+ void PolydataToActor::DoProcess()
{
- //printf("EED %p IsoSurfaceExtractor::DoProcess \n", this);
- marchingcubes->SetInput( bbGetInputIn() );
- marchingcubes->SetValue(0, bbGetInputIsovalue() );
- marchingcubes->Update();
+ polydatamapper->SetInput( bbGetInputIn() );
vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
bbGetInputColour()[1],
bbGetInputColour()[2] );
-
-
+
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
if ( bbGetInputTransform()!=NULL )
- {
- vtkactor->SetUserTransform( bbGetInputTransform() );
- }
+ {
+ vtkactor->SetUserTransform( bbGetInputTransform() );
+ }
bbSetOutputOut( vtkactor );
/*=========================================================================
Program: bbtk
- Module: $RCSfile: bbvtkIsoSurfaceExtractor.h,v $
+ Module: $RCSfile: bbvtkPolydataToActor.h,v $
Language: C++
Date: $Date: 2009/05/15 14:58:01 $
Version: $Revision: 1.12 $
#ifdef _USE_VTK_
-#ifndef __vtkIsoSurfaceExtractor_h__
-#define __vtkIsoSurfaceExtractor_h__
+#ifndef __vtkPolydataToActor_h__
+#define __vtkPolydataToActor_h__
-#include "vtkImageData.h"
#include "vtkRenderer.h"
-#include "vtkMarchingCubes.h"
+#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkProp3D.h"
#include "vtkActor.h"
namespace bbvtk
{
- class /*BBTK_EXPORT*/ IsoSurfaceExtractor
+ class /*BBTK_EXPORT*/ PolydataToActor
:
public bbtk::AtomicBlackBox
{
bool firsttime;
- vtkMarchingCubes *marchingcubes;
vtkPolyDataMapper *polydatamapper;
vtkActor *vtkactor;
- BBTK_BLACK_BOX_INTERFACE(IsoSurfaceExtractor,bbtk::AtomicBlackBox);
+ BBTK_BLACK_BOX_INTERFACE(PolydataToActor,bbtk::AtomicBlackBox);
- BBTK_DECLARE_INPUT(In,vtkImageData *);
- // BBTK_DECLARE_INPUT(InVtkObject,vtkObject *);
+ BBTK_DECLARE_INPUT(In,vtkPolyData *);
BBTK_DECLARE_INPUT(Isovalue,double);
BBTK_DECLARE_INPUT(Opacity,double);
BBTK_DECLARE_INPUT(Colour,std::vector<double>);
protected:
};
- BBTK_BEGIN_DESCRIBE_BLACK_BOX(IsoSurfaceExtractor,bbtk::AtomicBlackBox);
- BBTK_NAME("IsoSurfaceExtractor");
- BBTK_AUTHOR("eduardo.davila / laurent.guigues at creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("Extracts an iso-surface of a 3D image and creates a vtkProp3D object to insert into a 3D scene (e.g. a Viewer3D)");
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolydataToActor,bbtk::AtomicBlackBox);
+ BBTK_NAME("PolydataToActor");
+ BBTK_AUTHOR("eduardo.davila at creatis.insa-lyon.fr");
+ BBTK_DESCRIPTION("takes a vtkPolyData object to insert into a 3D scene (e.g. a Viewer3D)");
typedef std::vector<double> vectorcolour;
BBTK_CATEGORY("3D object creator");
- BBTK_INPUT(IsoSurfaceExtractor,In,"Input image",vtkImageData*,"");
- // BBTK_INPUT(IsoSurfaceExtractor,InVtkObject,"Image vtkObject",vtkObject*);
-
- BBTK_INPUT(IsoSurfaceExtractor,Isovalue,"Isovalue",double,"");
- BBTK_INPUT(IsoSurfaceExtractor,Opacity,"Opacity",double,"");
- BBTK_INPUT(IsoSurfaceExtractor,Colour,"r g b",vectorcolour,"colour");
- BBTK_INPUT(IsoSurfaceExtractor,Renderer,"3D scene in which to insert the surface",vtkRenderer*,"");
- BBTK_INPUT(IsoSurfaceExtractor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,"");
- BBTK_OUTPUT(IsoSurfaceExtractor,Out,"Extracted iso-surface",vtkProp3D *,"");
+ BBTK_INPUT(PolydataToActor,In,"Input image",vtkPolyData*,"");
+
+ BBTK_INPUT(PolydataToActor,Isovalue,"Isovalue",double,"");
+ BBTK_INPUT(PolydataToActor,Opacity,"Opacity",double,"");
+ BBTK_INPUT(PolydataToActor,Colour,"r g b",vectorcolour,"colour");
+ BBTK_INPUT(PolydataToActor,Renderer,"3D scene in which to insert the surface",vtkRenderer*,"");
+ BBTK_INPUT(PolydataToActor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,"");
+ BBTK_OUTPUT(PolydataToActor,Out,"Extracted iso-surface",vtkProp3D *,"");
- BBTK_END_DESCRIBE_BLACK_BOX(IsoSurfaceExtractor);
+ BBTK_END_DESCRIBE_BLACK_BOX(PolydataToActor);
}// EO namespace bbtk
-#endif //__IsoSurfaceExtractor_h__
+#endif //__PolydataToActor_h__
#endif //_USE_VTK_