]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx
no message
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / Contour / ContourCrownWidget.cxx
index ba64844d8ef8dc08b5e16441471ef8e1bf7bd0b1..d28a6b27c766a2685b0cc229b7d58b535927133c 100644 (file)
@@ -4,45 +4,16 @@
 #include <vtkImageMapToColors.h>
 #include <vtkImageActor.h>
 
-
+#include "wxVtk2DBaseView.h"
+#include "vtkLookupTable.h"
 
 //----------------------------------------------------------------------
-  wxMaracasCoutourTool::wxMaracasCoutourTool(wxWindow *parent, wxVtkBaseView *wxvtkbaseview, vtkImageData* imagedata)
+  wxMaracasCoutourTool::wxMaracasCoutourTool(wxWindow *parent)
     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
   {
-//EED    this->mbbtkContourCrown       = contourcrown;
-    this->imagedata                    = imagedata;
-       this->wxvtkbaseview             = wxvtkbaseview;
        wxPanel *panel                  = this;
     wxSizer *sizer                     = NULL;
        
-       InitVtkImagesResult();
-
-        vtkLookupTable *table = vtkLookupTable::New();
-//      table->SetAlphaRange(128,255);
-     table->SetRange(0, 255); // image intensity range
-//   table->SetValueRange(0.0, 1.0); // from black to white
-     table->SetValueRange(0.0, 255.0); // from black to white
-
-        table->SetTableValue (0, 1.0 , 1.0 , 1.0 , 0.1 );
-        table->SetTableValue (255, 1.0 , 1.0 , 0.0 , 0.1);
-
-//      table->SetTableValue (0, 0.0 , 0.0 , 1.0 , 0.35 );
-//      table->SetTableValue (255, 1.0 , 0.0 , 0.0 , 0.10);
-
-     table->SetSaturationRange(0.0, 0.0); // no color saturation
-     table->SetRampToLinear();
-     table->Build();
-
-       vtkImageMapToColors  *mapperImage = vtkImageMapToColors::New();
-       mapperImage->SetLookupTable(table);
-       mapperImage->SetInput( imagedataMaskResult );
-       vtkImageActor *actorImage       = vtkImageActor::New();
-       actorImage->SetInput( mapperImage->GetOutput() );
-       actorImage->SetOpacity(1);
-
-       wxvtkbaseview->GetRenderer()->AddActor(actorImage);
-
        // Widget interface
        wxButton *btnContourA   = new wxButton( panel, -1, _T("Crown Extern"));
        wxButton *btnContourB   = new wxButton( panel, -1, _T("Crown Intern"));
        }
 
 
-  // ------------------------------------------------------------------------
+       // ------------------------------------------------------------------------
+void wxMaracasCoutourTool::Init(wxVtkBaseView *wxvtkbaseview, vtkImageData* imagedata)
+{
+    this->imagedata                    = imagedata;
+       this->wxvtkbaseview             = wxvtkbaseview;
+       
+       InitVtkImagesResult();
+       
+       vtkLookupTable *table = vtkLookupTable::New();
+       //       table->SetAlphaRange(128,255);
+       table->SetRange(0, 255); // image intensity range
+       //   table->SetValueRange(0.0, 1.0); // from black to white
+       table->SetValueRange(0.0, 255.0); // from black to white
+       
+       table->SetTableValue (0, 1.0 , 1.0 , 1.0 , 0.1 );
+       table->SetTableValue (255, 1.0 , 1.0 , 0.0 , 0.1);
+       
+       //       table->SetTableValue (0, 0.0 , 0.0 , 1.0 , 0.35 );
+       //       table->SetTableValue (255, 1.0 , 0.0 , 0.0 , 0.10);
+       
+       table->SetSaturationRange(0.0, 0.0); // no color saturation
+       table->SetRampToLinear();
+       table->Build();
+       
+       vtkImageMapToColors  *mapperImage = vtkImageMapToColors::New();
+       mapperImage->SetLookupTable(table);
+       mapperImage->SetInput( imagedataMaskResult );
+       vtkImageActor *actorImage       = vtkImageActor::New();
+       actorImage->SetInput( mapperImage->GetOutput() );
+       actorImage->SetOpacity(1);
+       
+       wxvtkbaseview->GetRenderer()->AddActor(actorImage);     
+}
+
 
+  // ------------------------------------------------------------------------
   void wxMaracasCoutourTool::ConfigureVTK()
   {
          double spc[3];
 
 
        _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 );
-       this->wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_1 );
+       ((vtkInteractorStyleBaseView*)this->wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 );
        _manContourControl_1->CreateNewManualContour();
        _manContourControl_1->SetActive(false);
        _mViewContour_1->RefreshContour();
 
 
        _manContourControl_2->SetModelView( _mContourModel_2 , _mViewContour_2 );
-       this->wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_2 );
+       ((vtkInteractorStyleBaseView*)this->wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_2 );
        _manContourControl_2->CreateNewManualContour();
        _manContourControl_2->SetActive(false);
        _mViewContour_2->RefreshContour();
@@ -244,7 +249,7 @@ void wxMaracasCoutourTool::GetMinMaxPoint(int *minPoint,
                                                                                  )
 {
        int i;
-       int     np  = manualviewbaseecontour->GetNumberOfPoints( );  // number of control points
+       //int   np  = manualviewbaseecontour->GetNumberOfPoints( );  // number of control points // JPRx
 
 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
@@ -567,8 +572,9 @@ void wxMaracasCoutourTool::EreaseLastContour(wxCommandEvent& event)
        {
                while(!feof(fd))        
                {
-                       fscanf(fd,"");
-                       fscanf(fd," %s %d",&firstline,&size);
+//             //fscanf(fd," %s %d",&firstline,&size); // JPRx
+                       fscanf(fd," %s %d",firstline,&size);
+
                        _SizesC.push_back(size);
                        for(j=0; j<size; j++)
                        {
@@ -597,7 +603,7 @@ void wxMaracasCoutourTool::EreaseLastContour(wxCommandEvent& event)
        if(fd!=NULL)
        {
                int cont = 0;
-               for(i=0; i<_SizesC.size(); i++)
+               for(i=0; i<(int)(_SizesC.size()); i++)
                {
                        fprintf(fd,"\nNumberOfPoints %d", _SizesC[i] );
                        for(j=0; j<_SizesC[i]; j++)
@@ -637,8 +643,9 @@ void wxMaracasCoutourTool::EreaseLastCP(wxCommandEvent& event)
        {
                while(!feof(fd))        
                {
-                       fscanf(fd,"");
-                       fscanf(fd," %s %d",&firstline,&size);
+                       //fscanf(fd,"");  // ?? JPRx
+                       //fscanf(fd," %s %d",&firstline,&size);// JPRx
+                       fscanf(fd," %s %d",firstline,&size); 
                        _SizesC.push_back(size);
                        for(j=0; j<size; j++)
                        {
@@ -667,7 +674,7 @@ void wxMaracasCoutourTool::EreaseLastCP(wxCommandEvent& event)
        if(fd!=NULL)
        {
                int cont = 0;
-               for(i=0; i<_SizesC.size(); i++)
+               for(i=0; i<(int)(_SizesC.size()); i++)
                {
                        fprintf(fd,"\nNumberOfControlPoints %d", _SizesC[i] );
                        for(j=0; j<_SizesC[i]; j++)