vtkPolyLine *polyline = vtkPolyLine::New();
vtkCellArray* allTopology = vtkCellArray::New( );
// allTopology->InsertNextCell( numPoints );
-
-
size=iGeneral+numPoints;
-
+ std::vector<double> lstX =bbGetInputlstPointX();
+ std::vector<double> lstY =bbGetInputlstPointY();
+ std::vector<double> lstZ =bbGetInputlstPointZ();
for (i=iGeneral;i<size;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],
- bbGetInputlstPointY()[i]*spc[1],
- bbGetInputlstPointZ()[i]*spc[2] );
-// printf("DrawAxisTree3D::DrawOneAxis point %d -> %f, %f, %f \n", i, bbGetInputlstPointX()[i], bbGetInputlstPointY()[i], bbGetInputlstPointZ()[i] );
-
-polyline->GetPointIds()->InsertNextId(i-iGeneral);
+ allPoints->InsertNextPoint( lstX[i],
+ lstY[i],
+ lstZ[i] );
+// printf("DrawAxisTree3D::DrawOneAxis point %d -> %f, %f, %f \n", i, bbGetInputlstPointX()[i], bbGetInputlstPointY()[i], bbGetInputlstPointZ()[i] );
+ polyline->GetPointIds()->InsertNextId(i-iGeneral);
// allTopology->InsertCellPoint( i-iGeneral );
} // rof
-
- allTopology->InsertNextCell(polyline);
+ allTopology->InsertNextCell(polyline);
// create cell array for edges
- vtkCellArray *edges = vtkCellArray::New();
+ vtkCellArray *edges = vtkCellArray::New();
// connect edge's and vertexes point ids
- for(vtkIdType i = iGeneral; i < size-1; i++)
- {
- vtkLine *edge = vtkLine::New();
- edge->GetPointIds()->SetId(0, i-iGeneral);
- edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
- edges->InsertNextCell(edge);
- edge->Delete();
- // vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
- // vertex->GetPointIds()->SetId(0, i);
- // vertexes->InsertNextCell(vertex);
- }
- polydata->SetPoints( allPoints );
- polydata->SetLines(edges);
-// polydata->SetLines( allTopology );
-
-
- // polydata->SetPolys( allTopology );
-
- edges->Delete();
- allPoints->Delete();
- allTopology->Delete();
- }
-
+ for(vtkIdType i = iGeneral; i < size-1; i++)
+ {
+ vtkLine *edge = vtkLine::New();
+ edge->GetPointIds()->SetId(0, i-iGeneral);
+ edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
+ edges->InsertNextCell(edge);
+ edge->Delete();
+ // vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
+ // vertex->GetPointIds()->SetId(0, i);
+ // vertexes->InsertNextCell(vertex);
+ } // for i
+ polydata->SetPoints( allPoints );
+ polydata->SetLines(edges);
+ // polydata->SetLines( allTopology );
+ // polydata->SetPolys( allTopology );
+ edges->Delete();
+ allPoints->Delete();
+ allTopology->Delete();
+ } // if lstpointsXsize
+
// color
double r,g,b;
-
+ std::vector<double> lstColor = bbGetInputColour();
if (bbGetInputColourLaw()==1) // the same color for all
{
- r = bbGetInputColour()[0];
- g = bbGetInputColour()[1];
- b = bbGetInputColour()[2];
+ r = lstColor[0];
+ g = lstColor[1];
+ b = lstColor[2];
vtkactor->GetProperty()->SetColor( r,g,b );
} // Law 1 color for all
-
if (bbGetInputColourLaw()==2) // different colors for each segment
{
if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )
{
- r = bbGetInputColour()[0+iAxis*3];
- g = bbGetInputColour()[1+iAxis*3];
- b = bbGetInputColour()[2+iAxis*3];
+ r = lstColor[0+iAxis*3];
+ g = lstColor[1+iAxis*3];
+ b = lstColor[2+iAxis*3];
} else {
r = (rand() % 100) / 100.0;
g = (rand() % 100) / 100.0;
}
vtkactor->GetProperty()->SetColor( r,g,b );
} // Law 2 color for each segment
-
if (bbGetInputColourLaw()==3) // color for each point
{
// Setup the colors array
int iPoint,pointSize=iGeneral+numPoints;
for (iPoint=iGeneral; iPoint<pointSize; iPoint++)
{
- r = bbGetInputColour()[0+iPoint*3]*255.0;
- g = bbGetInputColour()[1+iPoint*3]*255.0;
- b = bbGetInputColour()[2+iPoint*3]*255.0;
- //colors->SetTuple3(iPoint,r,g,b);
+ r = lstColor[0+iPoint*3]*255.0;
+ g = lstColor[1+iPoint*3]*255.0;
+ b = lstColor[2+iPoint*3]*255.0;
colors->InsertNextTuple3(r,g,b);
}
polydata->GetCellData()->SetScalars(colors);
polydata->Modified();
-
} // Law 3 color for each point
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
-
if ( bbGetInputTransform()!=NULL )
{
vtkactor->SetUserTransform( bbGetInputTransform() );
void DrawAxisTree3D::Process()
{
-
// Removing actors
int iActor,sizeActors = vecVtkActors.size();
for (iActor=0 ; iActor<sizeActors; iActor++)
vecVtkPolyData.clear();
vecVtkPolyDataMaper.clear();
vecVtkActors.clear();
-
// Adding actors
if (bbGetInputActive()==true)
{
printf("\nDrawAxisTree3D .ERROR. size of vectors lstPointX.size=%d lstPointY.size=%d lstPointZ.size=%d are not coherent \n\n",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
}// size X Y Z
} // if Active
-
}
void DrawAxisTree3D::bbUserSetDefaultValues()
//-------------------------------------------------------------------
void wxVtk2DBaseView::ResetView()
{
- printf("EED wxVtk2DBaseView::ResetView Start\n");
double spx = 0,spy = 0,spz = 0;
int x1 = 1,x2 = 1,y1 = 1,y2 = 1,z1 = 1,z2 = 1;
wxVtkBaseView::Configure();
imageData->GetSpacing (spx,spy,spz);
imageData->GetExtent (x1,x2,y1,y2,z1,z2);
}
-printf("//EED wxVtk2DBaseView::ResetView %d %d %d %d %d %d \n",x1,x2,y1,y2,z1,z2);
_imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2);
_imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
vtkInteractorZoomCamera *_vtkInteractorZoomCamera = new vtkInteractorZoomCamera();
style2D->SetInteractorZoomCamera(_vtkInteractorZoomCamera);
-
-
SetInteractorStyleImage( style2D );
-
- // RaC
- //////////////
- printf("EED wxVtk2DBaseView::ResetView End\n");
-
}
//-------------------------------------------------------------------
//-------------------------------------------------------------------
void wxVtk2DBaseView::Refresh()
{
-printf("EED wxVtk2DBaseView::Refresh Start\n");
int z = (int)(GetVtkBaseData()->GetZ());
_imageViewer2XYZ->SetZSlice( z );
//EED 2016/02/19
UpdateColorWindowLevel();
UpdateCameraParallelScale();
wxVtkBaseView::Refresh();
-printf("EED wxVtk2DBaseView::Refresh End\n");
}
//-------------------------------------------------------------------