]> Creatis software - creaRigidRegistration.git/commitdiff
*** empty log message ***
authortrillos <trillos>
Mon, 16 Nov 2009 08:52:24 +0000 (08:52 +0000)
committertrillos <trillos>
Mon, 16 Nov 2009 08:52:24 +0000 (08:52 +0000)
PackRecalage/src/bbPackRecalageImageSwitcherBox.cxx
PackRecalage/src/bbPackRecalageReSlicerBox.cxx
PackRecalage/src/bbPackRecalageReSlicerBox.h
PackRecalage/src/bbPackRecalageTransform2DBox.cxx
PackRecalage/src/bbPackRecalageTransform2DBox.h

index 99c0a643b7227e955671a6fec333048642923f64..bf4afe9c36f04ff79c5f6ba47b3e538de4034c8e 100644 (file)
@@ -9,7 +9,7 @@ namespace bbPackRecalage
 
        MyTimer::~MyTimer()
        {
-               delete this;
+               //delete this;
        }
 
        void MyTimer::Notify()
index e3bf96316402fca7f199094c80c8128fef408c5a..c30ee0f49a5635017baebd9ccb075312f709a5f4 100644 (file)
@@ -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<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()
@@ -72,5 +79,4 @@ void ReSlicerBox::bbUserFinalizeProcessing()
     imageResult->Delete();
 }
 }
-// EO namespace bbPackRecalage
-
+// EO namespace bbPackRecalage
\ No newline at end of file
index b41d3bbc5d98d2594baa3974d64e5dd1019164d2..e21de51e70061efd2ced1f3994d4e99aaac9d187 100644 (file)
@@ -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<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();
@@ -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<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);
 }
index ce988d94a2f2399c9ddd4fcca792bbc324933d3b..72ee53b94b2550e19799e4c1b9a59b002f0b16e8 100644 (file)
@@ -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
index 52288f8b00deb008049448d6bb7b994811d07f8f..d8ee00b72d1da8170bfa36e3e57557b0fb98f1b5 100644 (file)
@@ -18,10 +18,6 @@ class bbPackRecalage_EXPORT Transform2DBox
                /*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);
 
@@ -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<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