Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2008/05/06 13:45:12 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2008/05/09 10:39:46 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
const std::string& descname)
{
// Try to release descriptor
- bbtkDebugMessage("package",3,"--- Trying to release descriptor '"
- <<descname<<"'"<<bbtkendl);
std::string packname = pack.lock()->GetName();
+ bbtkDebugMessage("package",5,"--- Releasing descriptor '"
+ <<packname<<"::"<<descname<<"'"<<bbtkendl);
+
+
Package::BlackBoxMapType::iterator desc =
pack.lock()->GetBlackBoxMap().find(descname);
if (desc == pack.lock()->GetBlackBoxMap().end())
{
- bbtkDebugMessage("package",3,
+ bbtkDebugMessage("package",5,
" Descriptor has already been released"
<<bbtkendl);
return;
// if it is dead : remove it
if (pdesc.expired())
{
- bbtkDebugMessage("package",2," '"<<packname<<"::"<<descname<<"' Descriptor expired"<<bbtkendl);
+ bbtkDebugMessage("package",2," ==> '"<<packname<<"::"<<descname<<"' Descriptor expired"<<bbtkendl);
if (pack.expired())
{
bbtkDebugMessage("package",2,
- " ... and caused its package death"
+ " ... and caused its package death"
<<bbtkendl);
return;
}
}
else
{
- bbtkDebugMessage("package",3," ... Descriptor still alive ("
+ bbtkDebugMessage("package",5," ... Descriptor still alive ("
<<pdesc.use_count()<<" refs)"
<<bbtkendl);
pack.lock()->GetBlackBoxMap()[descname] = pdesc.lock();
long ndesc = pack.lock()->GetBlackBoxMap().size();
long nrefs = pack.use_count();
- bbtkDebugMessage("package",2," "<<nrefs<<" refs / "
+ bbtkDebugMessage("package",5," "<<nrefs<<" refs / "
<<ndesc<<" descr / dyn="
<<dyn<<std::endl);
// and descallocated (reset) by PACKAGENAMEDeletePackage())
if (nrefs == ndesc + dyn)
{
- bbtkDebugMessage("package",2,
+ bbtkDebugMessage("package",5,
" -> No more external ref : checking descriptors"
<<bbtkendl);
// We must take care that removing refs on descriptors
// Is package still alive ?
if (pack.expired())
{
- bbtkDebugMessage("package",2,"--- Package::Release('"<<
+ bbtkDebugMessage("package",1,"--- Package::Release('"<<
packname
<<"') : package expired during release : bailing out"<<bbtkendl);
break;
}
- bbtkDebugMessage("package",1,"<== Package::Release('"<<
+ bbtkDebugMessage("package",2,"<== Package::Release('"<<
packname<<"')"<<bbtkendl);
if (!pack.expired())
{
}
else
{
- bbtkDebugMessage("package",1," ... Package has been released"
+ bbtkDebugMessage("package",1," ... Package has been released"
<<std::endl);
}
}
long ndesc = pack.lock()->GetBlackBoxMap().size();
long nrefs = pack.use_count();
- bbtkDebugMessage("package",3," "<<nrefs<<" refs / "
+ bbtkDebugMessage("package",5," "<<nrefs<<" refs / "
<<ndesc<<" descr / dynamically loaded = "
<<dyn<<std::endl);
// then put it in the static list mReleasedDynamicallyLoadedPackages
UnLoadDynamicLibrary(pack,false);
- bbtkDebugMessage("package",3,"<== Package::ReleaseBlackBoxDescriptor('"<<
+ bbtkDebugMessage("package",4,"<== Package::ReleaseBlackBoxDescriptor('"<<
packname<<"','"<<dname<<"'): refs="
<<descr.use_count()<<bbtkendl);
/*
p->SetDocURL(doc);
p->SetDocRelativeURL(reldoc);
- bbtkDebugMessage("package",1,"<== Package::CreateFromDynamicLibrary("
+ bbtkDebugMessage("package",2,"<== Package::CreateFromDynamicLibrary("
<<libname<<") .. OK"<<std::endl);
return p;
}
std::string packname = pack.lock()->GetName();
- bbtkDebugMessage("package",3,"==> Package::UnLoadDynamicLibrary('"
+ bbtkDebugMessage("package",5,"==> Package::UnLoadDynamicLibrary('"
<<packname<<"')"
<<std::endl);
if (!pack.lock()->GetBlackBoxMap().empty())
{
- bbtkDebugMessage("package",3," Package not empty ... abort"
+ bbtkDebugMessage("package",5," Package not empty ... abort"
<<std::endl);
return;
/*
if (doit)
{
UnLoad(pack);
- bbtkDebugMessage("package",3," ... dynamic library closed"
+ bbtkDebugMessage("package",5,"==> dynamic library for package '"
+ <<packname<<"' closed"
<<std::endl);
}
else
{
mReleasedDynamicallyLoadedPackages.insert(pack);
- bbtkDebugMessage("package",3,
- " ... package put in the 'to unload' list"
+ bbtkDebugMessage("package",1,"==> package '"<<packname
+ <<"' put in the 'to unload' list"
<<std::endl);
}
- bbtkDebugMessage("package",3,"<== Package::UnLoadDynamicLibrary('"
+ bbtkDebugMessage("package",5,"<== Package::UnLoadDynamicLibrary('"
<<packname<<"')"
<<std::endl);
/// see UnLoadDynamicLibrary and ReleaseBlackBoxDescriptor
void Package::UnLoadReleasedDynamicallyLoadedPackages()
{
- bbtkDebugMessage("package",2,"==> Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
+ bbtkDebugMessage("package",5,"==> Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
std::set<Package::WeakPointer>::iterator i;
for (i=mReleasedDynamicallyLoadedPackages.begin();
{
if (!i->expired()) UnLoad(*i);
}
- bbtkDebugMessage("package",2,"<== Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
+ bbtkDebugMessage("package",5,"<== Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
}
//==========================================================================
void Package::UnLoad(Package::WeakPointer pack)
{
std::string packname = pack.lock()->GetName();
- bbtkDebugMessage("package",2,"==> Package::UnLoad("<<packname<<")"<<std::endl);
+ bbtkDebugMessage("package",6,"==> Package::UnLoad("<<packname<<")"<<std::endl);
Package* p = pack.lock().get();
FreeLibrary(h);
#endif
- bbtkDebugMessage("package",2," ... dynamic library unloaded"<<std::endl);
+ bbtkDebugMessage("package",1,"==> dynamic library for package '"
+ <<packname<<"' closed"
+ <<std::endl);
+ bbtkDebugMessage("package",6," ... dynamic library unloaded"<<std::endl);
}
//==========================================================================
Program: bbtk
Module: $RCSfile: bbtkVtkBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2008/05/07 12:59:23 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/05/09 10:39:46 $
+ 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
#define BBTK_VTK_DELETE() \
void bbDelete() { \
bbGetOutputOut()->SetSource(NULL); \
- /* vtkParent::SetReferenceCount(0);*/ \
- bbmDescriptorPointer.reset(); \
vtkParent::Delete(); \
}
+// bbmDescriptorPointer.reset(); \
+
#define BBTK_VTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX,VTKPARENT) \
BBTK_BLACK_BOX_INTERFACE(CLASS,PARENTBLACKBOX); \
typedef VTKPARENT vtkParent; \
Program: bbtk
Module: $RCSfile: bbitkvtkitkImage2vtkImageData.cxx,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:50 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/05/09 10:39:46 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
typename ItkToVtkConnection::Pointer conv = ItkToVtkConnection::New();
conv->SetInput( this->bbGetInputIn().get<itkImageType*>() );
conv->Update();
- vtkImageData* o = vtkImageData::New();
- // o->SetReferenceCount(10);
- o->DeepCopy(conv->GetOutput());
-
- // o->Print(std::cout);
- if (bbGetOutputOut()) bbGetOutputOut()->Delete();
- bbSetOutputOut(o);
+ if (bbGetOutputOut()) bbGetOutputOut()->UnRegister(NULL);
+ bbSetOutputOut(conv->GetOutput());
+ // bbGetOutputOut()->DebugOn();
+ bbGetOutputOut()->Register(NULL);
+ bbGetOutputOut()->SetSource(NULL);
}
catch( itk::ExceptionObject & e)
{
<<bbtk::TypeName<T>()
<<">::Convert() : "<<e);
}
-
-
-
bbtkDebugDecTab("Core",9);
}
+ void itkImage2vtkImageData::bbUserConstructor()
+ {
+ bbSetOutputOut(NULL);
+ }
+ void itkImage2vtkImageData::bbUserCopyConstructor()
+ {
+ bbSetOutputOut(NULL);
+ }
+ void itkImage2vtkImageData::bbUserDestructor()
+ {
+ if (bbGetOutputOut())
+ {
+ bbGetOutputOut()->UnRegister(NULL);
+ }
+ }
}
Program: bbtk
Module: $RCSfile: bbitkvtkitkImage2vtkImageData.h,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:50 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/05/09 10:39:46 $
+ 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
BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
BBTK_PROCESS(Convert);
void Convert();
- void bbUserConstructor() { bbSetOutputOut(0); }
+ void bbUserConstructor();
+ void bbUserCopyConstructor();
+ void bbUserDestructor();
private:
// Convert method template on type of the itk image
// embedded in the input itkImage*
Program: bbtk
Module: $RCSfile: bbvtkImagePlanes.cxx,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:52 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/05/09 10:39:46 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
bbSetOutputPlaneX(planeWidgetX);
bbSetOutputPlaneY(planeWidgetY);
bbSetOutputPlaneZ(planeWidgetZ);
+
+ picker->UnRegister(NULL);
}
//---------------------------------------------------------------------
-
+ void ImagePlanes::bbUserDestructor()
+ {
+ planeWidgetX->Delete();
+ planeWidgetY->Delete();
+ planeWidgetZ->Delete();
+ }
+
void ImagePlanes::Process()
{
if (bbGetInputIn()!=0)
Program: bbtk
Module: $RCSfile: bbvtkImagePlanes.h,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:52 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ 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
protected:
virtual void bbUserConstructor();
virtual void bbUserCopyConstructor();
+ virtual void bbUserDestructor();
void Init();
private:
vtkImagePlaneWidget* planeWidgetX;
Program: bbtk
Module: $RCSfile: bbvtkIsoSurfaceExtractor.cxx,v $
Language: C++
- Date: $Date: 2008/04/24 12:56:41 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Init();
}
+ void IsoSurfaceExtractor::bbUserDestructor()
+ {
+ marchingcubes->Delete();
+ polydatamapper->Delete();
+ vtkactor->Delete();
+ }
+
void IsoSurfaceExtractor::Init()
{
firsttime=true;
- bbSetInputIn(NULL);
- // bbSetInputInVtkObject(NULL);
- bbSetInputRenderer(NULL);
+ bbSetInputIn(NULL);
+ // bbSetInputInVtkObject(NULL);
+ bbSetInputRenderer(NULL);
bbSetInputIsovalue(400);
bbSetInputOpacity(1);
- marchingcubes = vtkMarchingCubes::New();
+ marchingcubes = vtkMarchingCubes::New();
polydatamapper = vtkPolyDataMapper::New();
- vtkactor = vtkActor::New();
+ vtkactor = vtkActor::New();
polydatamapper->SetInput(marchingcubes->GetOutput());
vtkactor->SetMapper(polydatamapper);
marchingcubes->SetValue(0, bbGetInputIsovalue() );
marchingcubes->Update();
- vtkactor->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] );
+ vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
+ bbGetInputColour()[1],
+ bbGetInputColour()[2] );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
Program: bbtk
Module: $RCSfile: bbvtkIsoSurfaceExtractor.h,v $
Language: C++
- Date: $Date: 2008/04/24 14:11:31 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
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(Renderer,vtkRenderer *);
BBTK_DECLARE_OUTPUT(Out,vtkProp3D *);
BBTK_PROCESS(DoProcess);
protected:
virtual void bbUserConstructor();
virtual void bbUserCopyConstructor();
+ virtual void bbUserDestructor();
void Init();
};
Program: bbtk
Module: $RCSfile: bbvtkMIPCreator.cxx,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:52 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
bbSetOutputOut(mVolume);
}
+ void MIPCreator::bbUserDestructor()
+ {
+ mCast->Delete();
+ mMIP->Delete();
+ mMapper->Delete();
+ mVolume->Delete();
+
+ }
//---------------------------------------------------------------------
void MIPCreator::Process()
Program: bbtk
Module: $RCSfile: bbvtkMIPCreator.h,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:52 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ 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
protected:
virtual void bbUserConstructor();
virtual void bbUserCopyConstructor();
+ virtual void bbUserDestructor();
void Init();
private:
vtkImageShiftScale* mCast;
<process><PRE>
SetFileName(bbGetInputIn().c_str());
vtkParent::Update();
- // We need to disconnect the output image from its source or the
- // vtk object will not be deleted as it
- // will be referenced by its output image
-// bbGetOutputOut()->SetSource(NULL);
</PRE></process>
</blackbox>
Program: bbtk
Module: $RCSfile: bbvtkSegmentationConnectivity.cxx,v $
Language: C++
- Date: $Date: 2008/04/24 14:11:31 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace bbvtk
{
- BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,SegmentationConnectivity)
- BBTK_BLACK_BOX_IMPLEMENTATION(SegmentationConnectivity,bbtk::AtomicBlackBox);
-
-
- void SegmentationConnectivity::bbUserConstructor()
- {
- bbSetInputIn(NULL);
- std::vector<int> position;
- position.push_back(0);
- position.push_back(0);
- position.push_back(0);
- bbSetInputPositionXYZ(position);
- std::vector<int> threshold;
- threshold.push_back(0);
- threshold.push_back(0);
- bbSetInputThresholdMinMax(threshold);
- bbSetOutputOut(NULL);
- thresh2 = vtkImageThreshold::New();
- thresh2->SetInValue(255);
- thresh2->SetOutputScalarTypeToUnsignedShort();
- thresh2->SetOutValue(0);
- cast2 = vtkImageCast::New();
- cast2->SetInput(thresh2->GetOutput());
- cast2->SetOutputScalarTypeToUnsignedChar();
- connect2 = vtkImageSeedConnectivity::New();
- connect2->SetInput(cast2->GetOutput());
- connect2->SetInputConnectValue(255);
- connect2->SetOutputConnectedValue(255);
- connect2->SetOutputUnconnectedValue(0);
- cast4 = vtkImageCast::New();
- cast4->SetInput(connect2->GetOutput());
- cast4->SetOutputScalarTypeToUnsignedShort();
- }
-
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,SegmentationConnectivity);
+ BBTK_BLACK_BOX_IMPLEMENTATION(SegmentationConnectivity,
+ bbtk::AtomicBlackBox);
+
+
+ void SegmentationConnectivity::bbUserConstructor()
+ {
+ bbSetInputIn(NULL);
+ std::vector<int> position;
+ position.push_back(0);
+ position.push_back(0);
+ position.push_back(0);
+ bbSetInputPositionXYZ(position);
+ std::vector<int> threshold;
+ threshold.push_back(0);
+ threshold.push_back(0);
+ bbSetInputThresholdMinMax(threshold);
+ bbSetOutputOut(NULL);
+ thresh2 = vtkImageThreshold::New();
+ thresh2->SetInValue(255);
+ thresh2->SetOutputScalarTypeToUnsignedShort();
+ thresh2->SetOutValue(0);
+ cast2 = vtkImageCast::New();
+ cast2->SetInput(thresh2->GetOutput());
+ cast2->SetOutputScalarTypeToUnsignedChar();
+ connect2 = vtkImageSeedConnectivity::New();
+ connect2->SetInput(cast2->GetOutput());
+ connect2->SetInputConnectValue(255);
+ connect2->SetOutputConnectedValue(255);
+ connect2->SetOutputUnconnectedValue(0);
+ cast4 = vtkImageCast::New();
+ cast4->SetInput(connect2->GetOutput());
+ cast4->SetOutputScalarTypeToUnsignedShort();
+ }
+
+
+ void SegmentationConnectivity::bbUserDestructor()
+ {
+ thresh2->Delete();
+ cast2->Delete();
+ connect2->Delete();
+ cast4->Delete();
+ }
void SegmentationConnectivity::DoProcess()
{
- vtkImageData *imagedata = bbGetInputIn();
- imagedata->UpdateInformation();
- imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
- imagedata->Update();
- thresh2->ThresholdBetween(3000, 3001);
- thresh2->SetInput(imagedata);
- thresh2->ThresholdBetween(bbGetInputThresholdMinMax()[0], bbGetInputThresholdMinMax()[1]);
- thresh2->Update();
- cast2->Update();
- connect2->RemoveAllSeeds ();
- connect2->AddSeed( bbGetInputPositionXYZ()[0] , bbGetInputPositionXYZ()[1] , bbGetInputPositionXYZ()[2] );
- connect2->Update();
- cast4->Update();
-
+ vtkImageData *imagedata = bbGetInputIn();
+ imagedata->UpdateInformation();
+ imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
+ imagedata->Update();
+ thresh2->ThresholdBetween(3000, 3001);
+ thresh2->SetInput(imagedata);
+ thresh2->ThresholdBetween(bbGetInputThresholdMinMax()[0], bbGetInputThresholdMinMax()[1]);
+ thresh2->Update();
+ cast2->Update();
+ connect2->RemoveAllSeeds ();
+ connect2->AddSeed( bbGetInputPositionXYZ()[0] , bbGetInputPositionXYZ()[1] , bbGetInputPositionXYZ()[2] );
+ connect2->Update();
+ cast4->Update();
+
bbSetOutputOut(cast4->GetOutput() );
}
-
+
}// EO namespace bbvtk
Program: bbtk
Module: $RCSfile: bbvtkSegmentationConnectivity.h,v $
Language: C++
- Date: $Date: 2008/04/24 14:11:31 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
protected:
virtual void bbUserConstructor();
+ virtual void bbUserDestructor();
private:
vtkImageCast *cast2;
set viewer.WinTitle "ExampleSimpleSlicer"
set viewer.WinWidth 350
set viewer.WinHeight 400
-set viewer.Slice 20
+# Crashes ! why ?
+#set viewer.Slice 20
exec viewer
Program: bbtk
Module: $RCSfile: bbwxvtkViewer2D.cxx,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:53 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ 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
Viewer2DWidget::~Viewer2DWidget()
{
+ // delete wxvtkrenderwindowinteractor;
+ // pourquoi pas wxvtkrenderwindowinteractor->Delete(); // JP
+ // LG : because it has been allocated with operator new not method ::New
+ // we want to force its destruction without taking care of vtk ref counting
+ // on the contrary the following vtk objects are deleted with vtk Delete
+ if (backImageData)
+ {
+ backImageData->UnRegister(NULL);
+ }
+ if (imageViewer)
+ {
+ imageViewer->Delete();
+ }
delete wxvtkrenderwindowinteractor;
-// pourquoi pas wxvtkrenderwindowinteractor->Delete(); // JP
}
//-------------------------------------------------------------------------
void Viewer2DWidget::UpdateView()
{
-
- if (imageViewer==NULL){
- imageViewer = vtkImageViewer2::New();
- imageViewer->SetupInteractor ( wxvtkrenderwindowinteractor );
- }
-
- // Viewer2D* mbbtkViewer2D = (Viewer2D*)GetBlackBox();
-
-
-
- // imageViewer->SetSliceOrientation(((Viewer2D*)GetBlackBox())->bbGetInputOrientation());
-
-
- if ( backImageData != mBox->bbGetInputIn() )
+ std::cout << "Viewer2DWidget::UpdateView()" << std::endl;
+ std::cout << "slice="<<mBox->bbGetInputSlice()<<std::endl;
+ if ( (mBox->bbGetInputIn()!=NULL) &&
+ (backImageData != mBox->bbGetInputIn()) )
{
+ if (imageViewer==NULL)
+ {
+ imageViewer = vtkImageViewer2::New();
+ imageViewer->SetupInteractor ( wxvtkrenderwindowinteractor );
+ }
+
+ if (backImageData) backImageData->UnRegister(NULL);
backImageData = mBox->bbGetInputIn();
+ backImageData->Register(NULL);
imageViewer->SetInput( backImageData );
backImageData->Update();
+
int x1,x2,y1,y2,z1,z2;
double spx,spy,spz;
backImageData->GetSpacing(spx,spy,spz);
// mBox->bbIsShown() is necessary to be sure that the wxWindow is already
// created and displayed.
// Else when slice != 0 we get an X Window System error with wxGTK
- if ((backImageData!=NULL)&&(mBox->bbIsShown()))
+ if ((imageViewer!=NULL)&&
+ (backImageData!=NULL)&&
+ (mBox->bbIsShown()))
{
int z = mBox->bbGetInputSlice();
- // std::cout << "slice = "<<z<<std::endl;
+ std::cout << "slice = "<<z<<std::endl;
int ext[6];
backImageData->GetWholeExtent(ext);
- // std::cout << "ext = "<<ext[4]<<" - "<<ext[5]<<std::endl;
+ std::cout << "ext = "<<ext[4]<<" - "<<ext[5]<<std::endl;
if (z<ext[4]) { z=ext[4]; }
if (z>=ext[5]) { z=ext[5]-1; }
// LG : SetZSlice does not exist anymore in vtk 5 !
+ /*
+#if (VTK_MAJOR_VERSION >= 5)
+ imageViewer->SetSlice( 0 );
+#else
+ imageViewer->SetZSlice( 0 );
+#endif
+
+
+
+ wxvtkrenderwindowinteractor->Render();
+ */
#if (VTK_MAJOR_VERSION >= 5)
imageViewer->SetSlice( z );
#else
imageViewer->SetZSlice( z );
#endif
-
+ wxvtkrenderwindowinteractor->Render();
}
-
- wxvtkrenderwindowinteractor->Render();
- // wxvtkrenderwindowinteractor->Refresh();
+
//Refresh();
void Viewer2D::Process()
{
+ // LG : Bug when initial slice != 0 on first time
+ // (see wxvtk/appli/ExampleSimpleSlicer)
+ // I think there is a problem with rendering before window
+ // has been reparented ... we have to check this
+
((Viewer2DWidget*)bbGetOutputWidget())->UpdateView();
bbSetOutputOut( bbGetInputSlice() );
}
Program: bbtk
Module: $RCSfile: bbwxvtkViewer3D.cxx,v $
Language: C++
- Date: $Date: 2008/05/07 12:59:23 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "bbwxvtkPackage.h"
#include "vtkCamera.h"
-#include "vtkInteractorStyleTrackballCamera.h"
renderwindow->AddRenderer(renderer);
wxvtkrenderwindowinteractor->SetRenderWindow(renderwindow);
- vtkInteractorStyleTrackballCamera *interactorstyle = vtkInteractorStyleTrackballCamera ::New();
+ interactorstyle = vtkInteractorStyleTrackballCamera ::New();
interactorstyle->SetInteractor ( wxvtkrenderwindowinteractor );
wxvtkrenderwindowinteractor->SetInteractorStyle( interactorstyle );
//-------------------------------------------------------------------------
Viewer3DWidget::~Viewer3DWidget()
{
- wxvtkrenderwindowinteractor->Delete();
+ renderwindow->Delete();
+ renderer->Delete();
+ interactorstyle->Delete();
+ delete wxvtkrenderwindowinteractor;
}
//-------------------------------------------------------------------------
Program: bbtk
Module: $RCSfile: bbwxvtkViewer3D.h,v $
Language: C++
- Date: $Date: 2008/04/18 12:59:53 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
+#include <vtkInteractorStyleTrackballCamera.h>
#include "bbtkWxBlackBox.h"
#include "wxVTKRenderWindowInteractor.h"
+
namespace bbwxvtk
{
class Viewer3D;
Viewer3D *mBox;
vtkRenderer *renderer;
vtkRenderWindow *renderwindow;
+ vtkInteractorStyleTrackballCamera *interactorstyle;
wxVTKRenderWindowInteractor *wxvtkrenderwindowinteractor;
};
Program: Visualization Toolkit
Module: $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
Language: C++
- Date: $Date: 2008/03/03 13:14:28 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/05/09 10:39:47 $
+ Version: $Revision: 1.2 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
wxVTKRenderWindowInteractor::~wxVTKRenderWindowInteractor()
{
// LG : trompe la mort !
+ SetRenderWindow(NULL);
SetReferenceCount(0);
}
//---------------------------------------------------------------------------