MyTimer::~MyTimer()
{
- delete this;
+ //delete this;
}
void MyTimer::Notify()
{
image = vtkImageChangeInformation::New();
image->SetInput( bbGetInputIn() );
- image->SetOutputSpacing( 1,1,1 );
+ image->SetOutputSpacing( 1,1,1 );
+ if(bbGetInputCentered())
+ {
+ image->CenterImageOn();
+ }
slicer =vtkImageReslice::New();
slicer->SetInput( image->GetOutput() );
+ slicer->SetInformationInput( image->GetOutput() );
slicer->SetResliceTransform(bbGetInputTransform());
- slicer->SetOutputOrigin( 0 , 0 , 0 );
- slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) );
- std::cout << "Reslicer: Origin points: X = " << bbGetInputOrigin()[0] << " Y = " << bbGetInputOrigin()[1] << " Z = " << bbGetInputOrigin()[2] << std::endl;
+ slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) );
+ if(bbGetInputInterpolate())
+ {
+ slicer->InterpolateOn();
+ }
slicer->Update();
-
+
imageResult = vtkImageChangeInformation::New();
imageResult->SetInput( slicer->GetOutput() );
double spc[3];
}
void ReSlicerBox::bbUserSetDefaultValues()
-{
-
- std::vector<int> nuevo(3,0);
- nuevo.push_back(0);
- bbSetInputOrigin(nuevo);
+{
+ std::vector<int> empty;
+ bbSetInputOrigin(empty);
bbSetInputIn(NULL);
- bbSetInputTransform(vtkIdentityTransform::New());
+ bbSetInputTransform(vtkTransform::New());
bbSetOutputOut(NULL);
+ bbSetInputCentered(false);
+ bbSetInputInterpolate(false);
}
void ReSlicerBox::bbUserInitializeProcessing()
imageResult->Delete();
}
}
-// EO namespace bbPackRecalage
-
+// EO namespace bbPackRecalage
\ No newline at end of file
#include "iostream"
#include "vtkImageReslice.h"
-#include "vtkLinearTransform.h"
+#include "vtkTransform.h"
#include "vtkImageData.h"
#include "vtkIdentityTransform.h"
BBTK_BLACK_BOX_INTERFACE(ReSlicerBox,bbtk::AtomicBlackBox);
BBTK_DECLARE_INPUT(In,vtkImageData *);
BBTK_DECLARE_INPUT(Origin,std::vector<int>);
- BBTK_DECLARE_INPUT(Transform,vtkLinearTransform *);
+ BBTK_DECLARE_INPUT(Transform,vtkTransform *);
+ BBTK_DECLARE_INPUT(Centered,bool);
+ BBTK_DECLARE_INPUT(Interpolate,bool);
BBTK_DECLARE_OUTPUT(Out,vtkImageData *);
BBTK_PROCESS(Process);
void Process();
vtkImageChangeInformation* image;
vtkImageChangeInformation* imageResult;
vtkImageReslice* slicer;
-
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReSlicerBox,bbtk::AtomicBlackBox);
BBTK_CATEGORY("filter");
BBTK_INPUT(ReSlicerBox,In,"Image input",vtkImageData *,"");
BBTK_INPUT(ReSlicerBox,Origin,"Image Origin(x,y,z)",std::vector<int>,"");
-BBTK_INPUT(ReSlicerBox,Transform,"Transform input",vtkLinearTransform *,"");
+BBTK_INPUT(ReSlicerBox,Transform,"Transform input",vtkTransform *,"");
+BBTK_INPUT(ReSlicerBox,Centered,"Rotations of the image are in the center of the image. DEFAULT = False.",bool,"");
+BBTK_INPUT(ReSlicerBox,Interpolate,"Linear interpolation On. DEFAULT = False.",bool,"");
BBTK_OUTPUT(ReSlicerBox,Out,"Image output",vtkImageData *,"");
BBTK_END_DESCRIBE_BLACK_BOX(ReSlicerBox);
}
transformer->SetScaleY( bbGetInputScaleY() );
transformer->SetScaleZ( bbGetInputScaleZ() );
- //If 3D, make extra preparations
- if(_3D)
- {
- transformer->SetAxis(bbGetInputAxis());
- }
-
// The calculation of the transformations are made
- transformer->Run(_3D);
+ transformer->Run();
// We get the results of transformer and set it as result of this box
bbSetOutputOut( transformer->GetResult() );
}
bbSetInputScaleX(100);
bbSetInputScaleY(100);
bbSetInputScaleZ(100);
- bbSetOutputOut(NULL);
- _3D = false;
+ bbSetOutputOut(NULL);
}
void Transform2DBox::bbUserInitializeProcessing()
}
}
-// EO namespace bbPackRecalage
-
-
+// EO namespace bbPackRecalage
\ No newline at end of file
/*Point(x,y) -> Rotation Center*/
BBTK_DECLARE_INPUT(CenterPoint,std::vector<int>);
- /*Vector(x,y) -> Axis Rotation Vector*/
- BBTK_DECLARE_INPUT(Axis,std::vector<double>);
-
-
/*Rotation angle*/
BBTK_DECLARE_INPUT(Angle,double);
/*Scalation to be done int the z axis*/
BBTK_DECLARE_INPUT(ScaleZ,double);
- /*3D transformation on or off option*/
- BBTK_DECLARE_INPUT(3D,bool);
-
/*Resultant vtkTransform*/
- BBTK_DECLARE_OUTPUT(Out, vtkLinearTransform*);
+ BBTK_DECLARE_OUTPUT(Out, vtkTransform*);
BBTK_PROCESS(Process);
void Process();
/*Class in charge of making the transformations*/
- Transformer *transformer;
-
- /*Boolean that defines if the transformation is in 3D or not. True = Transfomation is in 3D*/
- bool _3D;
+ Transformer *transformer;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform2DBox,bbtk::AtomicBlackBox);
BBTK_DESCRIPTION("Given 2 points and an angle, it calculates the vtkTransform result after aplying the transformations, using the first point as base of the transformation");
BBTK_CATEGORY("filter");
BBTK_INPUT(Transform2DBox,CenterPoint,"Point (x,y,z) -> Rotation Center",std::vector<int>,"");
-BBTK_INPUT(Transform2DBox,Axis,"Vector (x,y,z) -> Axis Rotation Vector. Used only on 3D transformations.",std::vector<double>,"");
BBTK_INPUT(Transform2DBox,Angle,"Rotation Angle",double,"");
BBTK_INPUT(Transform2DBox,ScaleX,"Scale in X",double,"");
BBTK_INPUT(Transform2DBox,ScaleY,"Scale in Y",double,"");
BBTK_INPUT(Transform2DBox,ScaleZ,"Scale in Z",double,"");
-BBTK_INPUT(Transform2DBox,3D,"Boolean that defines if the transformation is in 3D or not. True = Transfomation is in 3D ",bool,"");
-BBTK_OUTPUT(Transform2DBox,Out,"Linear Transform filter",vtkLinearTransform*,"");
+BBTK_OUTPUT(Transform2DBox,Out,"Linear Transform filter",vtkTransform*,"");
BBTK_END_DESCRIBE_BLACK_BOX(Transform2DBox);
}
// EO namespace bbPackRecalage