void ImageBoundaries::Process()
{
printf("bbtk:vtk::ImageBoundaries::Process start\n");
- if (bbGetInputIn()!=NULL){
+ if (bbGetInputIn()!=NULL)
+ {
int i,j,k;
int ext[6];
double value;
void ImagePlanes::bbUserSetDefaultValues()
{
- bbSetOutputPlaneX(0);
- bbSetOutputPlaneY(0);
- bbSetOutputPlaneZ(0);
- bbSetOutputImageX(0);
- bbSetOutputImageY(0);
- bbSetOutputImageZ(0);
- bbSetInputIn(0);
+ bbSetOutputPlaneX(NULL);
+ bbSetOutputPlaneY(NULL);
+ bbSetOutputPlaneZ(NULL);
+ bbSetOutputImageX(NULL);
+ bbSetOutputImageY(NULL);
+ bbSetOutputImageZ(NULL);
+ bbSetInputIn(NULL);
std::vector<double> vect;
vect.push_back(0);
vect.push_back(0);
//bbSetOutputImage3Pts(planeWidget3Pts->GetResliceOutput());
if(picker != 0)
+ {
picker->UnRegister(NULL);
-
+ }
+
mVtkCallback = VtkCallbackType::New();
mVtkCallback->SetBlackBox(this);
planeWidgetX->AddObserver(vtkCommand::InteractionEvent,mVtkCallback);
//Get the corresponding three points out of the vectors
double origin[3];
- origin[0] = pointsx[0];
- origin[1] = pointsy[0];
- origin[2] = pointsz[0];
+ origin[0] = pointsx[0];
+ origin[1] = pointsy[0];
+ origin[2] = pointsz[0];
double point1[3];
- point1[0] = pointsx[1];
- point1[1] = pointsy[1];
- point1[2] = pointsz[1];
+ point1[0] = pointsx[1];
+ point1[1] = pointsy[1];
+ point1[2] = pointsz[1];
double point2[3];
- point2[0]= pointsx[2];
- point2[1]= pointsy[2];
- point2[2]= pointsz[2];
+ point2[0] = pointsx[2];
+ point2[1] = pointsy[2];
+ point2[2] = pointsz[2];
//With the three points we create the corresponding X, Y and Z vectors all orthogonal to each other
- double* vect1= getNormal(makeVector(origin, point1));
- double* vect2= getNormal(makeVector(origin, point2));
- double* crossp = getCrossProduct(vect1, vect2);
+ double* vect1 = getNormal(makeVector(origin, point1));
+ double* vect2 = getNormal(makeVector(origin, point2));
+ double* crossp = getCrossProduct(vect1, vect2);
- double *newx = getCrossProduct(vect2, crossp);
+ double *newx = getCrossProduct(vect2, crossp);
- int ext[6],factor=0;
+ int ext[6],factor = 0;
bbGetInputIn()->GetExtent(ext);
factor = ext[0]<ext[3]? ext[3] : ext[0];
(origin[2]+vect2[2]*factor)*zSpacing);
plane3pts->GetResliceOutput()->Update();
//To get the slice of image out of the selected volume
- if (_imageReslicer==NULL){
+ if (_imageReslicer==NULL)
+ {
_imageReslicer = vtkImageReslice::New();
_imageReslicer->SetOutputDimensionality(2);
_transform = vtkTransform::New();
_matrix = vtkMatrix4x4::New();
- }
+ } // if
_imageReslicer->SetInterpolationMode( bbGetInputInterpolation() );
_imageReslicer->SetInput( bbGetInputIn() );
_imageReslicer->SetInformationInput(bbGetInputIn());
} // bbGetInputIn
}
- void ImagePlanes::updateInteractor(){
-
- vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
-
- if(interactor){
- bbGetOutputPlaneX()->SetInteractor(interactor);
- bbGetOutputPlaneX()->EnabledOn();
- bbGetOutputPlaneY()->SetInteractor(interactor);
- bbGetOutputPlaneY()->EnabledOn();
- bbGetOutputPlaneZ()->SetInteractor(interactor);
- bbGetOutputPlaneZ()->EnabledOn();
- bbGetOutputPlane3Pts()->SetInteractor(interactor);
- bbGetOutputPlane3Pts()->EnabledOn();
- }
- }
+ void ImagePlanes::updateInteractor()
+ {
+ vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
+ if(interactor)
+ {
+ bbGetOutputPlaneX()->SetInteractor(interactor);
+ bbGetOutputPlaneX()->EnabledOn();
+ bbGetOutputPlaneY()->SetInteractor(interactor);
+ bbGetOutputPlaneY()->EnabledOn();
+ bbGetOutputPlaneZ()->SetInteractor(interactor);
+ bbGetOutputPlaneZ()->EnabledOn();
+ bbGetOutputPlane3Pts()->SetInteractor(interactor);
+ bbGetOutputPlane3Pts()->EnabledOn();
+ } // if
+ }
+
//-----------------------------------------------------------------
- void vtkImageDataPointerRelay::bbUserSetDefaultValues()
+ void vtkImageDataPointerRelay::bbUserSetDefaultValues()
{
}
private:
class VtkCallbackType;
- VtkCallbackType* mVtkCallback;
- vtkImageData* image;
- vtkImageReslice* _imageReslicer;
-
- vtkTransform* _transform;
- vtkMatrix4x4* _matrix;
-
- double* getCrossProduct(double* vect0,double* vect1);
- double getPodoubleProduct(double* vect0,double* vect1);
- double* getNormal(double* vect);
- double getMagnitud(double* vect);
- double* makeVector(double podouble0[3], double podouble1[3]);
- void updateInteractor();
+ VtkCallbackType *mVtkCallback;
+ vtkImageData *image;
+ vtkImageReslice *_imageReslicer;
+
+ vtkTransform *_transform;
+ vtkMatrix4x4 *_matrix;
+
+ double *getCrossProduct(double* vect0,double* vect1);
+ double getPodoubleProduct(double* vect0,double* vect1);
+ double *getNormal(double* vect);
+ double getMagnitud(double* vect);
+ double *makeVector(double podouble0[3], double podouble1[3]);
+ void updateInteractor();
vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
};
#include "bbvtkPolyDataToActor.h"
#include "bbvtkPackage.h"
+
namespace bbvtk
{
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolyDataToActor)
colour.push_back(1.0);
colour.push_back(0.5);
bbSetInputColour(colour);
-
bbSetInputActive(true);
bbSetInputIn(NULL);
bbSetInputRenderer(NULL);
bbSetInputRepresentation(2);
bbSetInputLineWidth(1);
bbSetInputScalarVisibility(false);
-
polydatamapper = NULL;
vtkactor = NULL;
}
if (bbGetInputActive()==true)
{
- polydatamapper->SetInput( bbGetInputIn() );
- vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
+ polydatamapper->SetInput( bbGetInputIn() );
+ vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
+ if (bbGetInputRepresentation()==1)
+ {
+ vtkactor->GetProperty()->SetAmbient(1);
+ vtkactor->GetProperty()->SetDiffuse(1);
+ vtkactor->GetProperty()->SetSpecular(0);
+ } else {
+printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values of Ambient, Diffuse, Specular ? \n");
+ }
+
+
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
bbGetInputColour()[2] );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
if ( bbGetInputTransform()!=NULL )
{
BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox);
void SliceImage::Process()
{
+
+printf("EED ********************************** bbtk-box vtk:SliceImage (Deprecated)\n");
+printf("EED ********************************** >> use bbtk-box creaMaracasVisu:SliceImage \n");
vtkImageData* original = bbGetInputIn();
if (original == NULL)
final->SetScalarType(scalar_type);
final->AllocateScalars();
final->Update();
-
-
}
bbSetOutputMax(max_z);
BBTK_DESCRIPTION("_description_");
BBTK_CATEGORY("__CATEGORY__");
BBTK_INPUT(SliceImage,In,"3D Image",vtkImageData*,"");
-BBTK_INPUT(SliceImage,Z,"shoice",int,"");
+BBTK_INPUT(SliceImage,Z,"schoice",int,"");
BBTK_OUTPUT(SliceImage,Out,"2D Slice",vtkImageData*,"");
BBTK_OUTPUT(SliceImage,Max,"Maximum",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(SliceImage);
#include "bbvtkPackage.h"
#include <vtkPointData.h>
-
+#include <vtkMath.h>
namespace bbvtk
{
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-printf("EED SurfaceTexture::Process Start\n");
int i;
double spc[3];
colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
} // for iLookTable
+//EED 2018-06-8 ***********************ARDS Projet***********************************************
+ if (bbGetInputColorType()==2)
+ {
+ int tableSize=256;
+ colorLookupTable = vtkLookupTable::New();
+// colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(range[0],range[1]);
+// colorLookupTable->SetTableRange(0,11);
+ colorLookupTable->Build();
+
+/*
+ for (unsigned int i = 0; i < tableSize; ++i)
+ {
+ colorLookupTable->SetTableValue(i,
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ 1.0);
+ }
+*/
+
+ double rgba1[4];
+ double rgba2[4];
+ int i,j;
+ for (int iLookTable = 0; iLookTable<tableSize*3; iLookTable++)
+ {
+ i=rand() % tableSize;
+ j=rand() % tableSize;
+ colorLookupTable->GetTableValue(i, rgba1);
+ colorLookupTable->GetTableValue(j, rgba2);
+
+ colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+ } // for iLookTable
+
+ } // type 2
+
+
+ if (bbGetInputColorType()==3)
+ {
+ int tableSize=13;
+ colorLookupTable = vtkLookupTable::New();
+ colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(6,range[1]);
+ colorLookupTable->Build();
+
+ colorLookupTable->SetTableValue(0, 1 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(1, 1 ,0 ,0 ,1);
+ colorLookupTable->SetTableValue(2, 0 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(3, 0 ,0 ,1 ,1);
+ colorLookupTable->SetTableValue(4, 0 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(5, 1 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(6, 1 ,0 ,1 ,1);
+
+ colorLookupTable->SetTableValue(7, 0.5,1 ,1 ,1);
+ colorLookupTable->SetTableValue(8, 1 ,0.5,1 ,1);
+ colorLookupTable->SetTableValue(9, 1 ,1 ,0.5,1);
+
+ colorLookupTable->SetTableValue(10,1 ,0.5,0.5,1);
+ colorLookupTable->SetTableValue(11,0.5,0.5,1 ,1);
+
+ } // type 2
+
+
+
+
}
bbGetInputMesh()->GetPointData()->SetScalars(colors);