ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget();
clivp->GetColorLayerImageView()->SetwxVtkBaseView( bbGetInputWxVtkBaseView() );
+ clivp->SetImage( bbGetInputIn() );
// std::string msg;
// if (bbGetInputTitle()!="")
//=====
void ColorLayerImageView::bbUserSetDefaultValues()
{
-
+ bbSetInputIn(NULL);
+ bbSetInputWxVtkBaseView(NULL);
}
//=====
// Don't edit this file. This file is generated from xml description..
// Don't edit this file. This file is generated from xml description..
//=====
BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_AUTHOR("Eduardo DAVILA (Creatis)");
BBTK_DESCRIPTION("Color Laye rImage View");
BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,"");
BBTK_INPUT(ColorLayerImageView,WxVtkBaseView,"creaMaracasVisuViewer viewer",wxVtkBaseView*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView);
//=====
classcanvas 128002 class_ref 128002 // ThresholdImageViewPanel
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 150.4 593.6 2000
+ xyz 150.6 593.4 2000
end
classcanvas 128130 class_ref 128130 // wxPanel
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 mediumgreen
- xyz 337.7 465.8 2000
+ xyz 337.3 465.2 2000
end
classcanvas 128386 class_ref 128258 // ThresholdImageView
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 116.7 387 2005
+ xyz 116.3 387 2005
end
classcanvas 128642 class_ref 128386 // LayerImageBase
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 328.3 230.3 2000
+ xyz 328.7 230.7 2000
end
classcanvas 128898 class_ref 128514 // ColorLayerImageViewPanel
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 533.2 592.5 2000
+ xyz 533.8 589.5 2000
end
classcanvas 129154 class_ref 128642 // ColorLayerImageView
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 517.3 387 2000
+ xyz 517.7 387 2000
end
classcanvas 130306 class_ref 128770 // wxVtkBaseView
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 gold
- xyz 88.9 230.3 2000
+ xyz 88.1 230.7 2000
end
classcanvas 130562 class_ref 128898 // mBarRange
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 71.5 451.4 2000
+ xyz 71.5 451.6 2000
end
classcanvas 130818 class_ref 129026 // wxDlgTransformByDimensionBySpacingByPixel
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 425.8 311.4 2000
+ xyz 425.2 311.6 2000
end
classcanvas 131074 class_ref 129154 // vtkImageData
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 darkblue
- xyz 522.5 46.9 2000
+ xyz 522.5 46.1 2000
end
classcanvas 131330 class_ref 129282 // vtkImageReslice
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 darkblue
- xyz 569.4 94.7 2000
+ xyz 569.6 94.3 2000
end
classcanvas 131586 class_ref 129410 // vtkLookupTable
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 darkblue
- xyz 611.2 142.5 2000
+ xyz 611.8 142.5 2000
end
classcanvas 131714 class_ref 129538 // vtkImageMapToColors
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 darkblue
- xyz 608.6 199.2 2011
+ xyz 608.4 199.8 2011
end
classcanvas 131842 class_ref 129666 // vtkImageActor
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 darkblue
- xyz 614 254.7 2006
+ xyz 614 254.3 2006
end
note 132482 "wxVtkViewer Class Diagram 1"
- xyzwh 85.6 113.3 2000 163 81
+ xyzwh 85.4 113.7 2000 163 81
classcanvas 132738 class_ref 136194 // bbcreaMaracasVisuColorLayerImageView
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 lightorange
- xyz 271.2 911.3 2005
+ xyz 271.4 911.5 2005
end
note 132866 "Inputs of the box"
- xyzwh 48.9 914.6 2000 157 41
+ xyzwh 48.7 914.8 2000 157 41
note 133122 "Output of the box"
- xyzwh 660.7 912 2000 163 39
+ xyzwh 660.5 912.8 2000 163 39
classcanvas 133890 class_ref 136322 // wxWindow
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 mediumgreen
- xyz 327.6 391.4 2000
+ xyz 327.4 391.6 2000
end
-classcanvas 136066 class_ref 136450 // bbcreaMaracasVisuLayerImageBase
+classcanvas 136066 class_ref 136450 // bbcreaMaracasVisuThresholdImageView
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 lightorange
- xyz 112.8 669.3 2012
+ xyz 81.8 663.2 2012
end
note 139010 "Input of the box
"
- xyzwh 44 723 2000 97 68
+ xyzwh 44.6 722.8 2000 97 68
note 139138 "Output of the box
"
- xyzwh 366 734 2000 97 66
+ xyzwh 378 732 2000 97 66
note 139778 "This box is missing.. EED"
- xyzwh 177 766 2000 148 72
+ xyzwh 177 765.8 2000 148 72
relationcanvas 128258 relation_ref 128002 // <generalisation>
- from ref 128002 z 2001 to point 374.6 542.4
+ from ref 128002 z 2001 to point 374.8 542.2
line 135938 z 2001 to ref 128130
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 128770 relation_ref 128258 // <generalisation>
- from ref 128386 z 2006 to point 400.2 359.1
+ from ref 128386 z 2006 to point 400.6 359.8
line 135170 z 2006 to ref 128642
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 129026 relation_ref 128386 // <generalisation>
- from ref 128898 z 2001 to point 374.6 543.5
+ from ref 128898 z 2001 to point 374.8 543
line 135810 z 2001 to ref 128130
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 129282 relation_ref 128514 // <generalisation>
- from ref 129154 z 2001 to point 400.2 359.1
+ from ref 129154 z 2001 to point 400.6 359.8
line 135042 z 2001 to ref 128642
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 130946 relation_ref 129026 // <unidirectional association>
- from ref 128898 z 2001 to point 784.6 539.1
- line 135426 z 2001 to point 783.5 366.8
+ from ref 128898 z 2001 to point 784.8 539.8
+ line 135426 z 2001 to point 783 366.4
line 135554 z 2001 to ref 130818
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 133378 relation_ref 136194 // <unidirectional association>
- from ref 132738 z 2006 to point 22.5 871.8
- line 133506 z 2006 to point 23.5 250.2
+ from ref 132738 z 2006 to point 22.2 871.4
+ line 133506 z 2006 to point 23 250.6
line 133762 z 2006 to ref 130306
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 134146 relation_ref 136450 // <unidirectional association>
- from ref 132738 z 2006 to point 508.8 809.7
- line 138242 z 2006 to point 461.3 427.9
+ from ref 132738 z 2006 to point 508 809.8
+ line 138242 z 2006 to point 461.4 427.2
line 134402 z 2006 to ref 133890
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 134914 relation_ref 136706 // <dependency>
- from ref 132738 z 2006 to point 675 849
+ from ref 132738 z 2006 to point 675.6 849.8
line 138882 z 2006 to ref 128898
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 137090 relation_ref 137218 // <unidirectional association>
- from ref 136066 z 2013 to point 493.5 681.3
- line 137858 z 2013 to point 460.2 427.9
+ from ref 136066 z 2013 to point 493 681.4
+ line 137858 z 2013 to point 460.6 427.2
line 138498 z 2013 to ref 133890
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
relationcanvas 137474 relation_ref 137474 // <unidirectional association>
- from ref 136066 z 2013 to point 23.5 676.8
- line 138754 z 2013 to point 23.5 249.1
+ from ref 136066 z 2013 to point 23 676.4
+ line 138754 z 2013 to point 23 249.8
line 138626 z 2013 to ref 130306
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
window_sizes 1322 787 337 975 597 92
diagrams
active classdiagram_ref 128002 // ThresholdImageView_DiagramClass
- 975 597 90 4 288 0
+ 975 597 90 4 252 0
end
show_stereotypes
selected classdiagram_ref 128002 // ThresholdImageView_DiagramClass
format 73
"ThresholdImageView"
- revision 2
+ revision 3
modified_by 2 "davila"
end
- class 136450 "bbcreaMaracasVisuLayerImageBase"
+ class 136450 "bbcreaMaracasVisuThresholdImageView"
visibility package
cpp_decl "${comment}${template}class ${name}${inherit} {
${members}};
_dimBase[2] = dim[2];
}
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
+{
+ if (img!=NULL)
+ {
+ _colorLayerImageView->SetImage( img );
+
+ double spc[3];
+ img->GetSpacing(spc);
+
+ int dim[3];
+ int ext[6];
+ img->GetWholeExtent(ext);
+ dim[0] = ext[1]-ext[0];
+ dim[1] = ext[3]-ext[2];
+ dim[2] = ext[5]-ext[4];
+ _sl_SliceImage->SetRange( 0 , dim[2] );
+
+ if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
+ (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
+ )
+ {
+
+ bool transformOkDlg;
+ int typeOfTransformation;
+ wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
+ wxDlgTransformByDimensionBySpacingByPixel dlg;
+ dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
+
+ printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
+
+ if (typeOfTransformation==0) // make dimensions equals
+ {
+ printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
+ spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
+ spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
+ spc[2] = 1;
+ }
+
+ if (typeOfTransformation==1) // make spacing equals
+ {
+ spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
+ spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
+ spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
+ }
+
+ if (typeOfTransformation==2) // make spacing = 1
+ {
+ spc[0] = 1;
+ spc[1] = 1;
+ spc[2] = 1;
+ }
+
+ img->SetSpacing(spc);
+ } // spc !_spcBase dim!__dimBase
+
+ if (_colorLayerImageView!=NULL)
+ {
+ _colorLayerImageView->onThreshold();
+ _colorLayerImageView->Refresh();
+ }
+
+
+ }
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
{
printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
- _colorLayerImageView->SetImage( diag.getImageData() );
-
- double spc[3];
- diag.getImageData()->GetSpacing(spc);
-
- int dim[3];
- int ext[6];
- diag.getImageData()->GetWholeExtent(ext);
- dim[0] = ext[1]-ext[0];
- dim[1] = ext[3]-ext[2];
- dim[2] = ext[5]-ext[4];
- _sl_SliceImage->SetRange( 0 , dim[2] );
-
- if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
- (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
- )
- {
-
- bool transformOkDlg;
- int typeOfTransformation;
- wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
- wxDlgTransformByDimensionBySpacingByPixel dlg;
- dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
-
-printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
-
- if (typeOfTransformation==0) // make dimensions equals
- {
- printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
- spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
- spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
- spc[2] = 1;
- }
-
- if (typeOfTransformation==1) // make spacing equals
- {
- spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
- spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
- spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
- }
-
- if (typeOfTransformation==2) // make spacing = 1
- {
- spc[0] = 1;
- spc[1] = 1;
- spc[2] = 1;
- }
-
- diag.getImageData()->SetSpacing(spc);
- } // spc !_spcBase dim!__dimBase
-
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }
+ SetImage( diag.getImageData() );
}
//----------------------------------------------------------------------------
void SetBaseSpacing(double spc[3]);
void SetBaseDimension(int dim[3]);
void SetOriginalSpacing(double spc[3]);
+ void SetImage(vtkImageData *img);
private:
int _dimBase[3];
_imageReslicer->SetResliceAxesOrigin(0,0,z);
vtkImageData *img = _imageReslicer->GetOutput();
- img->Update();
- img->UpdateInformation();
+// img->Update();
+// img->UpdateInformation();
_thresholdMapper->SetInput( img );
_thresholdMapper->SetLookupTable( _thresholdTable );
--- /dev/null
+
+#include "ManualPaintControler.h"
+#include "vtkInteractorManualPaint.h"
+#include "wxVtk2DBaseView.h"
+#include "vtkImageActor.h"
+
+//---------------------------------------------------------------------------
+ManualPaintControler::ManualPaintControler()
+{
+ auxZ=0;
+}
+
+//---------------------------------------------------------------------------
+ManualPaintControler::~ManualPaintControler()
+{
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::SetManualPaintModel(ManualPaintModel* manualPaintModel)
+{
+ _manualPaintModel = manualPaintModel;
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::SetManualPaintPanel(ManualPaintPanel* manualPaintPanel)
+{
+ _manualPaintPanel = manualPaintPanel;
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::SetWxVtkBaseView(wxVtkBaseView *baseview)
+{
+ _wxvtkbaseview = baseview;
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::Config()
+{
+ vtkInteractorManualPaint *imp = new vtkInteractorManualPaint(this);
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_wxvtkbaseview->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(imp);
+}
+
+
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::PaintImage(int px,int py, int pz)
+{
+ _manualPaintModel->PaintImage(px,py,pz);
+ RefreshView();
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintControler::RefreshView()
+{
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
+ vtkImageViewer2 *vtkimageviewer2 = wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+ vtkimageviewer2->GetWindowLevel()->Modified();
+
+}
+
--- /dev/null
+#ifndef _MANUAL_PAINT_CONTROLER_H_
+#define _MANUAL_PAINT_CONTROLER_H_
+
+#include "ManualPaintModel.h"
+#include "ManualPaintPanel.h"
+#include "wxVtkBaseView.h"
+
+
+class ManualPaintControler {
+public:
+ ManualPaintControler();
+ virtual ~ManualPaintControler();
+
+ void SetManualPaintModel(ManualPaintModel* manualPaintModel);
+ void SetManualPaintPanel(ManualPaintPanel* manualPaintPanel);
+ void SetWxVtkBaseView(wxVtkBaseView *baseview);
+ void Config();
+ void PaintImage(int px,int py, int pz);
+
+private:
+ int auxZ;
+ ManualPaintModel *_manualPaintModel;
+ ManualPaintPanel *_manualPaintPanel;
+ wxVtkBaseView *_wxvtkbaseview;
+
+ void RefreshView();
+
+protected:
+
+};
+
+
+#endif // _MANUAL_PAINT_CONTROLER_H_
--- /dev/null
+
+#include "ManualPaintModel.h"
+
+
+ManualPaintModel::ManualPaintModel()
+{
+ _graylevel=0.0;
+ _brushsize=1;
+}
+
+//---------------------------------------------------------------------------
+ManualPaintModel::~ManualPaintModel()
+{
+}
+
+void ManualPaintModel::SetImage(vtkImageData *image)
+{
+ _image=image;
+}
+
+void ManualPaintModel::PaintImage(int px,int py, int pz)
+{
+ if (_image!=NULL)
+ {
+ float value=(float)_graylevel;
+ int i,j,k;
+ int size = _brushsize-1;
+ int minX=px-size;
+ int maxX=px+size;
+ int minY=py-size;
+ int maxY=py+size;
+ int minZ=pz-size;
+ int maxZ=pz+size;
+
+ for (i=minX; i<=maxX; i++)
+ {
+ for (j=minY; j<=maxY; j++)
+ {
+ for (k=minZ; k<=maxZ; k++)
+ {
+ _image->SetScalarComponentFromFloat (i,j,k, 0, value );
+ }
+ }
+ }
+ _image->Modified();
+ _image->UpdateInformation();
+ _image->Update();
+ _image->UpdateData();
+ } else {
+ printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
+ }
+}
+
+
+//---------------------------------------------------------------------------
+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;
+}
+
--- /dev/null
+#ifndef _MANUAL_PAINT_MODEL_H_
+#define _MANUAL_PAINT_MODEL_H_
+
+#include <vtkImageData.h>
+
+
+class ManualPaintModel {
+public:
+ ManualPaintModel();
+ virtual ~ManualPaintModel();
+
+ void SetImage(vtkImageData *image);
+ void PaintImage(int px,int py, int pz);
+ void SetBrushSize( int brushsize );
+ void SetGrayLevel( double graylevel );
+
+
+
+private:
+ vtkImageData *_image;
+ int _brushsize;
+ double _graylevel;
+
+
+protected:
+
+};
+
+
+#endif // _MANUAL_PAINT_MODEL_H_
--- /dev/null
+
+#include "ManualPaintPanel.h"
+
+
+ManualPaintPanel::ManualPaintPanel()
+{
+ _manualPaintModel=NULL;
+}
+
+//---------------------------------------------------------------------------
+ManualPaintPanel::~ManualPaintPanel()
+{
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetManualPaintModel(ManualPaintModel* manualPaintModel)
+{
+ printf("EED %p ManualPaintPanel::SetManualPaintModel manualPaintModel=%p\n", this, manualPaintModel);
+ _manualPaintModel = manualPaintModel;
+}
+
+
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetBrushSize( int brushsize )
+{
+ printf("EED %p ManualPaintPanel::SetBrushSize manualPaintModel=%p\n", this, _manualPaintModel);
+ if (_manualPaintModel!=NULL)
+ {
+ _manualPaintModel->SetBrushSize( brushsize );
+ } else {
+ printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
+ }
+}
+
+//---------------------------------------------------------------------------
+void ManualPaintPanel::SetGrayLevel( double graylevel )
+{
+ if (_manualPaintModel!=NULL)
+ {
+ _manualPaintModel->SetGrayLevel( graylevel );
+ } else {
+ printf("ERROR in ManualPaintPanel _manualPaintModel not set.\n");
+ }
+}
+
--- /dev/null
+#ifndef _MANUAL_PAINT_PANEL_H_
+#define _MANUAL_PAINT_PANEL_H_
+
+#include "ManualPaintModel.h"
+
+class ManualPaintPanel {
+public:
+ ManualPaintPanel();
+ virtual ~ManualPaintPanel();
+
+ void SetManualPaintModel(ManualPaintModel* manualPaintModel);
+ void SetBrushSize( int brushsize );
+ void SetGrayLevel( double graylevel );
+
+
+private:
+ ManualPaintModel *_manualPaintModel;
+
+protected:
+
+};
+
+
+#endif // _MANUAL_PAINT_PANEL_H_
--- /dev/null
+
+#include "vtkInteractorManualPaint.h"
+
+
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
+
+vtkInteractorManualPaint::vtkInteractorManualPaint(ManualPaintControler* mpc)
+{
+ _manualPaintControler = mpc;
+ _state = false;
+// _auxZ = 0;
+}
+
+//---------------------------------------------------------------------------
+vtkInteractorManualPaint::~vtkInteractorManualPaint()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonDown()
+{
+ vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+ if ( interactor->GetControlKey()==1 ){
+ _state = true;
+// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+// _Z = wxvtk2Dbaseview->GetActualSlice();
+ }
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonUp()
+{
+ _state = false;
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnMouseMove ()
+{
+ if (_state==true)
+ {
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+ int px,py;
+ wxVTKiren->GetEventPosition(px,py);
+
+ int typeView = 2;
+ 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];
+
+ _manualPaintControler->PaintImage((int)X,(int)Y,(int)Z);
+
+/*
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->Modified();
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor()->Modified();
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor()->SetDisplayExtent(0, 50+_auxZ, 0, 50,_Z, _Z );
+ wxvtk2Dbaseview->Refresh();
+ wxvtk2Dbaseview->RefreshView();
+// wxvtk2Dbaseview->SetActualSlice(_Z+_auxZ);
+ _auxZ=(_auxZ+1)%2;
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->Render();
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+*/
+ }// if _state
+ return true;
+}
+
+
--- /dev/null
+#ifndef _VTK_INTERACTOR_MANUAL_PAINT_H_
+#define _VTK_INTERACTOR_MANUAL_PAINT_H_
+
+#include "InteractorStyleMaracas.h"
+#include "ManualPaintControler.h"
+
+class vtkInteractorManualPaint : public InteractorStyleMaracas {
+public:
+ vtkInteractorManualPaint(ManualPaintControler* mpc);
+ virtual ~vtkInteractorManualPaint();
+
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+
+private:
+ bool _state;
+ ManualPaintControler *_manualPaintControler;
+
+protected:
+
+};
+
+
+#endif // _VTK_INTERACTOR_MANUAL_PAINT_H_
--- /dev/null
+
+#include "wxManualPaintPanel.h"
+#include <wx/radiobox.h>
+
+wxManualPaintPanel::wxManualPaintPanel(wxWindow * parent)
+ : wxPanel(parent, -1)
+{
+
+ wxPanel *panel = this;
+ wxSizer *sizer = NULL;
+
+ // 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);
+ 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);
+
+ 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();
+
+ 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();
+
+ 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();
+
+ wxButton *btnCopy = new wxButton( panel, -1, _T("Copy"));
+ btnCopy->Disable();
+ 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(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);
+
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(tittleText);
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(txtBrushSize);
+ 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(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(rb2D3D, 1, wxGROW );
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(rbBrushForm, 1, wxGROW );
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(rbBrushTool, 1, wxGROW );
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(btnCopy, 1, wxGROW );
+ sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+ sizer1->Add(btnUndo, 1, wxGROW );
+
+ sizer = sizer1;
+ panel->SetSizer(sizer);
+ panel->SetAutoLayout(true);
+ panel->Layout();
+}
+
+//---------------------------------------------------------------------------
+wxManualPaintPanel::~wxManualPaintPanel()
+{
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnBrushSize(wxScrollEvent& event)
+{
+ printf("EED %p wxManualPaintPanel::OnBrushSize\n", this);
+ SetBrushSize( sldBrushSize->GetValue() );
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnSldGrayLevel(wxScrollEvent& event)
+{
+ printf("EED %p wxManualPaintPanel::OnGrayLevel\n", this);
+ SetGrayLevel( (double)(sldGrayLevel->GetValue()) );
+
+ wxString 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();
+ if (text.ToDouble(&graylevel))
+ {
+ SetGrayLevel( graylevel );
+ }
+}
+
+
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::On2D3D(wxCommandEvent &event)
+{
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnBrushForm(wxCommandEvent &event)
+{
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnBrushTool(wxCommandEvent &event)
+{
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnCopy(wxCommandEvent &event)
+{
+}
+
+//---------------------------------------------------------------------------
+void wxManualPaintPanel::OnUndo(wxCommandEvent &event)
+{
+}
--- /dev/null
+#ifndef _WX_MANUAL_PAINT_PANEL_H_
+#define _WX_MANUAL_PAINT_PANEL_H_
+
+#include "ManualPaintPanel.h"
+#include <wx/wx.h>
+#include <wx/panel.h>
+
+class wxManualPaintPanel : public wxPanel , public ManualPaintPanel {
+public:
+ wxManualPaintPanel(wxWindow * parent);
+ virtual ~wxManualPaintPanel();
+ void OnBrushSize(wxScrollEvent& event);
+ void OnSldGrayLevel(wxScrollEvent& event);
+ void OnCtrTxtGrayLevel(wxCommandEvent &event);
+ void On2D3D(wxCommandEvent &event);
+ void OnBrushForm(wxCommandEvent &event);
+ void OnBrushTool(wxCommandEvent &event);
+ void OnCopy(wxCommandEvent &event);
+ void OnUndo(wxCommandEvent &event);
+
+
+private:
+ wxSlider *sldBrushSize;
+ wxSlider *sldGrayLevel;
+ wxTextCtrl *graylevelCtrl;
+
+protected:
+
+};
+
+
+#endif // _WX_MANUAL_PAINT_PANEL_H_