wxProcessingCTWidget.cxx

Go to the documentation of this file.
00001 
00002 #include "vtkActor.h"
00003 #include "vtkCylinderSource.h"
00004 #include "vtkPolyDataMapper.h"
00005 #include "vtkRenderer.h"
00006 #include "vtkRenderWindow.h"
00007 #include "vtkRenderWindowInteractor.h"
00008 #include "vtkProperty.h"
00009 #include "vtkCamera.h"
00010 #include "vtkPoints.h"
00011 #include "vtkCellArray.h"
00012 #include "vtkPolyData.h"
00013 #include "vtkPolyDataMapper.h"
00014 #include "vtkPolyDataWriter.h"
00015 #include "vtkPolyDataReader.h"
00016 #include "vtkImageReader.h"
00017 #include "vtkImageViewer.h"
00018 #include "vtkImageViewer2.h"
00019 #include "vtkImageToStructuredPoints.h"
00020 
00021 #include "vtkExtractVOI.h"
00022 #include "vtkImageClip.h"
00023 #include "vtkImageResample.h"
00024 #include "vtkImageCast.h"
00025 #include "vtkImageThreshold.h"
00026 #include "vtkImageCast.h"
00027 #include "vtkImageSeedConnectivity.h"
00028 #include "vtkImageData.h"
00029 #include "vtkMarchingCubes.h"
00030 #include "vtkImageReslice.h"
00031 #include "vtkTransform.h"
00032 #include "vtkSphereSource.h"
00033 #include "vtkDoubleArray.h"
00034 #include "vtkPointData.h"
00035 #include "vtkCommand.h"
00036 #include "vtkCallbackCommand.h"
00037 #include "vtkImageResample.h"
00038 #include "vtkMath.h"
00039 #include "vtkStripper.h"
00040 #include "vtkImageWriter.h"
00041 #include "vtkBMPWriter.h"
00042 #include "vtkImageCast.h"
00043 #include "vtkPolyDataWriter.h"
00044 
00045 #include "wxProcessingCTWidget.h"
00046 
00047 #include <wx/splitter.h>
00048 #include <wx/renderer.h>
00049 //-------------------------------------------------------------------
00050 //-------------------------------------------------------------------
00051 //-------------------------------------------------------------------
00052 
00053 
00054 
00055 BEGIN_EVENT_TABLE( wxProcessingCTWidget, wxPanel )
00056         EVT_MENU( 12121, wxProcessingCTWidget::OnRefreshView )
00057 END_EVENT_TABLE( );
00058 
00059 //-------------------------------------------------------------------
00060 
00061 
00062 wxProcessingCTWidget::wxProcessingCTWidget(wxWindow *parent, marInterfaceCT *mar)
00063 : wxPanel( parent, -1) 
00064 {
00065         wxSplitterWindow                *pnlSplitter            = new wxSplitterWindow( this , -1);
00066         wxPanel                         *viewPanel              = CreateViewPanel(pnlSplitter);
00067         wxPanel                         *controlPanel           = CreateControlPanel(pnlSplitter);
00068 
00069         pnlSplitter     -> SplitVertically( viewPanel, controlPanel ,300);
00070         pnlSplitter     -> SetMinimumPaneSize( 300 );
00071 
00072         wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL  );
00073         sizer           -> Add( pnlSplitter ,1,wxALL|wxGROW  ,0);
00074         this            -> SetSizer(sizer);
00075         this->SetAutoLayout(true);
00076 //      panel->SetSize(400,400);
00077         this->Layout();
00078 
00079 //EEDxx2.4
00080 //      FitInside();
00081         _mar = mar;
00082         _range[0]=0;
00083         _range[1]=255;  
00084 
00085 }
00086 //-------------------------------------------------------------------
00087 wxProcessingCTWidget::~wxProcessingCTWidget(){
00088 // MAZV 27 sep 2006
00089 //      _thresh->Delete();
00090 //      _connect->Delete();
00091 
00092         _connect2->Delete();
00093         
00094         _thresh2->Delete();
00095 
00096         delete _imageviewer2D_1;
00097         delete _imageviewer2D_2;
00098         delete _imageviewer2D_3;
00099 }
00100 //-------------------------------------------------------------------
00101 wxPanel* wxProcessingCTWidget::CreateViewPanel(wxWindow *parent)
00102 {
00103         wxPanel *panel          =       new wxPanel(parent,-1);
00104     wxBoxSizer *sizer   =       new wxBoxSizer(wxVERTICAL);
00105 
00106         _imageviewer2D_1 = new wxVtk2DBaseView(panel);
00107         _imageviewer2D_2 = new wxVtk2DBaseView(panel);
00108         _imageviewer2D_3 = new wxVtk2DBaseView(panel);
00109         wxVTKRenderWindowInteractor *iren   = _imageviewer2D_1->GetWxVTKRenderWindowInteractor();
00110         wxVTKRenderWindowInteractor *iren_2 = _imageviewer2D_2->GetWxVTKRenderWindowInteractor();
00111         wxVTKRenderWindowInteractor *iren_3 = _imageviewer2D_3->GetWxVTKRenderWindowInteractor();
00112         sizer->Add(iren , 1, wxGROW, 0);
00113         sizer->Add(iren_2, 1, wxGROW, 0);
00114         sizer->Add(iren_3, 1, wxGROW, 0);
00115 
00116 
00117         panel->SetSizer(sizer);
00118         panel->SetAutoLayout(true);
00119 //      panel->SetSize(400,400);
00120         panel->Layout();
00121         return panel;
00122 }
00123 //-------------------------------------------------------------------
00124 wxPanel* wxProcessingCTWidget::CreateControlPanel(wxWindow *parent)
00125 {
00126         _parent=parent;
00127         wxPanel *panel          = new wxPanel(parent,-1);
00128         _lowthreshold           = new wxSlider( panel, -1,65000 , 64000, 65000, wxDefaultPosition, wxSize(25,25), wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS  );
00129         _lowthreshold->SetTickFreq(50,0);
00130 
00131         _midthreshold           = new wxSlider( panel, -1, 65000 , 64000, 65000, wxDefaultPosition, wxSize(25,25), wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS );
00132         _midthreshold->SetTickFreq(50,0);
00133 
00134 
00135         _lowthresholdSpin1      = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
00136         _lowthresholdSpin1->SetRange(1,8);
00137         _lowthresholdSpin1->SetValue(5);
00138         Connect(_lowthresholdSpin1->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED      , (wxObjectEventFunction) &wxProcessingCTWidget::OnSpinLowThresholdSpin1 ); 
00139 //      Connect(_lowthresholdSpin1->GetId()  , wxEVT_SCROLL_THUMBTRACK   , (wxObjectEventFunction) &wxProcessingCTWidget::OnSpinLowThresholdSpin1 ); 
00140 
00141         _lowthresholdSpin2      = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
00142         _lowthresholdSpin2->SetRange(1,8);
00143         _lowthresholdSpin2->SetValue(5);
00144         Connect(_lowthresholdSpin2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED      , (wxObjectEventFunction) &wxProcessingCTWidget::OnSpinLowThresholdSpin2 ); 
00145 //      Connect(_lowthresholdSpin2->GetId()  , wxEVT_SCROLL_THUMBTRACK   , (wxObjectEventFunction) &wxProcessingCTWidget::OnSpinLowThresholdSpin2 ); 
00146 
00147 
00148 
00149 // MAZV 27 sep 2006
00150 //      _highthreshold          = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00151         _zslice                         = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxSize(25,25), wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS );
00152         _zslice->SetTickFreq(10,0);
00153         _extract                        = new wxButton( panel, -1, _T("Axis extraction"));
00154 //      _midthreshold->SetSize(250,20);
00155 // MAZV 27 sep 2006
00156         //_highthreshold->SetSize(250,20);  // Result Volume
00157 
00158 //          wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
00159     wxBoxSizer *sizer   = new wxBoxSizer(wxVERTICAL );
00160 
00161         int flag = wxALL | wxGROW ;
00162 
00163         sizer->Add(new wxStaticText(panel,-1,_T("  "))                                                  , 1, flag, 0);
00164         sizer->Add(new wxStaticText(panel,-1,_T("  "))                                                  , 1, flag, 0);
00165         sizer->Add(new wxStaticText(panel,-1,_T("Lower vascular threshold"))                            , 1, flag, 0);  
00166 
00167     wxBoxSizer *sizerLowThreshold       = new wxBoxSizer(wxHORIZONTAL );
00168         sizerLowThreshold->Add(_lowthresholdSpin1                                                       );
00169         sizerLowThreshold->Add(_lowthreshold                                                            , 1, wxALL | wxGROW , 0);
00170         sizer->Add(sizerLowThreshold                                                                    , 1, wxALL | wxGROW , 0);
00171 
00172         sizer->Add(new wxStaticText(panel,-1,_T("  "))                                                  , 1, flag, 0);
00173         sizer->Add(new wxStaticText(panel,-1,_T("Higher vascular threshold"))                           , 1, flag, 0);
00174 
00175     wxBoxSizer *sizerMidThreshold       = new wxBoxSizer(wxHORIZONTAL );
00176         sizerMidThreshold->Add(_lowthresholdSpin2                                                       );
00177         sizerMidThreshold->Add(_midthreshold                                                            , 1, flag, 0);
00178         sizer->Add(sizerMidThreshold                                                                    , 1, flag, 0);
00179         
00180 
00181 // MAZV 27 sep 2006
00182 //      sizer->Add(new wxStaticText(panel,-1,"  "));
00183 //      sizer->Add(new wxStaticText(panel,-1,"Calcification threshold"));
00184 //      sizer->Add(_highthreshold);
00185 
00186 
00187         sizer->Add(new wxStaticText(panel,-1,_T("  "))                                                  , 1, flag, 0);
00188         sizer->Add(new wxStaticText(panel,-1,_T("Z Slice"))                                             , 1, flag, 0);
00189         sizer->Add(_zslice                                                                              , 1, flag, 0);
00190         sizer->Add(new wxStaticText(panel,-1,_T("  "))                                                  , 1, flag, 0);
00191         sizer->Add(_extract                                                                             , 1, flag, 0);
00192 
00193 //      panel->SetSize(200,200);
00194         panel->SetSizer(sizer);
00195         panel->SetAutoLayout(true);
00196         panel->Layout();
00197 //      panel->FitInside(parent);
00198 
00199         Connect(_lowthreshold->GetId()  , wxEVT_SCROLL_CHANGED                  , (wxObjectEventFunction) &wxProcessingCTWidget::OnLowThreshold); 
00200         Connect(_lowthreshold->GetId()  , wxEVT_SCROLL_THUMBTRACK               , (wxObjectEventFunction) &wxProcessingCTWidget::OnLowThreshold); 
00201         Connect(_midthreshold->GetId()  , wxEVT_SCROLL_CHANGED                  , (wxObjectEventFunction) &wxProcessingCTWidget::OnMidThreshold ); 
00202         Connect(_midthreshold->GetId()  , wxEVT_SCROLL_THUMBTRACK               , (wxObjectEventFunction) &wxProcessingCTWidget::OnMidThreshold ); 
00203 
00204 
00205 // MAZV 27 sep 2006
00206 //  Connect(_highthreshold->GetId() , wxEVT_SCROLL_THUMBTRACK           , (wxObjectEventFunction) &wxProcessingCTWidget::OnHighThreshold );
00207 
00208         Connect(_zslice->GetId()                , wxEVT_SCROLL_CHANGED                  , (wxObjectEventFunction) &wxProcessingCTWidget::OnZSlice );
00209         Connect(_zslice->GetId()                , wxEVT_SCROLL_THUMBTRACK               , (wxObjectEventFunction) &wxProcessingCTWidget::OnZSlice );
00210 
00211         Connect(_extract->GetId()               , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxProcessingCTWidget::OnExtract );
00212         return panel;
00213 }
00214 
00215 
00216 //------------------------------------------------------------------------
00217 
00218 void wxProcessingCTWidget::Refresh()
00219 {
00220         int z = (int)(_vtkbasedata_1->GetZ( ));
00221 
00222         _vtkbasedata_1->SetZ( z );
00223         _vtkbasedata_2->SetZ( z );
00224         _vtkbasedata_3->SetZ( z );
00225 
00226         _imageviewer2D_3->Refresh();
00227         _imageviewer2D_1->Refresh();
00228         _imageviewer2D_2->Refresh();
00229 
00230         _imageviewer2D_3->RefreshView();
00231         _imageviewer2D_1->RefreshView();
00232         _imageviewer2D_2->RefreshView();
00233 
00234 
00235 }
00236 
00237 //----------------------------------------------------------------------------
00238 void wxProcessingCTWidget::OnSpinLowThresholdSpin1(wxScrollEvent& event)
00239 {
00240         int value = _lowthreshold->GetValue();
00241         int delta = (int) (pow( 4 , _lowthresholdSpin1->GetValue() ));
00242         int min   = value - delta/2;
00243         int max   = value + delta/2;
00244         if (min<0)
00245         {
00246                 min=0;
00247                 max=delta;
00248         }
00249         _lowthreshold->SetRange(min,max);
00250 }
00251 
00252 //----------------------------------------------------------------------------
00253 void wxProcessingCTWidget::OnSpinLowThresholdSpin2(wxScrollEvent& event)
00254 {
00255         int value = _midthreshold->GetValue();
00256         int delta = (int)(pow( 4 , _lowthresholdSpin2->GetValue() ));
00257         int min=value - delta/2;
00258         int max=value + delta/2;
00259         if (min<0)
00260         {
00261                 min=0;
00262                 max=delta;
00263         }
00264         _midthreshold->SetRange(min,max);
00265 }
00266 
00267 
00268 //----------------------------------------------------------------------------
00269 void wxProcessingCTWidget::OnRefreshView(wxCommandEvent & event)
00270 {
00271         Refresh();
00272 }
00273 
00274 //------------------------------------------------------------------------
00275 
00276 void wxProcessingCTWidget::ConfigureVTK(marImageData *marimagedata, int x, int y, int z)
00277 {
00278     wxBusyCursor wait;
00279 
00280         _x = x;
00281         _y = y;
00282         _z = z;
00283 
00284         vtkImageData *imagedata=marimagedata->GetImageData();
00285         imagedata->UpdateInformation();
00286         imagedata->SetUpdateExtent(imagedata->GetWholeExtent());
00287         imagedata->Update();
00288 
00289         data = imagedata;
00290 
00291         double puntoactualprov[3];
00292         puntoactualprov[0] = x;
00293         puntoactualprov[1] = y;
00294         puntoactualprov[2] = z;
00295 
00296         double espprin[3];
00297         int extprin[6];                         
00298         
00299         imagedata->GetSpacing(espprin);
00300         imagedata->GetExtent(extprin);
00301 
00302 
00303 // MAZV 27 sep 2006
00304 //      puntoactualprov[0]=puntoactualprov[0]*espprin[0];
00305 //      puntoactualprov[1]=puntoactualprov[1]*espprin[1];
00306 //      puntoactualprov[2]=puntoactualprov[2]*espprin[2];
00307         
00308     imagedata->GetScalarRange( _range );
00309 
00310 
00311         // Update Controls
00312         _lowthreshold->SetRange( (int)(_range[0]), (int)(_range[1]));
00313         _lowthreshold->SetValue( (int)(_range[1]/4) );
00314 
00315         _midthreshold->SetRange( (int)(_range[0]),  (int)(_range[1]));
00316         _midthreshold->SetValue( (int)(_range[1]/2) );
00317 
00318 // MAZV 27 sep 2006
00319 //      _highthreshold->SetRange(_range[0], _range[1]);
00320 //      _highthreshold->SetValue( _range[1] );
00321 
00322         _zslice->SetRange(extprin[4], extprin[5]);
00323         _zslice->SetValue(extprin[5]/2);
00324     
00325         
00326         _thresh = vtkImageThreshold::New();
00327         _thresh->SetInput(imagedata);
00328         //_thresh->ReleaseDataFlagOff();
00329         _thresh->SetInValue(255);
00330         _thresh->SetOutputScalarTypeToUnsignedShort();
00331         _thresh->SetOutValue(0);
00332         _thresh->ThresholdBetween(_lowthreshold->GetValue(), _range[1]);
00333 
00334         vtkImageCast *cast = vtkImageCast::New();
00335         cast->SetInput(_thresh->GetOutput());
00336         cast->SetOutputScalarTypeToUnsignedChar();
00337         cast->Update();
00338 
00339   
00340         _connect = vtkImageSeedConnectivity::New();
00341         _connect->SetInput(cast->GetOutput());
00342         _connect->SetInputConnectValue(255);
00343         _connect->SetOutputConnectedValue(255);
00344         _connect->SetOutputUnconnectedValue(0);
00345         _connect->AddSeed( (int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
00346         _connect->Update();
00347 
00348         cast3 = vtkImageCast::New();
00349         cast3->SetInput(_connect->GetOutput());
00350         cast3->SetOutputScalarTypeToUnsignedShort();
00351         cast3->Update();
00352 
00353         _thresh2 = vtkImageThreshold::New();
00354         _thresh2->SetInput(imagedata);
00355         //_thresh2->ReleaseDataFlagOff();
00356         _thresh2->SetInValue(255);
00357         _thresh2->SetOutputScalarTypeToUnsignedShort();
00358         _thresh2->SetOutValue(0);
00359         _thresh2->ThresholdBetween(_lowthreshold->GetValue(), _midthreshold->GetValue());
00360 
00361         vtkImageCast *cast2 = vtkImageCast::New();
00362         cast2->SetInput(_thresh2->GetOutput());
00363         cast2->SetOutputScalarTypeToUnsignedChar();
00364         cast2->Update();
00365 
00366 
00367         _connect2 = vtkImageSeedConnectivity::New();
00368         _connect2->SetInput(cast2->GetOutput());
00369         _connect2->SetInputConnectValue(255);
00370         _connect2->SetOutputConnectedValue(255);
00371         _connect2->SetOutputUnconnectedValue(0);
00372         _connect2->AddSeed(  (int)(puntoactualprov[0]),  (int)(puntoactualprov[1]),  (int)(puntoactualprov[2]) );
00373         _connect2->Update();
00374 
00375         cast4 = vtkImageCast::New();
00376         cast4->SetInput(_connect2->GetOutput());
00377         cast4->SetOutputScalarTypeToUnsignedShort();
00378         cast4->Update();
00379 
00380         // Interface Update
00381 
00382         _vtkbasedata_1 = new vtkBaseData();
00383         _vtkbasedata_1->SetMarImageData(marimagedata);
00384         
00385 
00386         cast3->GetOutput()->UpdateInformation();
00387         cast3->GetOutput()->SetUpdateExtent( cast3->GetOutput()->GetWholeExtent() );
00388         cast3->GetOutput()->SetUpdateExtent( cast3->GetOutput()->GetWholeExtent() );
00389         
00390         cast3->GetOutput()->Update();
00391         _vtkbasedata_2 = new vtkBaseData();
00392         _vtkbasedata_2->SetMarImageData( new marImageData(cast3->GetOutput()) );
00393 
00394 
00395         cast4->GetOutput()->UpdateInformation();
00396         cast4->GetOutput()->SetUpdateExtent(cast4->GetOutput()->GetWholeExtent());
00397         cast4->GetOutput()->Update();
00398         _vtkbasedata_3 = new vtkBaseData();
00399         _vtkbasedata_3->SetMarImageData( new marImageData(cast4->GetOutput() ));
00400 
00401         _imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1  );
00402         _imageviewer2D_1->Configure();
00403 
00404         _imageviewer2D_2->SetVtkBaseData( _vtkbasedata_2  );
00405         _imageviewer2D_2->Configure();
00406 
00407         _imageviewer2D_3->SetVtkBaseData( _vtkbasedata_3  );
00408         _imageviewer2D_3->Configure();
00409 // EED 31 Mai 2007
00410 //      Refresh();
00411         
00412 }
00413 
00414 
00415 //------------------------------------------------------------------------
00416 void wxProcessingCTWidget::MidThreshold()
00417 {
00418         _thresh2->ThresholdBetween(_lowthreshold->GetValue(), _midthreshold->GetValue());
00419         _thresh2->Update();
00420 }
00421 
00422 
00423 //------------------------------------------------------------------------
00424 void wxProcessingCTWidget::LowThreshold()
00425 {
00426 // MAZV 27 sep 2006
00427 //      _thresh->ThresholdBetween(_lowthreshold->GetValue(), _highthreshold->GetValue());
00428 //      _thresh->Update();
00429 
00430 // MAZV 3 oct 2006
00431         _thresh->ThresholdBetween(_lowthreshold->GetValue(), _range[1] );
00432         _thresh->Update();
00433         
00434         MidThreshold();
00435 
00436 }
00437 
00438 //------------------------------------------------------------------------
00439 void wxProcessingCTWidget::OnLowThreshold(wxScrollEvent& event)
00440 {       
00441         LowThreshold();
00442         Refresh();
00443 }
00444 //------------------------------------------------------------------------
00445 void wxProcessingCTWidget::OnMidThreshold(wxScrollEvent& event){
00446         MidThreshold();
00447         Refresh();
00448 }
00449 
00450 //------------------------------------------------------------------------
00451 // MAZV 27 sep 2006
00452 //void wxProcessingCTWidget::OnHighThreshold(wxScrollEvent& event){
00453 //   _thresh->ThresholdBetween(_lowthreshold->GetValue(), _highthreshold->GetValue());
00454 //      Refresh();
00455 //}
00456 
00457 //------------------------------------------------------------------------
00458 void wxProcessingCTWidget::OnZSlice(wxScrollEvent& event){
00459         _vtkbasedata_1->SetZ( _zslice->GetValue() );
00460 //      _vtkbasedata_2->SetZ( _zslice->GetValue() );
00461 //      _vtkbasedata_3->SetZ( _zslice->GetValue() );
00462         Refresh();
00463 }
00464 //------------------------------------------------------------------------
00465 void wxProcessingCTWidget::OnExtract(wxCommandEvent& event){
00466         
00467     wxBusyCursor wait;
00468     int ext[6];
00469 
00470     vtkImageChangeInformation* change = vtkImageChangeInformation::New();
00471     change->SetInput( _vtkbasedata_3->GetImageData() );
00472     
00473         _vtkbasedata_3->GetImageData()->GetWholeExtent(ext);
00474     change->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
00475     change->Update();
00476         
00477     vtkImageData *image = change->GetOutput();
00478 
00479     marParameters *marParam  = new marParameters();
00480     marParam->copyFrom ( *(_mar->getParameters()) );
00481     marParam->setDoubleParam( marParameters::e_RescaleIntercept , 0 );
00482     marParam->setDoubleParam( marParameters::e_RescaleSlope     , 1 );
00483 
00484     marExperiment *newExperiment = new marExperiment( marParam );
00485 
00486     kVolume *vol = new kVolume( image  );
00487     newExperiment->setVOI(ext);
00488     newExperiment->initExperiment(vol);
00489     newExperiment->setStartPoint( _x, _y, _z);
00490     newExperiment->extractVascularTree();
00491 
00492         //_mar->_experiment->initExperiment(new kVolume(data));
00493         _mar->appendAxis(newExperiment->getAxis(0));
00494         //_mar->_experiment->setVOI(ext);
00495         _mar->setAxis(0);
00496         _mar->prepareQuantification( );
00497 
00498         wxCommandEvent ev(wxEVT_COMMAND_MENU_SELECTED,20005);
00499         _parent->ProcessEvent( ev );
00500 
00501         int size = _mar->getNumberOfSlices( );
00502 
00503         if (size != 0){
00504                 wxString msg;
00505                 msg.Printf(_T("Axis Extracted"));
00506                 wxMessageDialog(this, msg,_T("Information")).ShowModal();
00507         }
00508         
00509 
00510 /*
00511         FILE *ff;
00512     ff=fopen("c:/Temp/DATOS.txt","a+");
00513         fprintf(ff,"z:%d -  x:%d y:%d\n",size,ext[1]+1,ext[3]+1,ext[5]+1);
00514         fclose(ff);
00515 
00516         vtkImageWriter *w = vtkImageWriter::New();
00517 
00518         
00519         for (int i = 0; i < size; i++){
00520                 std::string path = "C:/TEMP/";
00521                 w->SetInput(_mar->_experiment->getSliceImage(i));
00522                 char *f = "";
00523                 f = itoa(i, f, 10);
00524                 std::string fil(f);
00525 
00526                 path.append(fil.c_str());
00527                 w->SetFileName(path.c_str());
00528                 w->Write();
00529         }
00530         w->Delete();
00531 */
00532 
00533 
00534 /*      vtkBMPWriter *w = vtkBMPWriter::New();
00535         vtkImageCast *c = vtkImageCast::New();
00536 
00537         for (int i = 0; i < size; i++){
00538                 std::string path = "C:/TEMP/";
00539                 
00540 
00541                 c->SetInput(_mar->_experiment->getSliceImage(i));
00542                 c->SetOutputScalarTypeToUnsignedChar();
00543                 c->Update();
00544 
00545                 w->SetInput(c->GetOutput());
00546                 char *f = "";
00547                 f = itoa(i, f, 10);
00548                 std::string fil(f);
00549 
00550                 path.append(fil.c_str());
00551                 path.append(".bmp");
00552                 w->SetFileName(path.c_str());
00553                 w->Write();
00554         }*/
00555 
00556         //Escritura a pcx con LibIDO
00557 /*
00558         for ( int i = 0; i < size; i++){
00559                 PPIMAGE_USHORT imalibido = (PPIMAGE_USHORT) IdImaAlloc(128,128, IMA_USHORT);
00560                 for (int j = 0; j < 128; j++){
00561                         for (int k = 0; k < 128; k++){
00562                                 imalibido[k][j] = (unsigned short)_mar->_experiment->getSliceImage(i)->GetScalarComponentAsDouble(j, k, 0, 0);
00563                         }
00564                 }
00565                 std::string path = "C:/TEMP/";
00566                 char *f = "";
00567                 f = itoa(i, f, 10);
00568                 std::string fil(f);
00569                 path.append(fil.c_str());
00570                 path.append(".pcx");
00571                 PPIMAGE_UCHAR imagennueva =  IdImaRecad16To8(imalibido, -1, -1);
00572                 IdImaWritePCXFile((char*)path.c_str(), imagennueva);
00573                 IdImaClear((PPIMAGE)imalibido);
00574         }
00575 
00576 */
00577 
00578 }
00579 
00580 
00581 //------------------------------------------------------------------------
00582 void wxProcessingCTWidget::SetThreshold(int min ,int max)
00583 {
00584         _lowthreshold->SetValue(min);
00585         _midthreshold->SetValue(max);
00586         LowThreshold();
00587 }
00588 //------------------------------------------------------------------------
00589 void wxProcessingCTWidget::GetThreshold(int *min        ,int *max)
00590 {
00591         *min = _lowthreshold->GetValue();
00592         *max = _midthreshold->GetValue();
00593 }
00594 
00595 
00596 //------------------------------------------------------------------------
00597 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1