((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
*/
- if (bbGetInputWxVtkBaseView()==NULL)
+ if (bbGetInputWxVtkBaseView1()==NULL)
{
wxMessageDialog(NULL, bbtk::std2wx("(ManualPaint) Input 'WxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
}
wxManualPaintPanel *mpPanel = (wxManualPaintPanel*)bbGetOutputWidget();
mpPanel->SetManualPaintModel(mpModel);
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
- mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtkBaseView( bbGetInputWxVtkBaseView() );
- mpControler->Config();
+ if (bbGetInputWxVtkBaseView1()!=NULL)
+ {
+ ManualPaintControler *mpControler = new ManualPaintControler();
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetManualPaintPanel(mpPanel);
+ mpControler->SetWxVtkBaseView( bbGetInputWxVtkBaseView1() );
+ mpControler->Config();
+ }
+
+ if (bbGetInputWxVtkBaseView2()!=NULL)
+ {
+ ManualPaintControler *mpControler = new ManualPaintControler();
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetManualPaintPanel(mpPanel);
+ mpControler->SetWxVtkBaseView( bbGetInputWxVtkBaseView2() );
+ mpControler->Config();
+ }
+
+ if (bbGetInputWxVtkBaseView3()!=NULL)
+ {
+ ManualPaintControler *mpControler = new ManualPaintControler();
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetManualPaintPanel(mpPanel);
+ mpControler->SetWxVtkBaseView( bbGetInputWxVtkBaseView3() );
+ mpControler->Config();
+ }
+
+ if (bbGetInputWxVtkBaseView4()!=NULL)
+ {
+ ManualPaintControler *mpControler = new ManualPaintControler();
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetManualPaintPanel(mpPanel);
+ mpControler->SetWxVtkBaseView( bbGetInputWxVtkBaseView4() );
+ mpControler->Config();
+ }
+
+
+
}
}
// Don't edit this file. This file is generated from xml description..
//=====
BBTK_DECLARE_INPUT(In,vtkImageData*);
- BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(WxVtkBaseView3,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(WxVtkBaseView4,wxVtkBaseView*);
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_NAME("ManualPaint");
BBTK_AUTHOR("eduardo davila (Creatis)");
BBTK_DESCRIPTION("Voxel manual paint");
-BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_CATEGORY("widget");
BBTK_INPUT(ManualPaint,In,"Input image to be modified",vtkImageData*,"");
-BBTK_INPUT(ManualPaint,WxVtkBaseView,"creaMaracasVisu viewer",wxVtkBaseView*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView1,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView2,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView3,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView4,"creaMaracasVisu viewer 2D",wxVtkBaseView*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint);
//=====
// Don't edit this file. This file is generated from xml description..
format 73
"wxVtkViwer" // wxVtkViwer
- revision 10
+ revision 11
modified_by 2 "davila"
// class settings
//class diagram settings
classrelation_ref 131842 // <generalisation>
b parent class_ref 131074 // InteractorStyleMaracas
end
+
+ classrelation 174978 // <unidirectional association>
+ relation 174850 --->
+ a role_name "" private
+ cpp default " ${comment}${static}${mutable}${volatile}${const}${type} * ${name}${value};
+"
+ classrelation_ref 174978 // <unidirectional association>
+ b parent class_ref 128002 // vtkInfoTextImage
+ end
end
class 128770 "wxWindow"
classcanvas 128002 class_ref 128002 // vtkInfoTextImage
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
- xyz 191.2 729.6 2000
+ xyz 263.2 625.6 2000
end
classcanvas 128130 class_ref 128130 // wxVtk2DBaseView
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
end
classcanvas 128642 class_ref 128386 // vtkImageViewer2_XYZ
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
- xyz 211.1 666.7 2000
+ xyz 154.1 807.7 2000
end
classcanvas 128898 class_ref 128514 // vtkBaseData
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
- xyz 246.4 494.2 2000
+ xyz 199.4 679.2 2000
end
classcanvas 129026 class_ref 128642 // vtkInfoTextImageInteractor
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
classcanvas 136194 class_ref 130690 // vtkImageViewer2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
color magenta
- xyz 194.1 609.6 2005
+ xyz 60.1 751.6 2005
end
classcanvas 136450 class_ref 130818 // marImageData
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
- xyz 68.8 609.6 2000
+ xyz 112.8 623.6 2000
end
classcanvas 137090 class_ref 130946 // vtkTextActor
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
color magenta
- xyz 40.6 758.3 2007
+ xyz 227.6 554.3 2007
end
note 137346 "_vtkText_WindowLevel
_vtkText_ColorLevel
_vtkText_position
_vtkText_Intensity"
- xyzwh 105.9 809.6 2013 177 78
+ xyzwh 38.9 534.6 2013 177 78
classcanvas 137602 class_ref 131074 // InteractorStyleMaracas
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
xyz 176.1 25.8 2006
end
classcanvas 141314 class_ref 131458 // vtkMPRBaseData
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
- xyz 234.1 549 2010
+ xyz 189.1 733 2010
end
classcanvas 142082 class_ref 132226 // wxVtk3DBaseView
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
xyz 450.2 233 2000
end
note 144002 "All Controlers herite from this class Ex. manualControles"
- xyzwh 52.7 445.4 2000 145 63
+ xyzwh 30.7 449.4 2000 145 63
classcanvas 147330 class_ref 154114 // vtkInteractorStyleSphere
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
xyz 36 116 2012
no_multiplicity_a no_multiplicity_b
end
relationcanvas 129282 relation_ref 128514 // <unidirectional association>
- from ref 128130 z 2001 to point 341 518
- line 151298 z 2001 to ref 128898
+ from ref 128130 z 2001 to ref 128898
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
no_multiplicity_a no_multiplicity_b
end
relationcanvas 136578 relation_ref 131330 // <unidirectional association>
- from ref 128002 z 2001 to point 128 676
- line 136706 z 2001 to ref 136450
+ from ref 128002 z 2001 to ref 136450
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
no_multiplicity_a no_multiplicity_b
end
relationcanvas 141826 relation_ref 138882 // <unidirectional association>
- from ref 128898 z 2001 to point 158 543
- line 141954 z 2001 to ref 136450
+ from ref 128898 z 2001 to ref 136450
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
+relationcanvas 151682 relation_ref 174850 // <unidirectional association>
+ from ref 129026 z 2001 to point 308 302
+ line 151810 z 2001 to ref 128002
+ no_role_a no_role_b
+ no_multiplicity_a no_multiplicity_b
+end
line 137474 -_-_
from ref 137346 z 2014 to ref 137218
line 150786 -_-_
-window_sizes 1386 821 293 1083 628 104
+window_sizes 1333 818 293 1030 634 104
motif_style
diagrams
active classdiagram_ref 128002 // wxVtkViewer class Diagram 1
- 1080 630 100 4 0 0
+ 1030 634 100 4 173 0
classdiagram_ref 128130 // wxVtkViewer class Diagram 2
870 699 100 4 255 0
end
format 73
"wxVtkViewer"
- revision 10
+ revision 11
modified_by 2 "davila"
#include "OpenImageDialog.h"
+//---------------------------------------------------------
+//---------------------------------------------------------
+//---------------------------------------------------------
+
wxDlgTransformByDimensionBySpacingByPixel::wxDlgTransformByDimensionBySpacingByPixel()
{
}
}
}
-//---------------------------------------------------------
+//---------------------------------------------------------
+//---------------------------------------------------------
+//---------------------------------------------------------
/**
#include "ColorLayerImageView.h"
+
+//-----------------------------------------------------
+
//EED 21-08-2010
class wxDlgTransformByDimensionBySpacingByPixel
{
void GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK) ;
};
+
+
//-----------------------------------------------------
- class ColorLayerImageViewPanel
+class ColorLayerImageViewPanel
: public wxPanel
{
public:
void onChangeOpacity(wxScrollEvent& event);
void onSliceFixDinamic(wxCommandEvent& event);
void onSliceImage(wxScrollEvent& event);
- };
+
+};
#endif
#include "LayerImageBase.h"
+
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+
+ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
+{
+ _layerImageBase=layerImageBase;
+}
+
+//---------------------------------------------------------------------------------------------
+ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
+{
+}
+
+
+//---------------------------------------------------------------------------------------------
+bool ColorLayerImageBasevtkInteractor::OnMouseMove()
+{
+
+ if (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
+ {
+ _layerImageBase->GetvtkImageReslice()->Modified();
+ }
+
+ return true;
+}
+
+
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+
+
+
LayerImageBase::LayerImageBase()
{
_actorPresent = false;
void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview)
{
_baseView = baseview;
+
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void LayerImageBase::Refresh()
{
+ printf("EED LayerImageBase::Refresh\n");
if (_baseView!=NULL)
{
_baseView->Refresh();
}
}
+//----------------------------------------------------------------------------
+vtkLookupTable *LayerImageBase::GetvtkLookupTable()
+{
+ return _thresholdTable;
+}
+
+vtkImageReslice *LayerImageBase::GetvtkImageReslice()
+{
+ return _imageReslicer;
+}
#include <vtkImageData.h>
#include "wxVtkBaseView.h"
+#include "InteractorStyleMaracas.h"
+
+//----------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------
+class LayerImageBase;
+
+class ColorLayerImageBasevtkInteractor : public InteractorStyleMaracas {
+public:
+ ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase);
+ virtual ~ColorLayerImageBasevtkInteractor();
+
+ virtual bool OnMouseMove();
+
+private:
+ LayerImageBase* _layerImageBase;
+
+protected:
+
+};
+
+
+//----------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------
+
+
+
class LayerImageBase
{
public:
void onThresholdRemove();
wxVtkBaseView *GetwxVtkBaseView();
void Refresh();
+ vtkLookupTable *GetvtkLookupTable();
+ vtkImageReslice *GetvtkImageReslice();
+ virtual int GetZ();
private:
int _Z;
protected:
- virtual int GetZ();
vtkLookupTable* GetThresholdTable();
vtkImageData* GetImage();
};
//---------------------------------------------------------------------------
void ManualPaintControler::Config()
{
- vtkInteractorManualPaint *imp = new vtkInteractorManualPaint(this);
vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_wxvtkbaseview->GetInteractorStyleBaseView());
- isbv->AddInteractorStyleMaracas(imp);
+ isbv->AddInteractorStyleMaracas( new vtkInteractorManualPaint(this) );
}
void ManualPaintControler::PaintImage(int px,int py, int pz)
{
_manualPaintModel->PaintImage(px,py,pz);
- RefreshView();
+
+ //The refresh mechanisme is made in the vtkInteractorManualPaint
+// RefreshView();
}
//---------------------------------------------------------------------------
-void ManualPaintControler::RefreshView()
-{
- wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
- vtkImageViewer2 *vtkimageviewer2 = wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
- vtkimageviewer2->GetWindowLevel()->Modified();
-
-}
ManualPaintPanel *_manualPaintPanel;
wxVtkBaseView *_wxvtkbaseview;
- void RefreshView();
-
protected:
};
ManualPaintModel::ManualPaintModel()
{
- _graylevel=0.0;
- _brushsize=1;
+ _graylevel = 0.0;
+ _brushsize = 1;
+ _brushform = 0; // 0 rectangle-box , 1 circle-sphere
+ _2D3D = 0; // 0 2D , 1 true 3D
+ _brushtool = 0; // 0 pensil , 1 fill
}
//---------------------------------------------------------------------------
void ManualPaintModel::PaintImage(int px,int py, int pz)
{
+
+ printf("EED ManualPaintModel::PaintImage %d %d %d\n", px,py,pz);
if (_image!=NULL)
{
float value=(float)_graylevel;
int minZ=pz-size;
int maxZ=pz+size;
+ double xx,yy,zz,rr=size*size;
+
+ printf("EED bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage brushForm=%d\n",_brushform);
for (i=minX; i<=maxX; i++)
{
+ xx=px-i;
+ xx=xx*xx;
for (j=minY; j<=maxY; j++)
{
+ yy=py-j;
+ yy=yy*yy;
for (k=minZ; k<=maxZ; k++)
{
- _image->SetScalarComponentFromFloat (i,j,k, 0, value );
- }
- }
- }
+ zz=pz-k;
+ zz=zz*zz;
+ if (_brushform==0)
+ {
+ _image->SetScalarComponentFromFloat (i,j,k, 0, value );
+ } else if (_brushform==1)
+ {
+ if ((xx+yy+zz)<=rr)
+ {
+ _image->SetScalarComponentFromFloat (i,j,k, 0, value );
+ }
+ } // _brushform
+
+ }//k
+ }//j
+ }//i
_image->Modified();
- _image->UpdateInformation();
- _image->Update();
- _image->UpdateData();
} else {
printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
- }
+ } // _image
}
//---------------------------------------------------------------------------
void ManualPaintModel::SetBrushSize( int brushsize )
{
- printf("EED %p ManualPaintModel::SetBrushSize \n", this);
_brushsize = brushsize;
}
//---------------------------------------------------------------------------
void ManualPaintModel::SetGrayLevel( double graylevel )
{
- printf("EED %p ManualPaintModel::SetGrayLevel \n", this);
_graylevel = graylevel;
}
+//---------------------------------------------------------------------------
+void ManualPaintModel::SetBrushForm( int brushform )
+{
+ _brushform = brushform;
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintModel::SetBrushTool( int brushtool )
+{
+ _brushtool = brushtool;
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintModel::Set2D3D( int dim2D3D )
+{
+ _2D3D = dim2D3D;
+}
+
void SetImage(vtkImageData *image);
void PaintImage(int px,int py, int pz);
void SetBrushSize( int brushsize );
+ void SetBrushForm( int brushform );
+ void SetBrushTool( int brushtool );
+ void Set2D3D( int dim2D3D );
void SetGrayLevel( double graylevel );
private:
vtkImageData *_image;
int _brushsize;
+ int _brushform;
+ int _brushtool;
+ bool _2D3D;
double _graylevel;
}
}
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetBrushTool(int brushtool)
+{
+ if (_manualPaintModel!=NULL)
+ {
+ _manualPaintModel->SetBrushTool( brushtool );
+ } else {
+ printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
+ }
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintPanel::Set2D3D(int dim2D3D)
+{
+ if (_manualPaintModel!=NULL)
+ {
+ _manualPaintModel->Set2D3D( dim2D3D );
+ } else {
+ printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
+ }
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetBrushForm(int brushform)
+{
+ if (_manualPaintModel!=NULL)
+ {
+ _manualPaintModel->SetBrushForm( brushform );
+ } else {
+ printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
+ }
+}
+
+
void SetManualPaintModel(ManualPaintModel* manualPaintModel);
void SetBrushSize( int brushsize );
void SetGrayLevel( double graylevel );
+ void SetBrushTool(int brushtool);
+ void Set2D3D(int dim2D3D);
+ void SetBrushForm(int brushform);
private:
int px,py;
wxVTKiren->GetEventPosition(px,py);
- int typeView = 2;
+// int typeView = 1;
double X = (double)px;
double Y = (double)py;
double Z = wxvtk2Dbaseview->GetActualSlice();
- wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,false, typeView);
-
-// int px = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
-// int py = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+// wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView);
+ wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true);
_manualPaintControler->PaintImage((int)X,(int)Y,(int)Z);
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
/*
wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->Modified();
// Widget interface
wxStaticText *tittleText = new wxStaticText(panel, -1, _T(" Manual Paint"));
wxStaticText *txtBrushSize = new wxStaticText(panel, -1, wxString(_T(" Brush size ")));
- sldBrushSize = new wxSlider(panel, -1, 1, 1, 20, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ _sldBrushSize = new wxSlider(panel, -1, 1, 1, 20, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
wxStaticText *txtGrayLevel = new wxStaticText(panel, -1, wxString(_T(" Gray Level ")));
- sldGrayLevel = new wxSlider(panel, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
- graylevelCtrl = new wxTextCtrl(panel , -1);
+ _sldGrayLevel = new wxSlider(panel, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ _graylevelCtrl = new wxTextCtrl(panel , -1);
wxString lst2D3D[2];
lst2D3D[0]=_T("2D circle");
lst2D3D[1]=_T("3D sphere");
- wxRadioBox * rb2D3D = new wxRadioBox(panel, -1, _T("2D / 3D"), wxDefaultPosition, wxSize(270,45), 2 , lst2D3D, 2, wxRA_SPECIFY_COLS);
- rb2D3D->SetSelection(1);
- rb2D3D->Disable();
+ _rb2D3D = new wxRadioBox(panel, -1, _T("2D / 3D"), wxDefaultPosition, wxSize(270,45), 2 , lst2D3D, 2, wxRA_SPECIFY_COLS);
+ _rb2D3D->SetSelection(1);
+ _rb2D3D->Disable();
wxString lstBrushForm[2];
lstBrushForm[0]=_T("rectangle/cube");
lstBrushForm[1]=_T("circle/sphere");
- wxRadioBox * rbBrushForm = new wxRadioBox(panel, -1, _T("Brush form"), wxDefaultPosition, wxSize(270,45), 2 , lstBrushForm, 2, wxRA_SPECIFY_COLS);
- rbBrushForm->Disable();
+ _rbBrushForm = new wxRadioBox(panel, -1, _T("Brush form"), wxDefaultPosition, wxSize(270,45), 2 , lstBrushForm, 2, wxRA_SPECIFY_COLS);
wxString lstBrushTool[2];
lstBrushTool[0]=_T("Pensil");
lstBrushTool[1]=_T("Fill");
- wxRadioBox *rbBrushTool = new wxRadioBox(panel, -1, _T("Brush tool"), wxDefaultPosition, wxSize(270,45), 2 , lstBrushTool, 2, wxRA_SPECIFY_COLS);
- rbBrushTool->Disable();
+ _rbBrushTool = new wxRadioBox(panel, -1, _T("Brush tool"), wxDefaultPosition, wxSize(270,45), 2 , lstBrushTool, 2, wxRA_SPECIFY_COLS);
+ _rbBrushTool->Disable();
- wxButton *btnCopy = new wxButton( panel, -1, _T("Copy"));
+ wxButton *btnCopy = new wxButton( panel, -1, _T("Copy"));
btnCopy->Disable();
- wxButton *btnUndo = new wxButton( panel, -1, _T("Undo"));
+ wxButton *btnUndo = new wxButton( panel, -1, _T("Undo"));
btnUndo->Disable();
- Connect(sldBrushSize->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushSize);
- Connect(sldGrayLevel->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxManualPaintPanel::OnSldGrayLevel);
- Connect(graylevelCtrl->GetId() , wxEVT_COMMAND_TEXT_UPDATED , (wxObjectEventFunction) &wxManualPaintPanel::OnCtrTxtGrayLevel);
+ Connect(_sldBrushSize->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushSize);
+ Connect(_sldGrayLevel->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxManualPaintPanel::OnSldGrayLevel);
+ Connect(_graylevelCtrl->GetId() , wxEVT_COMMAND_TEXT_UPDATED , (wxObjectEventFunction) &wxManualPaintPanel::OnCtrTxtGrayLevel);
- Connect(rb2D3D->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::On2D3D);
- Connect(rbBrushForm->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushForm);
- Connect(rbBrushTool->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushTool);
+ Connect(_rb2D3D->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::On2D3D);
+ Connect(_rbBrushForm->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushForm);
+ Connect(_rbBrushTool->GetId() , wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &wxManualPaintPanel::OnBrushTool);
Connect(btnCopy->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxManualPaintPanel::OnCopy);
Connect(btnUndo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxManualPaintPanel::OnUndo);
sizer1->Add(tittleText);
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
sizer1->Add(txtBrushSize);
- sizer1->Add(sldBrushSize, 1, wxGROW );
+ sizer1->Add(_sldBrushSize, 1, wxGROW );
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
sizer1->Add(txtGrayLevel);
- sizer1->Add(sldGrayLevel, 1, wxGROW );
- sizer1->Add(graylevelCtrl);
+ sizer1->Add(_sldGrayLevel, 1, wxGROW );
+ sizer1->Add(_graylevelCtrl);
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
- sizer1->Add(rb2D3D, 1, wxGROW );
+ sizer1->Add(_rb2D3D, 1, wxGROW );
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
- sizer1->Add(rbBrushForm, 1, wxGROW );
+ sizer1->Add(_rbBrushForm, 1, wxGROW );
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
- sizer1->Add(rbBrushTool, 1, wxGROW );
+ sizer1->Add(_rbBrushTool, 1, wxGROW );
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
sizer1->Add(btnCopy, 1, wxGROW );
sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnBrushSize(wxScrollEvent& event)
{
- printf("EED %p wxManualPaintPanel::OnBrushSize\n", this);
- SetBrushSize( sldBrushSize->GetValue() );
+ SetBrushSize( _sldBrushSize->GetValue() );
}
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnSldGrayLevel(wxScrollEvent& event)
{
- printf("EED %p wxManualPaintPanel::OnGrayLevel\n", this);
- SetGrayLevel( (double)(sldGrayLevel->GetValue()) );
+ SetGrayLevel( (double)(_sldGrayLevel->GetValue()) );
wxString text;
- text.Printf( wxT("%d"), sldGrayLevel->GetValue() );
- graylevelCtrl->SetValue(text);
+ text.Printf( wxT("%d"), _sldGrayLevel->GetValue() );
+ _graylevelCtrl->SetValue(text);
}
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnCtrTxtGrayLevel(wxCommandEvent &event)
{
- printf("EED %p wxManualPaintPanel::OnCtrTxtGrayLevel\n", this);
-
double graylevel;
- wxString text=graylevelCtrl->GetValue();
+ wxString text=_graylevelCtrl->GetValue();
if (text.ToDouble(&graylevel))
{
SetGrayLevel( graylevel );
//---------------------------------------------------------------------------
void wxManualPaintPanel::On2D3D(wxCommandEvent &event)
{
+ Set2D3D( _rb2D3D->GetSelection() );
}
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnBrushForm(wxCommandEvent &event)
{
+ printf("EED wxManualPaintPanel::OnBrushForm BrushForm=%d \n", _rbBrushForm->GetSelection());
+ SetBrushForm( _rbBrushForm->GetSelection() );
}
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnBrushTool(wxCommandEvent &event)
{
+ SetBrushTool( _rbBrushTool->GetSelection() );
}
//---------------------------------------------------------------------------
private:
- wxSlider *sldBrushSize;
- wxSlider *sldGrayLevel;
- wxTextCtrl *graylevelCtrl;
+ wxSlider *_sldBrushSize;
+ wxSlider *_sldGrayLevel;
+ wxTextCtrl *_graylevelCtrl;
+ wxRadioBox *_rbBrushForm;
+ wxRadioBox *_rb2D3D;
+ wxRadioBox *_rbBrushTool;
protected:
//EED 5mai2009
//-------------------------------------------------------------------
wxVtk2DBaseView::~wxVtk2DBaseView()
-{
- if (_vtkIinfoTextImage!=NULL)
+{
+ if (_vtkIinfoTextImage!=NULL)
{
- delete _vtkIinfoTextImage;
+ delete _vtkIinfoTextImage;
}
- if (_imageViewer2XYZ!=NULL)
+ if (_imageViewer2XYZ!=NULL)
{
- delete _imageViewer2XYZ;
+ delete _imageViewer2XYZ;
}
}
//-------------------------------------------------------------------
-void wxVtk2DBaseView::TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z) // virtual
+void wxVtk2DBaseView::TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z) // virtual
{
//EEDx5
double spc[3];
spc[1] = 1;
spc[2] = 1;
}
-
+
X = X / spc[0];
Y = Y / spc[1];
}
//-------------------------------------------------------------------
-void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z) // virtual
+void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z) // virtual
{
//EEDx5
double spc[3];
double spx = 0,spy = 0,spz = 0;
int x1 = 1,x2 = 1,y1 = 1,y2 = 1,z1 = 1,z2 = 1;
wxVtkBaseView::Configure();
-
+
wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
vtkImageData *imageData = GetVtkBaseData()->GetImageData();
if(imageData){
imageData->GetExtent (x1,x2,y1,y2,z1,z2);
}
-
+
_imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2);
_imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
+//EED 24oct2010
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
+
_imageViewer2XYZ->GetVtkImageViewer2()->Render();
//////////////
// RaC
//////////////
-
+
}
vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
if (imageData!=NULL){
-
+
imageData->UpdateInformation();
imageData->SetUpdateExtent( imageData->GetWholeExtent());
imageData->Update();
vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2();
vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
-//EED 17Avril2009
-/*
+//EED 17Avril2009
+/*
camera->SetViewUp ( spx*0 , -spy*1 , spz*0 );
- camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 );
- camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
-*/
+ camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 );
+ camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+*/
camera->SetViewUp ( spx*0 , spy*1 , spz*0 );
- camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 );
- camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
-
-
+ camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 );
+ camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+
+
camera->SetClippingRange( 0.01 , 1000000 );
camera->ComputeViewPlaneNormal();
camera->SetParallelScale( spx*(x2-x1)/3.0 );
-
+
// text information over the graphic window
if(_vtkIinfoTextImage == NULL){
_vtkIinfoTextImage = new vtkInfoTextImage();
- _vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor();
+ _vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor();
((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkIinfoTextImageInteractor);
}
_vtkIinfoTextImage->SetWxVtk2DBaseView(this);
_vtkIinfoTextImage->SetMarImageData( GetVtkBaseData()->GetMarImageData() );
- _vtkIinfoTextImageInteractor->SetModelVtkInfoTextImage(_vtkIinfoTextImage);
+ _vtkIinfoTextImageInteractor->SetModelVtkInfoTextImage(_vtkIinfoTextImage);
_vtkIinfoTextImage->Configure();
-
+
} // okimage
} // imageData
}
//-------------------------------------------------------------------
-int wxVtk2DBaseView::GetActualSlice() // virtual
+int wxVtk2DBaseView::GetActualSlice() // virtual
{
return (int)(_vtkbasedata->GetZ());
}
void wxVtk2DBaseView::Refresh()
{
int z = (int)(GetVtkBaseData()->GetZ());
- _imageViewer2XYZ->SetZSlice( z );
+ _imageViewer2XYZ->SetZSlice( z );
+
+//EED 24oct2010
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
wxVtkBaseView::Refresh();
}
wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
interactorstylebaseview->SetInteractor ( iren );
iren->SetInteractorStyle(interactorstylebaseview);
- interactorstylebaseview->SetwxVtkBaseView(this);
+ interactorstylebaseview->SetwxVtkBaseView(this);
vtkMaracasImageViewer2Callback * cbk = vtkMaracasImageViewer2Callback::New();
cbk->IV = _imageViewer2XYZ->GetVtkImageViewer2();
}
//---------------------------------------------------------------------------
-vtkRenderer* wxVtk2DBaseView::GetRenderer() // virtual
+vtkRenderer* wxVtk2DBaseView::GetRenderer() // virtual
{
return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer();
}
if(imageData){
imageData->GetSpacing(spc);
}else{
- spc[0] = 0;
+ spc[0] = 0;
spc[1] = 0;
spc[2] = 0;
}
}
void wxVtk2DBaseView::setWindowLevel(double level){
-// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow(level);
+// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow(level);
vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
imagemaptowindowlevel->SetWindow(level);
//vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); // JPRx
-
int x1 = 0,x2 = 0,y1 = 0,y2 = 0,z1 = 0,z2 = 0;
int x = 0, y = 0, z = 0;
int xx = 0, yy = 0, zz = 0;
_backY=yy;
_backZ=zz;
}
+
+//EED 24oct2010
+_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
+
wxVtkBaseView::Refresh();
}
}