From 8b1a19e083976bd9d80693030b7216704555a64f Mon Sep 17 00:00:00 2001 From: trillos Date: Mon, 16 Nov 2009 08:52:24 +0000 Subject: [PATCH] *** empty log message *** --- .../src/bbPackRecalageImageSwitcherBox.cxx | 2 +- .../src/bbPackRecalageReSlicerBox.cxx | 32 +++++++++++-------- PackRecalage/src/bbPackRecalageReSlicerBox.h | 11 ++++--- .../src/bbPackRecalageTransform2DBox.cxx | 15 ++------- .../src/bbPackRecalageTransform2DBox.h | 18 ++--------- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/PackRecalage/src/bbPackRecalageImageSwitcherBox.cxx b/PackRecalage/src/bbPackRecalageImageSwitcherBox.cxx index 99c0a64..bf4afe9 100644 --- a/PackRecalage/src/bbPackRecalageImageSwitcherBox.cxx +++ b/PackRecalage/src/bbPackRecalageImageSwitcherBox.cxx @@ -9,7 +9,7 @@ namespace bbPackRecalage MyTimer::~MyTimer() { - delete this; + //delete this; } void MyTimer::Notify() diff --git a/PackRecalage/src/bbPackRecalageReSlicerBox.cxx b/PackRecalage/src/bbPackRecalageReSlicerBox.cxx index e3bf963..c30ee0f 100644 --- a/PackRecalage/src/bbPackRecalageReSlicerBox.cxx +++ b/PackRecalage/src/bbPackRecalageReSlicerBox.cxx @@ -13,16 +13,23 @@ void ReSlicerBox::Process() { 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]; @@ -39,14 +46,14 @@ void ReSlicerBox::Process() } void ReSlicerBox::bbUserSetDefaultValues() -{ - - std::vector nuevo(3,0); - nuevo.push_back(0); - bbSetInputOrigin(nuevo); +{ + std::vector empty; + bbSetInputOrigin(empty); bbSetInputIn(NULL); - bbSetInputTransform(vtkIdentityTransform::New()); + bbSetInputTransform(vtkTransform::New()); bbSetOutputOut(NULL); + bbSetInputCentered(false); + bbSetInputInterpolate(false); } void ReSlicerBox::bbUserInitializeProcessing() @@ -72,5 +79,4 @@ void ReSlicerBox::bbUserFinalizeProcessing() imageResult->Delete(); } } -// EO namespace bbPackRecalage - +// EO namespace bbPackRecalage \ No newline at end of file diff --git a/PackRecalage/src/bbPackRecalageReSlicerBox.h b/PackRecalage/src/bbPackRecalageReSlicerBox.h index b41d3bb..e21de51 100644 --- a/PackRecalage/src/bbPackRecalageReSlicerBox.h +++ b/PackRecalage/src/bbPackRecalageReSlicerBox.h @@ -5,7 +5,7 @@ #include "iostream" #include "vtkImageReslice.h" -#include "vtkLinearTransform.h" +#include "vtkTransform.h" #include "vtkImageData.h" #include "vtkIdentityTransform.h" @@ -22,7 +22,9 @@ class bbPackRecalage_EXPORT ReSlicerBox BBTK_BLACK_BOX_INTERFACE(ReSlicerBox,bbtk::AtomicBlackBox); BBTK_DECLARE_INPUT(In,vtkImageData *); BBTK_DECLARE_INPUT(Origin,std::vector); - 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(); @@ -30,7 +32,6 @@ class bbPackRecalage_EXPORT ReSlicerBox vtkImageChangeInformation* image; vtkImageChangeInformation* imageResult; vtkImageReslice* slicer; - }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReSlicerBox,bbtk::AtomicBlackBox); @@ -40,7 +41,9 @@ BBTK_DESCRIPTION("Uses the vtk ReSlicer tool to modify an input image given a tr BBTK_CATEGORY("filter"); BBTK_INPUT(ReSlicerBox,In,"Image input",vtkImageData *,""); BBTK_INPUT(ReSlicerBox,Origin,"Image Origin(x,y,z)",std::vector,""); -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); } diff --git a/PackRecalage/src/bbPackRecalageTransform2DBox.cxx b/PackRecalage/src/bbPackRecalageTransform2DBox.cxx index ce988d9..72ee53b 100644 --- a/PackRecalage/src/bbPackRecalageTransform2DBox.cxx +++ b/PackRecalage/src/bbPackRecalageTransform2DBox.cxx @@ -16,14 +16,8 @@ void Transform2DBox::Process() 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() ); } @@ -43,8 +37,7 @@ void Transform2DBox::bbUserSetDefaultValues() bbSetInputScaleX(100); bbSetInputScaleY(100); bbSetInputScaleZ(100); - bbSetOutputOut(NULL); - _3D = false; + bbSetOutputOut(NULL); } void Transform2DBox::bbUserInitializeProcessing() @@ -61,6 +54,4 @@ void Transform2DBox::bbUserFinalizeProcessing() } } -// EO namespace bbPackRecalage - - +// EO namespace bbPackRecalage \ No newline at end of file diff --git a/PackRecalage/src/bbPackRecalageTransform2DBox.h b/PackRecalage/src/bbPackRecalageTransform2DBox.h index 52288f8..d8ee00b 100644 --- a/PackRecalage/src/bbPackRecalageTransform2DBox.h +++ b/PackRecalage/src/bbPackRecalageTransform2DBox.h @@ -18,10 +18,6 @@ class bbPackRecalage_EXPORT Transform2DBox /*Point(x,y) -> Rotation Center*/ BBTK_DECLARE_INPUT(CenterPoint,std::vector); - /*Vector(x,y) -> Axis Rotation Vector*/ - BBTK_DECLARE_INPUT(Axis,std::vector); - - /*Rotation angle*/ BBTK_DECLARE_INPUT(Angle,double); @@ -36,20 +32,14 @@ class bbPackRecalage_EXPORT Transform2DBox /*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); @@ -58,13 +48,11 @@ BBTK_AUTHOR("va-perez@uniandes.edu.co"); 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,""); -BBTK_INPUT(Transform2DBox,Axis,"Vector (x,y,z) -> Axis Rotation Vector. Used only on 3D transformations.",std::vector,""); 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 -- 2.47.1