)
-
IF(BBTK_USE_WXWIDGETS AND WIN32)
ADD_EXECUTABLE(bbi WIN32 ${SOURCES})
SET_TARGET_PROPERTIES(bbi PROPERTIES LINK_FLAGS /subsystem:console )
// WINDOWS
//==========================================================================
IMPLEMENT_APP(wxBBIApp);
+
// How to have a Console and wxWidgets
// http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
// In Visual C++ 6 (7 should be similar), to create an application that is both a console application
// you need to use the linker option "/subsystem:console" and the following code:
int main(int argc, char* argv[])
{
- return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
+ return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
}
#else
int main(int argc, char* argv[])
{
-
if (argc>2)
{
std::cout << "usage : "<<argv[0]<<" [filename]"<<std::endl;
Program: bbtk
Module: $RCSfile: bbtkSystem.h,v $
Language: C++
- Date: $Date: 2008/11/12 12:47:01 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2008/11/20 17:41:41 $
+ Version: $Revision: 1.11 $
=========================================================================*/
/* ---------------------------------------------------------------------
#endif
#endif
+
+
+//----------------------------
+#ifndef _WIN32
+#include <unistd.h> //for access, unlink
+#else
+#include <io.h> //for _access on Win32
+#endif
+
+#ifdef _MSC_VER
+# define access _access
+#endif
Program: bbtk
Module: $RCSfile: bbvtkIsoSurfaceExtractor.cxx,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:30 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/11/20 17:41:48 $
+ Version: $Revision: 1.8 $
=========================================================================*/
/* ---------------------------------------------------------------------
colour.push_back(1.0);
colour.push_back(0.5);
bbSetInputColour(colour);
-
+ bbSetInputTransform(NULL);
}
void IsoSurfaceExtractor::bbUserCopyConstructor()
{
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
+ if ( bbGetInputTransform()!=NULL )
+ {
+ vtkactor->SetUserTransform( bbGetInputTransform() );
+ }
+
bbSetOutputOut( vtkactor );
// Interface Update
Program: bbtk
Module: $RCSfile: bbvtkIsoSurfaceExtractor.h,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:30 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2008/11/20 17:41:48 $
+ Version: $Revision: 1.10 $
=========================================================================*/
/* ---------------------------------------------------------------------
BBTK_DECLARE_INPUT(Opacity,double);
BBTK_DECLARE_INPUT(Colour,std::vector<double>);
BBTK_DECLARE_INPUT(Renderer,vtkRenderer *);
+ BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *);
BBTK_DECLARE_OUTPUT(Out,vtkProp3D *);
BBTK_PROCESS(DoProcess);
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_END_DESCRIBE_BLACK_BOX(IsoSurfaceExtractor);
--- /dev/null
+#include "bbvtkVecImageGaussianSmooth.h"
+#include "bbvtkPackage.h"
+
+#include "vtkImageGaussianSmooth.h"
+
+
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,VecImageGaussianSmooth)
+BBTK_BLACK_BOX_IMPLEMENTATION(VecImageGaussianSmooth,bbtk::AtomicBlackBox);
+void VecImageGaussianSmooth::Process()
+{
+
+ vtkImageGaussianSmooth *vtkimagegaussiansmooth;
+ int i,size = VecVtkimagegaussiansmooth.size();
+ for (i=0 ; i<size ; i++)
+ {
+ VecVtkimagegaussiansmooth[i]->Delete();
+ }
+ VecVtkimagegaussiansmooth.clear();
+ VecResult.clear();
+
+ double stdvX=bbGetInputStdDevX();
+ double stdvY=bbGetInputStdDevY();
+ double stdvZ=bbGetInputStdDevZ();
+
+ size=bbGetInputIn().size();
+ for (i=0 ; i<size ; i++)
+ {
+ vtkimagegaussiansmooth = vtkImageGaussianSmooth::New();
+ vtkimagegaussiansmooth->SetInput( bbGetInputIn()[i] );
+ vtkimagegaussiansmooth->SetStandardDeviation( stdvX,stdvY, stdvZ );
+ vtkimagegaussiansmooth->Update();
+ VecResult.push_back( vtkimagegaussiansmooth->GetOutput() );
+ VecVtkimagegaussiansmooth.push_back(vtkimagegaussiansmooth);
+ } //for i
+ bbSetOutputOut(VecResult);
+ if (bbGetInputiImage() < VecResult.size())
+ {
+ bbSetOutputOutImage(VecResult[bbGetInputiImage()]);
+ } //if
+
+}
+
+void VecImageGaussianSmooth::bbUserConstructor()
+{
+
+ bbSetInputStdDevX(2);
+ bbSetInputStdDevY(2);
+ bbSetInputStdDevZ(2);
+
+ bbSetInputiImage(0);
+
+}
+
+void VecImageGaussianSmooth::bbUserCopyConstructor()
+{
+}
+
+void VecImageGaussianSmooth::bbUserDestructor()
+{
+}
+
+}
+// EO namespace bbvtk
+
+
--- /dev/null
+#ifndef __bbvtkVecImageGaussianSmooth_h_INCLUDED__
+#define __bbvtkVecImageGaussianSmooth_h_INCLUDED__
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageGaussianSmooth.h"
+#include "vtkImageData.h"
+#include <vector>
+
+namespace bbvtk
+{
+
+class /*BBTK_EXPORT*/ VecImageGaussianSmooth
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(VecImageGaussianSmooth,bbtk::AtomicBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(In,std::vector<vtkImageData*>);
+ BBTK_DECLARE_INPUT(StdDevX,double);
+ BBTK_DECLARE_INPUT(StdDevY,double);
+ BBTK_DECLARE_INPUT(StdDevZ,double);
+ BBTK_DECLARE_INPUT(iImage,int);
+ BBTK_DECLARE_OUTPUT(Out,std::vector<vtkImageData*>);
+ BBTK_DECLARE_OUTPUT(OutImage,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ std::vector<vtkImageGaussianSmooth *> VecVtkimagegaussiansmooth;
+ std::vector<vtkImageData*> VecResult;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(VecImageGaussianSmooth,bbtk::AtomicBlackBox);
+BBTK_NAME("VecImageGaussianSmooth");
+BBTK_AUTHOR("InfoTeam CREATIS-LRMN");
+BBTK_DESCRIPTION("Vector of ImageGaussianSmooth");
+BBTK_CATEGORY("filter");
+
+
+BBTK_INPUT(VecImageGaussianSmooth,In,"Vector of input images",std::vector<vtkImageData*>,"");
+BBTK_INPUT(VecImageGaussianSmooth,StdDevX,"Standard deviation in direction X",double,"");
+BBTK_INPUT(VecImageGaussianSmooth,StdDevY,"Standard deviation in direction Y",double,"");
+BBTK_INPUT(VecImageGaussianSmooth,StdDevZ,"Standard deviation in direction Z",double,"");
+BBTK_INPUT(VecImageGaussianSmooth,iImage,"iImage ",int,"");
+BBTK_OUTPUT(VecImageGaussianSmooth,Out,"Vector of output images",std::vector<vtkImageData*>,"");
+BBTK_OUTPUT(VecImageGaussianSmooth,OutImage,"Image[iImage]",vtkImageData*,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(VecImageGaussianSmooth);
+}
+// EO namespace bbvtk
+
+#endif // __bbvtkVecImageGaussianSmooth_h_INCLUDED__
+
--- /dev/null
+#include "bbvtkVecIsoSurfaceExtractor.h"
+#include "bbvtkPackage.h"
+
+#include "vtkProperty.h"
+
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,VecIsoSurfaceExtractor)
+BBTK_BLACK_BOX_IMPLEMENTATION(VecIsoSurfaceExtractor,bbtk::AtomicBlackBox);
+void VecIsoSurfaceExtractor::Process()
+{
+ double r,g,b;
+ vtkMarchingCubes *marchingcubes;
+ vtkPolyDataMapper *polydatamapper;
+ vtkActor *vtkactor;
+
+ int i,size;
+
+
+ size = VecVtkactor.size();
+ for( i=0 ; i<size ; i++)
+ {
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->RemoveActor( VecVtkactor[i] );
+ VecMarchingcubes[i]->Delete();
+ VecPolydatamapper[i]->Delete();
+ VecVtkactor[i]->Delete();
+ }
+ }
+ VecMarchingcubes.clear();
+ VecPolydatamapper.clear();
+ VecVtkactor.clear();
+
+
+ size = bbGetInputIn().size();
+ for( i=0 ; i<size ; i++){
+ marchingcubes = vtkMarchingCubes::New();
+ polydatamapper = vtkPolyDataMapper::New();
+ vtkactor = vtkActor::New();
+
+ polydatamapper->SetInput(marchingcubes->GetOutput());
+ vtkactor->SetMapper(polydatamapper);
+
+ polydatamapper->ScalarVisibilityOff();
+ polydatamapper->ImmediateModeRenderingOn();
+
+ VecMarchingcubes.push_back(marchingcubes);
+ VecPolydatamapper.push_back(polydatamapper);
+ VecVtkactor.push_back(vtkactor);
+ } // for i
+
+
+ for( i=0 ; i<size ; i++){
+ // Visualisation - result volume
+ marchingcubes=VecMarchingcubes[i];
+ vtkactor=(vtkActor*)VecVtkactor[i];
+
+ marchingcubes->SetInput( bbGetInputIn()[i] );
+ marchingcubes->SetValue(0, bbGetInputIsovalue() );
+ marchingcubes->Update();
+
+ if ( (i*3+1)<bbGetInputColour().size() ){
+ r = bbGetInputColour()[0+i*3];
+ g = bbGetInputColour()[1+i*3];
+ b = bbGetInputColour()[2+i*3];
+ } else {
+ r = bbGetInputColour()[0];
+ g = bbGetInputColour()[1];
+ b = bbGetInputColour()[2];
+ }
+ vtkactor->GetProperty()->SetColor( r,g,b );
+
+ vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
+ if ( bbGetInputTransform()!=NULL )
+ {
+ vtkactor->SetUserTransform( bbGetInputTransform() );
+ }
+
+ // Interface Update
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->AddActor( vtkactor );
+ }
+ } // for i
+
+
+ bbSetOutputOut( VecVtkactor );
+}
+
+void VecIsoSurfaceExtractor::bbUserConstructor()
+{
+ Init();
+ std::vector<double> colour;
+ // 1- red
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ // 2- blue
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ // 3- yellow
+ colour.push_back(1.0);
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ // 4- green
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ // 5-
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ colour.push_back(1.0);
+
+ // 6-
+ colour.push_back(0.5);
+ colour.push_back(0.5);
+ colour.push_back(0.5);
+
+
+ bbSetInputColour(colour);
+ bbSetInputTransform(NULL);
+}
+
+void VecIsoSurfaceExtractor::bbUserCopyConstructor()
+{
+ Init();
+}
+
+void VecIsoSurfaceExtractor::bbUserDestructor()
+{
+ int i,size = VecMarchingcubes.size();
+ for (i=0;i<size;i++)
+ {
+ VecMarchingcubes[i]->Delete();
+ VecPolydatamapper[i]->Delete();
+ VecVtkactor[i]->Delete();
+ }
+ VecMarchingcubes.clear();
+ VecPolydatamapper.clear();
+ VecVtkactor.clear();
+}
+
+
+void VecIsoSurfaceExtractor::Init()
+{
+// bbSetInputIn(NULL);
+ // bbSetInputInVtkObject(NULL);
+ bbSetInputRenderer(NULL);
+ bbSetInputIsovalue(128);
+ bbSetInputOpacity(1);
+
+}
+
+
+}
+// EO namespace bbvtk
+
+
--- /dev/null
+#ifndef __bbvtkVecIsoSurfaceExtractor_h_INCLUDED__
+#define __bbvtkVecIsoSurfaceExtractor_h_INCLUDED__
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+#include "vtkRenderer.h"
+#include "vtkMarchingCubes.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkProp3D.h"
+#include "vtkActor.h"
+#include <vector>
+
+
+namespace bbvtk
+{
+
+class /*BBTK_EXPORT*/ VecIsoSurfaceExtractor
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(VecIsoSurfaceExtractor,bbtk::AtomicBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(In,std::vector<vtkImageData*>);
+ // BBTK_DECLARE_INPUT(InVtkObject,vtkObject *);
+ BBTK_DECLARE_INPUT(Isovalue,double);
+ BBTK_DECLARE_INPUT(Opacity,double);
+ BBTK_DECLARE_INPUT(Colour,std::vector<double>);
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer *);
+ BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *);
+ BBTK_DECLARE_OUTPUT(Out,std::vector<vtkProp3D*>);
+ BBTK_PROCESS(Process);
+ void Process();
+
+// virtual void bbUserConstructor();
+// virtual void bbUserCopyConstructor();
+// virtual void bbUserDestructor();
+ void Init();
+
+ std::vector<vtkMarchingCubes*> VecMarchingcubes;
+ std::vector<vtkPolyDataMapper*> VecPolydatamapper;
+ std::vector<vtkProp3D*> VecVtkactor;
+
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(VecIsoSurfaceExtractor,bbtk::AtomicBlackBox);
+BBTK_NAME("VecIsoSurfaceExtractor");
+BBTK_AUTHOR("InfoTeam CREATIS-LRMN");
+BBTK_DESCRIPTION("Vector of IsoSurfaceExtractor");
+ BBTK_CATEGORY("3D object creator");
+ BBTK_INPUT(VecIsoSurfaceExtractor,In,"Input image",std::vector<vtkImageData*>,"");
+ // BBTK_INPUT(IsoSurfaceExtractor,InVtkObject,"Image vtkObject",vtkObject*);
+ BBTK_INPUT(VecIsoSurfaceExtractor,Isovalue,"Isovalue",double,"");
+ BBTK_INPUT(VecIsoSurfaceExtractor,Opacity,"Opacity",double,"");
+ BBTK_INPUT(VecIsoSurfaceExtractor,Colour,"r g b",std::vector<double>,"colour");
+ BBTK_INPUT(VecIsoSurfaceExtractor,Renderer,"3D scene in which to insert the surface",vtkRenderer*,"");
+ BBTK_INPUT(VecIsoSurfaceExtractor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,"");
+ BBTK_OUTPUT(VecIsoSurfaceExtractor,Out,"Extracted iso-surface",std::vector<vtkProp3D*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(VecIsoSurfaceExtractor);
+}
+// EO namespace bbvtk
+
+#endif // __bbvtkVecIsoSurfaceExtractor_h_INCLUDED__
+