sphereActorEnd->SetOrigin( 0,0,0 );
sphereActorEnd->SetPosition(bbGetInputlstPointX()[i]*spc[0], bbGetInputlstPointY()[i]*spc[1], bbGetInputlstPointZ()[i]*spc[2] );
-
- // color
- double r,g,b;
- if ( (iTube*3+1) < (int)(bbGetInputColour().size()) )
- {
- r = bbGetInputColour()[0+iTube*3];
- g = bbGetInputColour()[1+iTube*3];
- b = bbGetInputColour()[2+iTube*3];
- } else {
- r = (rand() % 100) / 100.0;
- g = (rand() % 100) / 100.0;
- b = (rand() % 100) / 100.0;
- }
- r = bbGetInputColour()[0];
- g = bbGetInputColour()[1];
- b = bbGetInputColour()[2];
-
-
-
-
vtkSmartPointer<vtkTubeFilter> tube = vtkSmartPointer<vtkTubeFilter>::New();
//EED vtkTubeFilter *tube = vtkTubeFilter::New();
tube->SetInput(polyData);
// vtkSmartPointer<vtkActor> actor =vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
-//EED vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
- actor->GetProperty()->SetColor( r,g,b );
- actor->GetProperty()->SetOpacity( bbGetInputOpacity() );
- sphereActorStart->GetProperty()->SetColor( r,g,b );;
- sphereActorEnd->GetProperty()->SetColor( r,g,b );;
- sphereActorStart->GetProperty()->SetOpacity( bbGetInputOpacity() );
- sphereActorEnd->GetProperty()->SetOpacity( bbGetInputOpacity() );
vecVtkActors.push_back( actor );
- vecVtkActors.push_back( sphereActorStart );
vecVtkActors.push_back( sphereActorEnd );
-
-
- if ( bbGetInputTransform()!=NULL )
- {
- actor->SetUserTransform( bbGetInputTransform() );
- sphereActorStart->SetUserTransform( bbGetInputTransform() );
- sphereActorEnd->SetUserTransform( bbGetInputTransform() );
- }
+ vecVtkActors.push_back( sphereActorStart );
// Interface Update // Interface Update
if (bbGetInputRenderer()!=NULL )
}
+void TubeTreeFilter::SetGraphicProperties()
+{
+ int iTube,sizeLstAxis=bbGetInputlstIndexs().size();
+
+ vtkActor *actorTube;
+ vtkActor *actorSpherEnd;
+ vtkActor *actorSpherStart;
+
+
+ double r,g,b;
+ r = bbGetInputColour()[0];
+ g = bbGetInputColour()[1];
+ b = bbGetInputColour()[2];
+ for (iTube=0 ; iTube<sizeLstAxis; iTube++)
+ {
+ // Get Actor
+ actorTube=vecVtkActors[0+iTube*3];
+ actorSpherEnd=vecVtkActors[1+iTube*3];
+ actorSpherStart=vecVtkActors[2+iTube*3];
+
+ // Set Opacity
+ actorTube->GetProperty()->SetOpacity( bbGetInputOpacity() );
+ actorSpherEnd->GetProperty()->SetOpacity( bbGetInputOpacity() );
+ actorSpherStart->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
+ //Set Colour
+ if ( bbGetInputTransform()!=NULL )
+ {
+ actorTube->SetUserTransform( bbGetInputTransform() );
+ actorSpherEnd->SetUserTransform( bbGetInputTransform() );
+ actorSpherStart->SetUserTransform( bbGetInputTransform() );
+ }
+
+ if (bbGetInputColourLaw()==1) // One solide colour
+ {
+ //
+ }
+
+ if (bbGetInputColourLaw()==2) // color for differents tubes
+ {
+ if ( (iTube*3+1) < (int)(bbGetInputColour().size()) )
+ {
+ r = bbGetInputColour()[0+iTube*3];
+ g = bbGetInputColour()[1+iTube*3];
+ b = bbGetInputColour()[2+iTube*3];
+ } else {
+ r = (rand() % 100) / 100.0;
+ g = (rand() % 100) / 100.0;
+ b = (rand() % 100) / 100.0;
+ }
+ }
+
+ actorTube->GetProperty()->SetColor( r,g,b );
+ actorSpherEnd->GetProperty()->SetColor( r,g,b );
+ actorSpherStart->GetProperty()->SetColor( r,g,b );
+ } // for
+}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
bbSetOutputOutTube( vecVtkActors[ bbGetInputiTube()*3 ] );
} else {
printf("TubeTreeFilter .ERROR. missing index vector...\n");
- }
-
- }
-
- double r,g,b;
- r = bbGetInputColour()[0];
- g = bbGetInputColour()[1];
- b = bbGetInputColour()[2];
- for (iTube=0 ; iTube<sizeLstAxis; iTube++)
- {
- vtkActor *actor1=vecVtkActors[0+iTube*3];
- vtkActor *actor2=vecVtkActors[1+iTube*3];
- vtkActor *actor3=vecVtkActors[2+iTube*3];
-
- actor1->GetProperty()->SetOpacity( bbGetInputOpacity() );
- actor2->GetProperty()->SetOpacity( bbGetInputOpacity() );
- actor3->GetProperty()->SetOpacity( bbGetInputOpacity() );
- if (bbGetInputColourLaw()==1)
- {
- actor1->GetProperty()->SetColor( r,g,b );
- actor2->GetProperty()->SetColor( r,g,b );
- actor3->GetProperty()->SetColor( r,g,b );
- }
- } // for
-
+ }// vector Actor size
+ }
+ SetGraphicProperties();
printf("EED TubeTreeFilter::Process end \n");
}
BBTK_BLACK_BOX_IMPLEMENTATION(AxeVolume,bbtk::AtomicBlackBox);
void AxeVolume::Process()
{
-
+
printf("EED AxeVolume::Process start \n");
if ( mimage!=NULL )
int sizeY=ext[3]-ext[2];
int sizeZ=ext[5]-ext[4];
- mimage = vtkImageData::New();
+ double spc[3];
+ bbGetInputIn()->GetSpacing(spc);
+ double invSpc[3];
+ invSpc[0] = 1/spc[0];
+ invSpc[1] = 1/spc[1];
+ invSpc[2] = 1/spc[2];
+
+printf("EED AxeVolume::Process invSpc %f %f %f\n",invSpc[0],invSpc[1],invSpc[2] );
+
+ mimage = vtkImageData::New();
mimage->SetDimensions(sizeX,sizeY,sizeZ);
mimage->SetOrigin(0,0,0);
mimage->SetExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 );
mimage->SetWholeExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 );
mimage->SetScalarTypeToUnsignedShort();
+ mimage->SetSpacing(spc);
mimage->AllocateScalars();
{
if (bbGetInputlstPointR().size()>=1)
{
- r = bbGetInputlstPointR()[ bbGetInputlstPointR().size()-1 ];
+ r = bbGetInputlstPointR()[ bbGetInputlstPointR().size()-1 ] * invSpc[0];
} else {
r = 1;
}
} else {
- r = bbGetInputlstPointR()[ iAxe ];
+ r = bbGetInputlstPointR()[ iAxe ]* invSpc[0];
}
- px = bbGetInputlstPointX()[iAxe];
- py = bbGetInputlstPointY()[iAxe];
- pz = bbGetInputlstPointZ()[iAxe];
-// printf("AxeVolume::Process %d -> %f, %f, %f\n",iAxe, px,py,pz);
+ px = bbGetInputlstPointX()[iAxe] * invSpc[0];
+ py = bbGetInputlstPointY()[iAxe] * invSpc[1];
+ pz = bbGetInputlstPointZ()[iAxe] * invSpc[2];
+ printf("AxeVolume::Process %d -> %f, %f, %f,%f\n",iAxe, px,py,pz,r);
px1 = px - r;
py1 = py - r;
pz1 = pz - r;
px2 = px + r;
py2 = py + r;
pz2 = pz + r;
- rr=r*r;
+ rr=r*r;
- for ( i=px1 ; i<=px2 ; i++ )
+ for ( i=px1 ; i<=px2 ; i++ )
{
rx = i - px;
rx = rx*rx;
- for ( j=py1 ; j<py2 ; j++ )
+ for ( j=py1 ; j<py2 ; j++ )
{
ry = j - py;
ry = ry*ry;
- for ( k=pz1 ; k<pz2 ; k++ )
+ for ( k=pz1 ; k<pz2 ; k++ )
{
if ( (i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) &&(k>=0) && (k<sizeZ) ){
p = (unsigned short*)mimage->GetScalarPointer (i, j, k);
if ( rx + ry + rz <= rr )
{
*p=255;
- }
+ }
} // *p==0
} // inside point
} //for k
} //for j
} //for i
} // for iAxe
- bbSetOutputOut( mimage );
-
+ bbSetOutputOut( mimage );
+
printf("EED AxeVolume::Process end \n");
}
- //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
void AxeVolume::bbUserSetDefaultValues()
{
mimage=NULL;
}
-
- //-----------------------------------------------------------------
+
+ //-----------------------------------------------------------------
void AxeVolume::bbUserInitializeProcessing()
{
}
-
- //-----------------------------------------------------------------
+
+ //-----------------------------------------------------------------
void AxeVolume::bbUserFinalizeProcessing()
{
}
-
- //-----------------------------------------------------------------
-
+
+ //-----------------------------------------------------------------
+
}
// EO namespace bbcreaMaracasVisu