]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx
#3467 Bug refresh Window Color level in 3D planes ViewerNV
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuDrawAxisTree3D.cxx
index 00a2bd6ded9a0fec19e81862dd3c497d4e8e4db8..52ab1bdc6af7c50d896426b4cf80e297a0e0579c 100644 (file)
@@ -44,6 +44,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxisTree3D,bbtk::AtomicBlackBox);
 
 void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 {
+printf("8.1 ");
        vtkPolyData                     *polydata               = vtkPolyData::New( );
        vtkPolyDataMapper       *polydatamapper = vtkPolyDataMapper::New();
        vtkActor                        *vtkactor               = vtkActor::New();
@@ -58,10 +59,14 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 #endif
        vtkactor->SetMapper(polydatamapper);
 
+printf("8.2 ");
+
        vecVtkPolyData.push_back( polydata );
        vecVtkPolyDataMaper.push_back( polydatamapper );
        vecVtkActors.push_back( vtkactor );
 
+printf("8.3 ");
+
 //     vtkImageData* img = bbGetInputImage();
        unsigned int i,size;
        double spc[3];
@@ -72,15 +77,21 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 
        int lstpointsXsize =bbGetInputlstPointX().size();
 
-       if( lstpointsXsize>0 ){
-               vtkPoints* allPoints            = vtkPoints::New( );
-vtkPolyLine *polyline = vtkPolyLine::New();
+printf("8.4 ");
+
+       if( lstpointsXsize>0 )
+       {
+printf("8.5 ");
+               vtkPoints       *allPoints              = vtkPoints::New( );
+               vtkPolyLine *polyline           = vtkPolyLine::New();
                vtkCellArray* allTopology       = vtkCellArray::New( );
 //             allTopology->InsertNextCell( numPoints );
+printf("8.6 ");
 
                size=iGeneral+numPoints;
                for (i=iGeneral;i<size;i++)
                {
+printf("8.7(%d) ",i);
                        //multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
                        //hay parĀ·metro dycom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata
                        allPoints->InsertNextPoint( bbGetInputlstPointX()[i]*spc[0],
@@ -92,14 +103,18 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
 //                     allTopology->InsertCellPoint( i-iGeneral );
                } // rof
+printf("8.8 ");
+               
   allTopology->InsertNextCell(polyline);
 
  // create cell array for edges
   vtkCellArray *edges = vtkCellArray::New();
+printf("8.9 ");
 
 // connect edge's and vertexes point ids
   for(vtkIdType i = iGeneral; i < size-1; i++)
   {
+printf("8.10(%d) ",i);
     vtkLine *edge = vtkLine::New();
     edge->GetPointIds()->SetId(0, i-iGeneral);
     edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
@@ -110,6 +125,7 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 //    vertexes->InsertNextCell(vertex);
   }
 
+printf("8.11 ");
                polydata->SetPoints( allPoints );
  polydata->SetLines(edges);
 //             polydata->SetLines( allTopology );
@@ -120,6 +136,8 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
                edges->Delete();
                allPoints->Delete();
                allTopology->Delete();
+printf("8.12 ");
+               
        }
 
        // color
@@ -127,6 +145,8 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
        if (bbGetInputColourLaw()==1)  // the same color for all 
        {
+printf("8.13(%d) ",bbGetInputColour().size() );
+
                r = bbGetInputColour()[0];
                g = bbGetInputColour()[1];
                b = bbGetInputColour()[2];
@@ -135,6 +155,7 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
        if (bbGetInputColourLaw()==2) // different colors for each segment
        {
+printf("8.14 ");
                if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )   
                {
                        r = bbGetInputColour()[0+iAxis*3];
@@ -145,11 +166,13 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
                        g = (rand() % 100) / 100.0;
                        b = (rand() % 100) / 100.0;
                }
+printf("8.15 ");
                vtkactor->GetProperty()->SetColor( r,g,b );
        }  // Law 2  color for each segment
 
        if (bbGetInputColourLaw()==3)  // color for each point 
        {
+printf("8.16 ");
                // Setup the colors array
                vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
                colors->SetNumberOfComponents(3);
@@ -171,57 +194,70 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
  
        }  // Law 3 color for each point
 
+printf("8.17 ");
        vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
        vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
 
        if ( bbGetInputTransform()!=NULL )
        {
+printf("8.18 ");
                vtkactor->SetUserTransform( bbGetInputTransform() );
        }
 
      // Interface Update
      if  (bbGetInputRenderer()!=NULL )
      {
+printf("8.19 ");
            bbGetInputRenderer()->AddActor( vtkactor );
      }
+printf("8.20 ");
 
 }
 
 
 void DrawAxisTree3D::Process()
 {
-
+printf("1 ");
        int iGeneral=0;
        std::vector<int> lstIndexs = bbGetInputlstIndexs();
        if ( bbGetInputlstIndexs().size()==0 )
        {
+printf("2 ");
                lstIndexs.push_back( bbGetInputlstPointX().size() );
        } // if
        int iAxis,sizeLstAxis=lstIndexs.size();
     int iActor,sizeActors = vecVtkActors.size();
        int numPoints;
 
+printf("3 ");
 
 //    if (oldLstSize!=sizeLstAxis)
 //      {
 //        oldLstSize=sizeLstAxis;
          for (iActor=0 ; iActor<sizeActors; iActor++)
          {
+printf("4-%d ",iActor);
             if (bbGetInputRenderer()!=NULL )
             {
+printf("5 ");
                 bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
                 vecVtkPolyData[iActor]->Delete();
                 vecVtkPolyDataMaper[iActor]->Delete();
                 vecVtkActors[iActor]->Delete();
+printf("6 ");
             } // if
          } // for iActor
          vecVtkPolyData.clear();
          vecVtkPolyDataMaper.clear();
          vecVtkActors.clear();
+printf("7 ");
          for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
          {
+printf("8(%d) ",iAxis);
             numPoints = lstIndexs[iAxis];
+printf("9(%d) ",iAxis);
             DrawOneAxis(iGeneral,numPoints,iAxis);
+printf("10 ");   
             iGeneral = iGeneral+numPoints;
     //         if ((iAxis % 1)==0)
     //         {
@@ -229,6 +265,8 @@ void DrawAxisTree3D::Process()
     //         }
          } // for iAxis
 
+printf("11 ");
+
         if ( bbGetInputiAxis() < (int)(vecVtkActors.size() ) )
         {
             bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );            
@@ -237,6 +275,10 @@ void DrawAxisTree3D::Process()
         } // if 
  //   } else {// if oldLstSize
 //    } // if oldLstSize
+
+printf("12 \n");
+
+
 }
 
 void DrawAxisTree3D::bbUserSetDefaultValues()