#include <wxEmptyPanelWidget.h>
Public Member Functions | |
wxEmptyPanelWidget (wxWindow *parent) | |
~wxEmptyPanelWidget () | |
void | ConfigureVTK (vtkImageData *imagedata, int x, int y, int z) |
void | Refresh () |
void | OnOpacity1 (wxScrollEvent &event) |
void | OnOpacity2 (wxScrollEvent &event) |
void | OnIsoValue (wxScrollEvent &event) |
Private Member Functions | |
wxPanel * | CreateControlPanel (wxWindow *parent) |
wxPanel * | CreateViewPanel (wxWindow *parent) |
Private Attributes | |
vtkMarchingCubes * | _mCubes |
vtkPolyDataMapper * | _surfMapper |
vtkActor * | _surfActor |
axisExtractor02 * | _prgov |
vtkPolyDataMapper * | _mapfinal |
vtkActor * | _stripfinal |
vtkPolyDataMapper * | _isoMapperMC6 |
vtkActor * | _isoActorMC6 |
vtkMarchingCubes * | _isoMC6 |
wxSlider * | _opacity1 |
wxSlider * | _opacity2 |
wxSlider * | _isoValue |
wxVtk3DBaseView * | _imageviewer3D |
Definition at line 26 of file wxEmptyPanelWidget.h.
wxEmptyPanelWidget::wxEmptyPanelWidget | ( | wxWindow * | parent | ) |
Definition at line 49 of file wxEmptyPanelWidget.cxx.
References _isoActorMC6, _isoMapperMC6, _isoMC6, _mapfinal, _mCubes, _prgov, _stripfinal, _surfActor, _surfMapper, CreateControlPanel(), and CreateViewPanel().
00050 : wxPanel( parent, -1) 00051 { 00052 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL ); 00053 wxSplitterWindow *pnlSplitter = new wxSplitterWindow( this , -1); 00054 wxPanel *viewPanel = CreateViewPanel(pnlSplitter); 00055 wxPanel *controlPanel = CreateControlPanel(pnlSplitter); 00056 00057 sizer -> Add( pnlSplitter ,1,wxGROW ,0); 00058 pnlSplitter -> SetMinimumPaneSize( 150 ); 00059 pnlSplitter -> SplitVertically( viewPanel, controlPanel, 600 ); 00060 this -> SetSizer(sizer); 00061 00062 // Original Volule 00063 _mCubes = NULL; 00064 _surfMapper = NULL; 00065 _surfActor = NULL; 00066 00067 // Result: Volume + Axis 00068 _prgov = NULL; 00069 _mapfinal = NULL; 00070 _stripfinal = NULL; 00071 _isoMapperMC6 = NULL; 00072 _isoActorMC6 = NULL; 00073 _isoMC6 = NULL; 00074 }
wxEmptyPanelWidget::~wxEmptyPanelWidget | ( | ) |
Definition at line 76 of file wxEmptyPanelWidget.cxx.
References _isoActorMC6, _isoMapperMC6, _isoMC6, _mapfinal, _mCubes, _prgov, _stripfinal, _surfActor, and _surfMapper.
00076 { 00077 00078 // Original Volule 00079 _mCubes -> Delete(); 00080 _surfMapper -> Delete(); 00081 _surfActor -> Delete(); 00082 00083 // Result: Volume + Axis 00084 _prgov -> Delete(); 00085 _mapfinal -> Delete(); 00086 _stripfinal -> Delete(); 00087 _isoMapperMC6 -> Delete(); 00088 _isoActorMC6 -> Delete(); 00089 _isoMC6 -> Delete(); 00090 }
void wxEmptyPanelWidget::ConfigureVTK | ( | vtkImageData * | imagedata, | |
int | x, | |||
int | y, | |||
int | z | |||
) |
Definition at line 148 of file wxEmptyPanelWidget.cxx.
References _imageviewer3D, _isoActorMC6, _isoMapperMC6, _isoMC6, _isoValue, _mapfinal, _mCubes, _opacity1, _opacity2, _prgov, _stripfinal, _surfActor, _surfMapper, wxVtk3DBaseView::Configure(), axisExtractor02::GetOutput(), wxVtk3DBaseView::GetRenderer(), axisExtractor02::GetVolumen(), axisExtractor02::New(), axisExtractor02::SetInput(), axisExtractor02::SetMaxant(), axisExtractor02::SetMinant(), axisExtractor02::SetParam(), axisExtractor02::SetParam2(), axisExtractor02::SetParam3(), and axisExtractor02::SetPoint().
Referenced by wxMaracasEmptyPanel::ConfigureVTK().
00149 { 00150 wxBusyCursor wait; 00151 _imageviewer3D->Configure(); 00152 00153 double puntoactualprov[3]; 00154 puntoactualprov[0]=x; 00155 puntoactualprov[1]=y; 00156 puntoactualprov[2]=z; 00157 00158 double espprin[3]; 00159 int extprin[6]; 00160 00161 imagedata->GetSpacing(espprin); 00162 imagedata->GetExtent(extprin); 00163 00164 puntoactualprov[0]=puntoactualprov[0]*espprin[0]; 00165 puntoactualprov[1]=puntoactualprov[1]*espprin[1]; 00166 puntoactualprov[2]=puntoactualprov[2]*espprin[2]; 00167 00168 /* Old 00169 // Juan Francisco Carrillo Filter 00170 _prgov= axisExtractor::New(); 00171 _prgov->SetHumbral(0.45); 00172 _prgov->SetInput(imagedata); 00173 _prgov->SetPoint(puntoactualprov); 00174 _prgov->Update(); 00175 */ 00176 00177 // Juan Francisco Carrillo Filter 00178 _prgov= axisExtractor02::New(); 00179 _prgov->SetParam(1); 00180 _prgov->SetParam2(1); 00181 _prgov->SetParam3(0.5); 00182 _prgov->SetMaxant(20); 00183 _prgov->SetMinant(5); 00184 _prgov->SetInput(imagedata); 00185 _prgov->SetPoint(puntoactualprov); 00186 _prgov->Update(); 00187 00188 00189 vtkPolyDataWriter *writer = vtkPolyDataWriter::New(); 00190 writer->SetInput(_prgov->GetOutput()); 00191 writer->SetFileName("c:/temp/salida_JF.vtk"); 00192 writer->SetFileTypeToASCII(); 00193 writer->Write(); 00194 00195 00196 // Visualisation - result vascular tree 00197 _mapfinal = vtkPolyDataMapper::New(); 00198 _mapfinal->SetInput(_prgov->GetOutput()); 00199 00200 _stripfinal = vtkActor::New(); 00201 _stripfinal->SetMapper(_mapfinal); 00202 _stripfinal->GetProperty()->SetColor(1, 1, 1); 00203 _stripfinal->GetProperty()->SetLineWidth(2); 00204 00205 _stripfinal->GetProperty()->BackfaceCullingOff(); 00206 00207 // Visualisation - result volume 00208 vtkImageData *imageOut = _prgov->GetVolumen(); 00209 imageOut->Update(); 00210 00211 _isoMC6 = vtkMarchingCubes::New(); 00212 _isoMC6->SetInput(imageOut); 00213 _isoMC6->SetValue(0, 1); 00214 _isoMC6->Update(); 00215 00216 _isoMapperMC6 = vtkPolyDataMapper::New(); 00217 _isoMapperMC6->SetInput(_isoMC6->GetOutput()); 00218 _isoMapperMC6->ScalarVisibilityOff(); 00219 _isoMapperMC6->ImmediateModeRenderingOn(); 00220 00221 _isoActorMC6 = vtkActor::New(); 00222 _isoActorMC6->SetMapper(_isoMapperMC6); 00223 _isoActorMC6->GetProperty()->SetColor( 0, 1, 0); 00224 _isoActorMC6->GetProperty()->SetOpacity(0.25); 00225 00226 // Visualisation - original volume 00227 double range[2]; 00228 imagedata->GetScalarRange( range ); 00229 00230 _mCubes = vtkMarchingCubes::New( ); 00231 _mCubes->SetInput( imagedata ); 00232 _mCubes->SetValue( 0, range[1] / 4 ); 00233 00234 vtkStripper *stripper = vtkStripper::New(); 00235 stripper->SetInput( _mCubes->GetOutput( ) ); 00236 00237 _surfMapper = vtkPolyDataMapper::New( ); 00238 _surfMapper->SetInput( stripper->GetOutput() ); 00239 _surfMapper->ScalarVisibilityOff( ); 00240 stripper->Delete(); 00241 00242 _surfActor = vtkActor::New( ); 00243 _surfActor->SetMapper( _surfMapper ); 00244 _surfActor->PickableOff( ); 00245 _surfActor->GetProperty( )->SetColor( 0.9803, 0.9215, 0.8392 ); 00246 _surfActor->GetProperty( )->SetOpacity( 0.3 ); 00247 00248 00249 // Update Controls 00250 _isoValue->SetRange( (int)(range[0]), (int)(range[1]) ); 00251 _isoValue->SetValue( (int)(range[1]/4) ); 00252 _opacity1->SetValue( (int)(_surfActor->GetProperty( )->GetOpacity( )*100) ); 00253 _opacity2->SetValue( (int)(_isoActorMC6->GetProperty( )->GetOpacity( )*100)); 00254 00255 // Interface Update 00256 vtkRenderer *ren = _imageviewer3D->GetRenderer(); 00257 ren->AddActor(_surfActor); 00258 ren->AddActor(_isoActorMC6); 00259 ren->AddActor(_stripfinal); 00260 00261 }
wxPanel * wxEmptyPanelWidget::CreateControlPanel | ( | wxWindow * | parent | ) | [private] |
Definition at line 108 of file wxEmptyPanelWidget.cxx.
References _isoValue, _opacity1, _opacity2, OnIsoValue(), OnOpacity1(), and OnOpacity2().
Referenced by wxEmptyPanelWidget().
00109 { 00110 wxPanel *panel = new wxPanel(parent,-1); 00111 _opacity1 = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); 00112 _isoValue = new wxSlider( panel, -1, 0 , 0, 3000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); 00113 _opacity2 = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); 00114 _opacity1->SetSize(250,20); // Original Volume 00115 _isoValue->SetSize(250,20); 00116 _opacity2->SetSize(250,20); // Result Volume 00117 wxFlexGridSizer *sizer = new wxFlexGridSizer(1); 00118 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00119 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00120 sizer->Add(new wxStaticText(panel,-1,_T("Isovalue - Original Volume"))); 00121 sizer->Add(_isoValue); 00122 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00123 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00124 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00125 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00126 sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Original Volume"))); 00127 sizer->Add(_opacity1); 00128 sizer->Add(new wxStaticText(panel,-1,_T(" "))); 00129 sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume"))); 00130 sizer->Add(_opacity2); 00131 00132 panel->SetSizer(sizer); 00133 panel->SetAutoLayout(true); 00134 panel->SetSize(400,400); 00135 panel->Layout(); 00136 Connect(_opacity1->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget::OnOpacity1 ); 00137 Connect(_isoValue->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxEmptyPanelWidget::OnIsoValue ); 00138 Connect(_opacity2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget::OnOpacity2 ); 00139 return panel; 00140 }
wxPanel * wxEmptyPanelWidget::CreateViewPanel | ( | wxWindow * | parent | ) | [private] |
Definition at line 92 of file wxEmptyPanelWidget.cxx.
References _imageviewer3D, and wxVtkBaseView::GetWxVTKRenderWindowInteractor().
Referenced by wxEmptyPanelWidget().
00093 { 00094 wxPanel *panel = new wxPanel(parent,-1); 00095 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00096 00097 _imageviewer3D = new wxVtk3DBaseView(panel); 00098 wxVTKRenderWindowInteractor *iren = _imageviewer3D->GetWxVTKRenderWindowInteractor(); 00099 sizer->Add(iren , 1, wxEXPAND, 0); 00100 00101 panel->SetSizer(sizer); 00102 panel->SetAutoLayout(true); 00103 panel->SetSize(400,400); 00104 panel->Layout(); 00105 return panel; 00106 }
void wxEmptyPanelWidget::OnIsoValue | ( | wxScrollEvent & | event | ) |
Definition at line 278 of file wxEmptyPanelWidget.cxx.
References _isoValue, _mCubes, and Refresh().
Referenced by CreateControlPanel().
00278 { 00279 wxBusyCursor wait; 00280 _mCubes->SetValue(0, _isoValue->GetValue()); 00281 Refresh(); 00282 }
void wxEmptyPanelWidget::OnOpacity1 | ( | wxScrollEvent & | event | ) |
Definition at line 266 of file wxEmptyPanelWidget.cxx.
References _opacity1, _surfActor, and Refresh().
Referenced by CreateControlPanel().
00266 { 00267 double value = ((double)_opacity1->GetValue())/100; 00268 _surfActor->GetProperty( )->SetOpacity( value ); 00269 Refresh(); 00270 }
void wxEmptyPanelWidget::OnOpacity2 | ( | wxScrollEvent & | event | ) |
Definition at line 272 of file wxEmptyPanelWidget.cxx.
References _isoActorMC6, _opacity2, and Refresh().
Referenced by CreateControlPanel().
00272 { 00273 double value = ((double)_opacity2->GetValue())/100; 00274 _isoActorMC6->GetProperty( )->SetOpacity( value ); 00275 Refresh(); 00276 }
void wxEmptyPanelWidget::Refresh | ( | ) |
Definition at line 142 of file wxEmptyPanelWidget.cxx.
References _imageviewer3D, and wxVtk3DBaseView::Refresh().
Referenced by OnIsoValue(), OnOpacity1(), and OnOpacity2().
00143 { 00144 _imageviewer3D->Refresh(); 00145 }
Definition at line 54 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), CreateViewPanel(), and Refresh().
vtkActor* wxEmptyPanelWidget::_isoActorMC6 [private] |
Definition at line 47 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), OnOpacity2(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkPolyDataMapper* wxEmptyPanelWidget::_isoMapperMC6 [private] |
Definition at line 46 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkMarchingCubes* wxEmptyPanelWidget::_isoMC6 [private] |
Definition at line 48 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
wxSlider* wxEmptyPanelWidget::_isoValue [private] |
Definition at line 53 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), CreateControlPanel(), and OnIsoValue().
vtkPolyDataMapper* wxEmptyPanelWidget::_mapfinal [private] |
Definition at line 44 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkMarchingCubes* wxEmptyPanelWidget::_mCubes [private] |
Definition at line 38 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), OnIsoValue(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
wxSlider* wxEmptyPanelWidget::_opacity1 [private] |
Definition at line 51 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), CreateControlPanel(), and OnOpacity1().
wxSlider* wxEmptyPanelWidget::_opacity2 [private] |
Definition at line 52 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), CreateControlPanel(), and OnOpacity2().
axisExtractor02* wxEmptyPanelWidget::_prgov [private] |
Definition at line 43 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkActor* wxEmptyPanelWidget::_stripfinal [private] |
Definition at line 45 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkActor* wxEmptyPanelWidget::_surfActor [private] |
Definition at line 40 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), OnOpacity1(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().
vtkPolyDataMapper* wxEmptyPanelWidget::_surfMapper [private] |
Definition at line 39 of file wxEmptyPanelWidget.h.
Referenced by ConfigureVTK(), wxEmptyPanelWidget(), and ~wxEmptyPanelWidget().