--- /dev/null
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#include "bbcreaMaracasVisuManualPaint.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+
+vtkInteractorManualPaint::vtkInteractorManualPaint()
+{
+ _state = false;
+ _image = NULL;
+ _auxZ = 0;
+}
+
+//---------------------------------------------------------------------------
+vtkInteractorManualPaint::~vtkInteractorManualPaint()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonDown()
+{
+ vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+ if ((interactor->GetControlKey()==1) || (interactor->GetShiftKey()==1) ){
+ _state = true;
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ _Z = wxvtk2Dbaseview->GetActualSlice();
+// _sliceZ = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetActualSlice();
+ }
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonUp()
+{
+ _state = false;
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnMouseMove ()
+{
+ printf("EED vtkInteractorManualPaint::OnMouseMove \n");
+ if (_state==true)
+ {
+ int px,py;
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+
+ wxVTKiren->GetEventPosition(px,py);
+
+ double X = (double)px;
+ double Y = (double)py;
+ double Z = _Z;
+ int typeView = 2;
+ wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,false, typeView);
+
+// int px = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+// int py = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ printf("EED vtkInteractorManualPaint::OnMouseMove ----------------- %f %f %f\n", X,Y,Z);
+
+ PaintImage((int)X,(int)Y,(int)Z);
+
+ wxvtk2Dbaseview->Refresh();
+ wxvtk2Dbaseview->RefreshView();
+// wxvtk2Dbaseview->SetActualSlice(_Z+_auxZ);
+ _auxZ=(_auxZ+1)%2;
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->Render();
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+// wxvtk2Dbaseview->SetActualSlice(Z);
+ }// if _state
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorManualPaint::SetImage(vtkImageData *image)
+{
+ _image = image;
+}
+
+
+void vtkInteractorManualPaint::PaintImage(int px,int py, int pz)
+{
+ if (_image!=NULL)
+ {
+ float value=0;
+ printf("EED vtkInteractorManualPaint::PaintImage %d %d %d\n", px,py,pz);
+ _image->SetScalarComponentFromFloat (px,py,pz, 0, value );
+ _image->Modified();
+ } else {
+ printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
+ }
+}
+
+
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint,bbtk::WxBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::Process()
+{
+
+/*
+ std::string msg;
+ if (bbGetInputTitle()!="")
+ {
+ msg = bbGetInputTitle()+": " + bbGetInputIn();
+ }
+ else
+ {
+ msg = bbGetInputIn();
+ }
+ ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
+ */
+
+ if (bbGetInputWxVtkBaseView()==NULL)
+ {
+ printf("WARNING : package creaMaracasVisu box ManualPaint : input WxVtkBaseView have to be defferent of NULL\n");
+ }
+
+ if (bbGetInputIn()==NULL)
+ {
+ printf("WARNING : package creaMaracasVisu box ManualPaint : input In (vtkImageData*) have to be defferent of NULL\n");
+ }
+
+
+ if (imp==NULL)
+ {
+ imp=new vtkInteractorManualPaint();
+ imp->SetImage( bbGetInputIn() );
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(bbGetInputWxVtkBaseView()->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(imp);
+ }
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::CreateWidget(wxWindow* parent)
+{
+
+ bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("UPS") ) );
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserSetDefaultValues()
+{
+ imp=NULL;
+ bbSetInputIn(NULL);
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserInitializeProcessing()
+{
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserFinalizeProcessing()
+{
+
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "wxVtkBaseView.h"
+#include "vtkImageData.h"
+
+#include "InteractorStyleMaracas.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+
+class vtkInteractorManualPaint : public InteractorStyleMaracas {
+public:
+ vtkInteractorManualPaint();
+ virtual ~vtkInteractorManualPaint();
+
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ void SetImage(vtkImageData *image);
+
+private:
+ double _Z;
+ int _auxZ;
+ bool _state;
+ vtkImageData *_image;
+ void PaintImage( int px, int py, int pz );
+
+protected:
+
+};
+
+
+
+
+
+
+class bbcreaMaracasVisu_EXPORT ManualPaint
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ManualPaint,bbtk::WxBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView*);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+ vtkInteractorManualPaint *imp;
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint,bbtk::WxBlackBox);
+BBTK_NAME("ManualPaint");
+BBTK_AUTHOR("eduardo davila (Creatis)");
+BBTK_DESCRIPTION("Voxel manual paint");
+BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_INPUT(ManualPaint,In,"Input image to be modified",vtkImageData*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView,"creaMaracasVisu viewer",wxVtkBaseView*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
void manualRoiControler::MouseClickLeft(int x, int y){
int z = GetZ();
-
+
if( IsEditable() )
{ // move control point
if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
SetState(5);
}
} // IsEditable
-
+
// Move contour
if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
}
-
+
// if the firs time create 4 control points and move one point
int size=GetManualViewBaseContour()->GetNumberOfPoints();
if (GetState()==0) {
SetState(1);
}
}
-
+
/*EED 21 Avril 2009
if (GetState()==0) {
if (size==0){
SetState(5);
}
*/
-
+
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
void manualRoiControler::MouseMove(int x, int y) // virtual
{
+
+ printf("manualRoiControler::MouseClickLeft %d %d\n",x ,y);
+
int z=GetZ();
// this->_vtkInteractorStyleBaseView->
-
+
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);