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);
}
else if(image->GetScalarType() == VTK_UNSIGNED_SHORT)
{
- bbSetOutputColorLevel(25000);
- bbSetOutputMidColorLevel(12500);
+ bbSetOutputColorLevel(500);
+ bbSetOutputMidColorLevel(250);
}
else
{
void MyTimer::Notify()
{
+ //This will be called each time the timer finishes a countdown
_box->Change();
_box->bbSignalOutputModification(std::string("Out"));
}
void ImageSwitcherBox::Change()
{
+ //Just changes the images each time the timer finishes a countdown
+
if(change == false)
{
bbSetOutputOut(bbGetInputIn2());
myTimer->Start(time);
oldTime = time;
}
- /*
- if(oldTime != time && myTimer !=NULL)
- {
- myTimer->Stop();
- myTimer->Start(time);
- oldTime = time;
- }*/
-
+
if(!_on)
{
myTimer->Stop();
}
void ImageSwitcherBox::CreateWidget(wxWindow* parent)
{
+ //Creates a simple text widget because it is necesary that a non-empty widget exists for creatingh the thread of the timer.
bbSetOutputWidget( new wxStaticText(parent, -1, _T("Image Switcher")) );
}
void ImageSwitcherBox::bbUserSetDefaultValues()
--- /dev/null
+#include "bbPackRecalagePlaneReorientationBox.h"
+#include "bbPackRecalagePackage.h"
+namespace bbPackRecalage
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,PlaneReorientationBox)
+BBTK_BLACK_BOX_IMPLEMENTATION(PlaneReorientationBox,bbtk::AtomicBlackBox);
+void PlaneReorientationBox::Process()
+{
+ if(!bbGetInputInX().empty() && bbGetInputInX().size() == 3 && !bbGetInputInY().empty() && bbGetInputInY().size() == 3 && !bbGetInputInZ().empty() && bbGetInputInZ().size() == 3)
+ {
+ /*Unitary Vector in Y*/
+ double y[3];
+ y[0] = 0;
+ y[1] = 1;
+ y[2] = 0;
+
+ /*Unitary Vector in X*/
+ double x[3];
+ x[0] = 1;
+ x[1] = 0;
+ x[2] = 0;
+
+ double normal[3];
+
+ /*Normal vector without its z factor*/
+ double normalZ[3];
+ normalZ[0] = normal[0];
+ normalZ[1] = normal[1];
+ normalZ[2] = 0;
+
+ /*Normal vector without its y factor*/
+ double normalY[3];
+ normalY[0] = normal[0];
+ normalY[1] = 0;
+ normalY[2] = normal[2];
+
+ /*Angle for the rotation in Z*/
+ double angleZ = acos(vtkMath::Dot(normalZ,y)/vtkMath::Norm(normalZ));
+
+ /*Angle for the rotation in Y*/
+ double angleY = acos(vtkMath::Dot(x,normalY)/vtkMath::Norm(normalY));
+
+ /*Convert from Radians to Degrees*/
+ angleZ = vtkMath::DegreesFromRadians(angleZ);
+ angleY = vtkMath::DegreesFromRadians(angleY);
+ 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)
+ {
+ transform->RotateWXYZ(angleZ,0,0,1);
+ }
+ else
+ {
+ transform->RotateWXYZ(angleZ,0,0,-1);
+ }
+ if(normal[1]<0)
+ {
+ transform->RotateWXYZ(angleY,0,1,0);
+ }
+ else
+ {
+ if(angleY != 180){transform->RotateWXYZ(angleY,0,-1,0);}
+ }
+ //transform->Translate(bbGetInputCenterPoint()[0],bbGetInputCenterPoint()[1],bbGetInputCenterPoint()[2]);
+ transform->Update();
+
+ /*Set output and pray to god that it works :P*/
+ bbSetOutputOut(transform);
+ }
+}
+void PlaneReorientationBox::bbUserSetDefaultValues()
+{
+ std::vector<int> nullVector;
+ bbSetInputInX(nullVector);
+ bbSetInputInY(nullVector);
+ bbSetInputInZ(nullVector);
+}
+void PlaneReorientationBox::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+void PlaneReorientationBox::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbPackRecalage
+
+
--- /dev/null
+#ifndef __bbPackRecalagePlaneReorientationBox_h_INCLUDED__
+#define __bbPackRecalagePlaneReorientationBox_h_INCLUDED__
+#include "bbPackRecalage_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "vtkTransform.h"
+#include "vtkMath.h"
+#include "vtkMatrix4x4.h"
+#include "PlaneReorientation.h"
+#include <string>
+
+#include "iostream"
+
+namespace bbPackRecalage
+{
+
+class bbPackRecalage_EXPORT PlaneReorientationBox
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(PlaneReorientationBox,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(InX,std::vector<int>);
+ BBTK_DECLARE_INPUT(InY,std::vector<int>);
+ BBTK_DECLARE_INPUT(InZ,std::vector<int>);
+ BBTK_DECLARE_INPUT(labels,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(CenterPoint,std::vector<int>);
+ BBTK_DECLARE_OUTPUT(Out,vtkTransform*);
+ BBTK_PROCESS(Process);
+ void Process();
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneReorientationBox,bbtk::AtomicBlackBox);
+BBTK_NAME("PlaneReorientationBox");
+BBTK_AUTHOR("jn.trillos44@uniandes.edu.co");
+BBTK_DESCRIPTION("Reorientates an image by use of a plane");
+BBTK_CATEGORY("filter");
+BBTK_INPUT(PlaneReorientationBox,InX,"Points in X (for all the three points)",std::vector<int>,"");
+BBTK_INPUT(PlaneReorientationBox,InY,"Points in Y (for all the three points)",std::vector<int>,"");
+BBTK_INPUT(PlaneReorientationBox,InZ,"Points in Z (for all the three points)",std::vector<int>,"");
+BBTK_INPUT(PlaneReorientationBox,labels,"Labels of the points",std::vector<std::string>,"");
+BBTK_INPUT(PlaneReorientationBox,CenterPoint,"CenterPoint",std::vector<int>,"");
+BBTK_OUTPUT(PlaneReorientationBox,Out,"Transformation ",vtkTransform*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(PlaneReorientationBox);
+}
+// EO namespace bbPackRecalage
+
+#endif // __bbPackRecalagePlaneNormalBox_h_INCLUDED__
+