Program: bbtk
Module: $RCSfile: bbwxvtkViewer2D.cxx,v $
Language: C++
- Date: $Date: 2008/12/09 12:54:07 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2008/12/09 15:25:08 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace bbwxvtk
{
- BBTK_ADD_BLACK_BOX_TO_PACKAGE(wxvtk,Viewer2D);
+
+ //--------------------------------------------------------------------------
+ class Viewer2DWidget : public wxPanel
+ {
+ public:
+ Viewer2DWidget(Viewer2D* box, wxWindow *parent);
+ ~Viewer2DWidget();
+ void UpdateView();
+ vtkRenderer *GetRenderer();
+ private:
+ bool mFirstTime;
+ Viewer2D *mBox;
+ wxvtkImageViewer2 *imageViewer;
+ vtkImageData *backImageData;
+ vtkImageData *mDefaultImage;
+ wxVTKRenderWindowInteractor *wxvtkrenderwindowinteractor;
+ bool mUpdateCamera;
+
+ vtkImplicitPlaneWidget * maPlane1, * maPlane2, * mbPlane1, * mbPlane2;
+ };
+
Viewer2DWidget::Viewer2DWidget(Viewer2D* box,
wxWindow *parent)
:
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mFirstTime(true),
mBox(box)
{
wxPanel *panel = this;
void Viewer2DWidget::UpdateView()
{
- // std::cout << "Viewer2DWidget::UpdateView() "<<mBox->bbGetFullName() << std::endl;
+ // std::cout << "Viewer2DWidget::UpdateView() " << std::endl;
// std::cout << "slice="<<mBox->bbGetInputSlice()<<std::endl;
( backImageData != mDefaultImage ) )
{
//
- // std::cout << "** Viewer2DWidget::UpdateView() : NULL Input (reset)"
- // <<std::endl;
+ // std::cout << "** Viewer2DWidget::UpdateView() : NULL Input (reset)" <<std::endl;
backImageData = mDefaultImage;
mUpdateCamera = true;
}
else if ( ( mBox->bbGetInputIn() != NULL ) &&
- ( mBox->bbGetInputStatus("In") != bbtk::UPTODATE )
+ (( mBox->bbGetInputStatus("In") != bbtk::UPTODATE ) ||
+ ( mFirstTime))
)
//(backImageData != mBox->bbGetInputIn()) )
{
- // std::cout << "** Viewer2DWidget::UpdateView() : Input changed"
- // <<std::endl;
+
+ // std::cout << "** Viewer2DWidget::UpdateView() : Input changed" <<std::endl;
+ mFirstTime = false;
backImageData = mBox->bbGetInputIn();
backImageData->Update();
imageViewer->SetInput( backImageData );
//--------------------------------------------------------------------------
-
-
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wxvtk,Viewer2D);
BBTK_BLACK_BOX_IMPLEMENTATION(Viewer2D,bbtk::WxBlackBox);
void Viewer2D::Process()
{
+ // std::cout << "Viewer2D::Process" << std::endl;
+ // std::cout << "In="<<bbtk::GetIOStatusString(bbGetInputStatus("In")) << std::endl;
+ // std::cout << "Slice="<<bbtk::GetIOStatusString(bbGetInputStatus("Slice")) << std::endl;
Viewer2DWidget* w = (Viewer2DWidget*)bbGetOutputWidget();
if (w)
- {
+ {
w->UpdateView();
- bbSetOutputRenderer( ((Viewer2DWidget*)bbGetOutputWidget())->GetRenderer() );
}
bbSetOutputOut( bbGetInputSlice() );
bbSetInputIn(NULL);
bbSetInputSlice(0);
bbSetOutputWidget(0);
+ bbSetOutputRenderer(0);
bbSetInputOrientation(2);
}
- /**
- * \brief Create wxWidget .
- *
- *
- */
+
void Viewer2D::CreateWidget(wxWindow* parent)
{
- Viewer2DWidget* w = new Viewer2DWidget(this,parent);//bbGetWxParent());
+ Viewer2DWidget* w = new Viewer2DWidget(this,parent);
+ w->UpdateView();
bbSetOutputWidget(w);
+ bbSetOutputRenderer( ((Viewer2DWidget*)bbGetOutputWidget())->GetRenderer() );
+
}
// when window is shown
void Viewer2D::OnShowWidget()
{
- // ((Viewer2DWidget*)bbGetOutputWidget())->Update();
- // ((Viewer2DWidget*)bbGetOutputWidget())->UpdateView();
}
Program: bbtk
Module: $RCSfile: bbwxvtkViewer2D.h,v $
Language: C++
- Date: $Date: 2008/12/08 12:56:17 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2008/12/09 15:25:08 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace bbwxvtk
{
- class Viewer2D;
-
- //--------------------------------------------------------------------------
- class Viewer2DWidget : public wxPanel
- {
- public:
- Viewer2DWidget(Viewer2D* box, wxWindow *parent);
- ~Viewer2DWidget();
- void UpdateView();
- vtkRenderer *GetRenderer();
- private:
- Viewer2D *mBox;
- wxvtkImageViewer2 *imageViewer;
- vtkImageData *backImageData;
- vtkImageData *mDefaultImage;
- wxVTKRenderWindowInteractor *wxvtkrenderwindowinteractor;
- bool mUpdateCamera;
-
- vtkImplicitPlaneWidget * maPlane1, * maPlane2, * mbPlane1, * mbPlane2;
- };
-
//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------