ENDIF(crea_FOUND)
#==================================
+#==================================
+# Find creaMaracasVisu (to use the lib)
+#FIND_PACKAGE(creaMaracasVisu REQUIRED)
+#IF (creaMaracasVisu_FOUND)
+ #INCLUDE(${creaMaracasVisu_USE_FILE})
+#ENDIF(creaMaracasVisu_FOUND)
+#==================================
+
#==================================
# Do not allow to build inside the source tree
CREA_PREVENT_IN_SOURCE_BUILD()
SET(${BBTK_PACKAGE_NAME}_LIBS
# LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST
# EXCEPT : the same libs than for INCLUDE_DIRS
- TransformLib
+ TransformLib
+ #${creaMaracasVisu_LIBRARIES}
)
#===========================================================================
BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,CalculateVectorBox)
BBTK_BLACK_BOX_IMPLEMENTATION(CalculateVectorBox,bbtk::AtomicBlackBox);
void CalculateVectorBox::Process()
-{
-
+{
if(!bbGetInputPointsX1().empty() && !bbGetInputPointsX2().empty())
{
//Checks that all the vector points are defined
if(bbGetInputPointsX1()[1] != NULL && bbGetInputPointsX2()[1] != NULL)
{
- _vector->SetData(bbGetInputPointsX1(), bbGetInputPointsX2(), bbGetInputPointsY1(), bbGetInputPointsY2(), bbGetInputPointsZ1(), bbGetInputPointsZ2());
- _vector->Run();
+ //_vector->SetData(bbGetInputPointsX1(), bbGetInputPointsX2(), bbGetInputPointsY1(), bbGetInputPointsY2(), bbGetInputPointsZ1(), bbGetInputPointsZ2());
+ //_vector->Run();
- bbSetOutputOrigin(_vector->GetOrigin());
- bbSetOutputOriginReslicer(_vector->GetOriginReslicer());
- bbSetOutputOutAngle(_vector->GetAngle());
+ //bbSetOutputOrigin(_vector->GetOrigin());
+ //bbSetOutputOriginReslicer(_vector->GetOriginReslicer());
+ //bbSetOutputOutAngle(_vector->GetAngle());
}
}
}
void CalculateVectorBox::bbUserSetDefaultValues()
{
- _vector = new VectorMath();
+ _vector = new PlanesOperations();
std::vector<int> nullVector;
bbSetInputPointsX1(nullVector);
bbSetInputPointsX2(nullVector);
#include "bbtkAtomicBlackBox.h"
#include "iostream"
-#include "VectorMath.h"
+#include "PlanesOperations.h"
namespace bbPackRecalage
{
private:
- VectorMath *_vector;
+ PlanesOperations *_vector;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(CalculateVectorBox,bbtk::AtomicBlackBox);
BBTK_BLACK_BOX_IMPLEMENTATION(CheckBoardBox,bbtk::AtomicBlackBox);
void CheckBoardBox::Process()
{
-
+
// THE MAIN PROCESSING METHOD BODY
checkboard->setInputImage1(bbGetInputIn1());
checkboard->setInputImage2(bbGetInputIn2());
- checkboard->setRows(bbGetInputRows());
- checkboard->setCols(bbGetInputCols());
- checkboard->calculateImage();
- bbSetOutputOut(checkboard->getFilteredImage());
- //bbSetOutputOut(bbGetInputIn1());
-
+ if(bbGetInputIn1() != NULL && bbGetInputIn2() != NULL)
+ {
+ checkboard->setRows(bbGetInputRows());
+ checkboard->setCols(bbGetInputCols());
+ checkboard->calculateImage();
+ bbSetOutputOut(checkboard->getFilteredImage());
+ }
+ else
+ {
+ bbSetOutputOut(NULL);
+ }
}
void CheckBoardBox::bbUserSetDefaultValues()
{
-
-// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
-// Here we initialize the input 'In' to 0
bbSetInputIn1(NULL);
bbSetInputIn2(NULL);
bbSetInputRows(0);
void ImageConvolution::bbUserFinalizeProcessing()
{
delete convolution;
-
-// THE FINALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should desallocate the internal/output pointers
-// if any
-
}
}
-// EO namespace bbPackRecalage
-
-
+// EO namespace bbPackRecalage
\ No newline at end of file
if(image != NULL)
{
bbSetOutputLengthZ((int)image->GetDimensions()[2] - 1);
- std::cout << "image scalar size: " << image->GetScalarSize() << std::endl;
- std::cout << "image scalar max: " << image->GetScalarTypeMax() << std::endl;
- std::cout << "image scalar min: " << image->GetScalarTypeMin() << std::endl;
- std::cout << "image scalar type: " << image->GetScalarType() << std::endl;
+
if(image->GetScalarType() == VTK_DOUBLE)
{
bbSetOutputColorLevel(50);
bbSetOutputMidColorLevel(25);
}
- else if(image->GetScalarType() == VTK_UNSIGNED_SHORT)
- {
- bbSetOutputColorLevel(500);
- bbSetOutputMidColorLevel(250);
- }
else
{
- bbSetOutputColorLevel(500);
- bbSetOutputMidColorLevel(250);
+ bbSetOutputColorLevel(255);
+ bbSetOutputMidColorLevel(127.5);
}
}
}
}
void ImageSubstraction::bbUserFinalizeProcessing()
{
-
-// THE FINALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should desallocate the internal/output pointers
-// if any
-
+ if(subImage!=NULL)
+ {
+ delete subImage;
+ }
}
}
// EO namespace bbCreaRecalage
{
if(!bbGetInputInX().empty() && bbGetInputInX().size() == 3 && !bbGetInputInY().empty() && bbGetInputInY().size() == 3 && !bbGetInputInZ().empty() && bbGetInputInZ().size() == 3)
{
+ double a[3];
+
+ /*First Vector*/
+ a[0] = bbGetInputInX()[1]-bbGetInputInX()[0];
+ a[1] = bbGetInputInY()[1]-bbGetInputInY()[0];
+ a[2] = bbGetInputInZ()[1]-bbGetInputInZ()[0];
+
+ double b[3];
+
+ /*Second Vector*/
+ b[0] = bbGetInputInX()[2]-bbGetInputInX()[0];
+ b[1] = bbGetInputInY()[2]-bbGetInputInY()[0];
+ b[2] = bbGetInputInZ()[2]-bbGetInputInZ()[0];
+
+ double normal[3];
+
+ normal[0]=(a[1]*b[2])-(a[2]*b[1]);
+ normal[1]=(a[2]*b[0])-(a[0]*b[2]);
+ normal[2]=(a[0]*b[1])-(a[1]*b[0]);
+
+ vtkMath::Normalize(normal);
+
+ std::cout << "Normal axis : " << "X: " << normal[0] << " Y: " << normal[1] << " Z: " << normal[2] << std::endl;
+
/*Unitary Vector in Y*/
double y[3];
y[0] = 0;
double x[3];
x[0] = 1;
x[1] = 0;
- x[2] = 0;
-
- double normal[3];
+ x[2] = 0;
/*Normal vector without its z factor*/
double normalZ[3];
std::cout << "Angle for Z: " << angleZ << std::endl;
std::cout << "Angle for Y: " << angleY << std::endl;
- vtkTransform *transform = vtkTransform::New();
transform->Identity();
if(normal[0] < 0)
{
/*Set output and pray to god that it works :P*/
bbSetOutputOut(transform);
}
+ else
+ {
+ transform->Identity();
+ transform->Update();
+ bbSetOutputOut(transform);
+ }
}
void PlaneReorientationBox::bbUserSetDefaultValues()
{
}
void PlaneReorientationBox::bbUserInitializeProcessing()
{
-
-// THE INITIALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should allocate the internal/output pointers
-// if any
-
-
+ transform = vtkTransform::New();
}
void PlaneReorientationBox::bbUserFinalizeProcessing()
{
-
-// THE FINALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should desallocate the internal/output pointers
-// if any
-
+ transform->Delete();
}
}
// EO namespace bbPackRecalage
BBTK_DECLARE_OUTPUT(Out,vtkTransform*);
BBTK_PROCESS(Process);
void Process();
+
+ private:
+ vtkTransform *transform;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneReorientationBox,bbtk::AtomicBlackBox);
BBTK_BLACK_BOX_IMPLEMENTATION(ReSlicerBox,bbtk::AtomicBlackBox);
void ReSlicerBox::Process()
{
+ std::cout << "NTU ReSlicerBox : entered 1" << std::endl;
- if(!bbGetInputOrigin().empty())
+ if(!bbGetInputOrigin().empty() && bbGetInputTransform() != NULL)
{
+ std::cout << "NTU ReSlicerBox : entered 2" << std::endl;
+
image = vtkImageChangeInformation::New();
image->SetInput( bbGetInputIn() );
image->SetOutputSpacing( 1,1,1 );
+
+ std::cout << "NTU ReSlicerBox : entered 3" << std::endl;
+
if(bbGetInputCentered())
{
image->CenterImageOn();
}
+
+ std::cout << "NTU ReSlicerBox : entered 4" << std::endl;
slicer =vtkImageReslice::New();
slicer->SetInput( image->GetOutput() );
}
slicer->Update();
+ std::cout << "NTU ReSlicerBox : entered 5" << std::endl;
+
imageResult = vtkImageChangeInformation::New();
imageResult->SetInput( slicer->GetOutput() );
double spc[3];
{
bbSetOutputOut( bbGetInputIn() );
}
+
+ std::cout << "NTU ReSlicerBox : out" << std::endl;
}
void ReSlicerBox::bbUserSetDefaultValues()
std::vector<int> empty;
bbSetInputOrigin(empty);
bbSetInputIn(NULL);
- bbSetInputTransform(vtkTransform::New());
+ bbSetInputTransform(NULL);
bbSetOutputOut(NULL);
bbSetInputCentered(false);
bbSetInputInterpolate(false);
imageResult = vtkImageChangeInformation::New();
}
void ReSlicerBox::bbUserFinalizeProcessing()
-{
-
-// THE FINALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should desallocate the internal/output pointers
-// if any
+{
image->Delete();
slicer->Delete();
imageResult->Delete();
BBTK_DECLARE_INPUT(Angle,double);
- /*Scalation to be done int the x axis*/
+ /*Scalation to be done in the x axis*/
BBTK_DECLARE_INPUT(ScaleX,double);
- /*Scalation to be done int the y axis*/
+ /*Scalation to be done in the y axis*/
BBTK_DECLARE_INPUT(ScaleY,double);
- /*Scalation to be done int the z axis*/
+ /*Scalation to be done in the z axis*/
BBTK_DECLARE_INPUT(ScaleZ,double);
/*Resultant vtkTransform*/
_convolve->SetKernel3x3(kernel);
_convolve->Update();
_cast->SetInput(_convolve->GetOutput());
- _cast->SetOutputScalarTypeToDouble();
+ //_cast->SetOutputScalarTypeToDouble();
_cast->Update();
}
else