]> Creatis software - creaRigidRegistration.git/commitdiff
*** empty log message ***
authortrillos <trillos>
Wed, 2 Dec 2009 13:10:41 +0000 (13:10 +0000)
committertrillos <trillos>
Wed, 2 Dec 2009 13:10:41 +0000 (13:10 +0000)
13 files changed:
CMakeLists.txt
PackRecalage/CMakeLists.txt
PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx
PackRecalage/src/bbPackRecalageCalculateVectorBox.h
PackRecalage/src/bbPackRecalageCheckBoardBox.cxx
PackRecalage/src/bbPackRecalageImageConvolution.cxx
PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx
PackRecalage/src/bbPackRecalageImageSubstraction.cxx
PackRecalage/src/bbPackRecalagePlaneReorientationBox.cxx
PackRecalage/src/bbPackRecalagePlaneReorientationBox.h
PackRecalage/src/bbPackRecalageReSlicerBox.cxx
PackRecalage/src/bbPackRecalageTransform2DBox.h
lib/Convolution.cxx

index 8623c5cb54405aeac04090aa70ba7852260ae99e..c81b8a93bf4d590b7d7057c5c77da5f0e98514bb 100644 (file)
@@ -29,6 +29,14 @@ IF (crea_FOUND)
 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()
index f2ba084958d1681db59790ec70b104c66f53d5b4..940b7edaf199c6af4c9820d5ffdad5a85cbd6278 100644 (file)
@@ -122,7 +122,8 @@ SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS
 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} 
   )
 #===========================================================================
 
index ae3c1666780584594d0b72ff873ae54ad1664f8a..acc9925fde6a320b506d4798aa3278b55a7050eb 100644 (file)
@@ -9,25 +9,24 @@ namespace bbPackRecalage
 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); 
index 0e0a8deb95cf61e6b894ec01a955c63c38a80113..485612e7c5f6e50fd606d039a42595876a525332 100644 (file)
@@ -4,7 +4,7 @@
 #include "bbtkAtomicBlackBox.h"
 #include "iostream"
 
-#include "VectorMath.h"
+#include "PlanesOperations.h"
 
 namespace bbPackRecalage
 {
@@ -64,7 +64,7 @@ class bbPackRecalage_EXPORT CalculateVectorBox
 
   private:
          
-         VectorMath *_vector;
+         PlanesOperations *_vector;
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(CalculateVectorBox,bbtk::AtomicBlackBox);
index 6502daf469bfccedaeaf2e14cbec4d271960a6ca..895a72c42102432bebb082e9e92e27cee99cba1b 100644 (file)
@@ -8,22 +8,24 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,CheckBoardBox)
 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); 
index c37aa3de0672f542bf18c2151b9d9f6c5a554a13..d4ce2be488e8e58a9d9d8de92e43d01a1eb553eb 100644 (file)
@@ -32,14 +32,6 @@ void ImageConvolution::bbUserInitializeProcessing()
 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
index e5863e5811e69eb9df9f740cf88238c36b3b99d2..586af769286801cac771ae2280a7551186bb6bc9 100644 (file)
@@ -11,24 +11,16 @@ void ImageRecalageProperties::Process()
        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);
                }
        }
 }
index 46864cc1435802063b803ac11592a7729509575c..fc286d75e46f872010a9d226f69a40371bd45719 100644 (file)
@@ -35,12 +35,10 @@ void ImageSubstraction::bbUserInitializeProcessing()
 }
 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
index ea921adc6d0531f194802701e5d83065a7e086b7..1e867901decbb200b1c1631cf6eadf4d7a4315a0 100644 (file)
@@ -9,6 +9,30 @@ void PlaneReorientationBox::Process()
 {
        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;
@@ -19,9 +43,7 @@ void PlaneReorientationBox::Process()
                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];
@@ -47,7 +69,6 @@ void PlaneReorientationBox::Process()
                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)
                {
@@ -71,6 +92,12 @@ void PlaneReorientationBox::Process()
                /*Set output and pray to god that it works :P*/
                bbSetOutputOut(transform);
        }
+       else
+       {
+               transform->Identity();
+               transform->Update();
+               bbSetOutputOut(transform);
+       }
 }
 void PlaneReorientationBox::bbUserSetDefaultValues()
 {
@@ -81,22 +108,11 @@ 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
index d81c4d83b605df7fe067419bdd52d9693638c4c2..076b5af2dc09d0efd55ccba0af06c34ceecb4ab7 100644 (file)
@@ -26,6 +26,9 @@ class bbPackRecalage_EXPORT PlaneReorientationBox
   BBTK_DECLARE_OUTPUT(Out,vtkTransform*);
   BBTK_PROCESS(Process);
   void Process();
+
+  private:
+         vtkTransform *transform;
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneReorientationBox,bbtk::AtomicBlackBox);
index c30ee0f49a5635017baebd9ccb075312f709a5f4..f00d13ba4868264e58e6039e6f4d87ce848c2bef 100644 (file)
@@ -8,16 +8,24 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ReSlicerBox)
 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() );
@@ -30,6 +38,8 @@ void ReSlicerBox::Process()
                }               
                slicer->Update();
 
+               std::cout << "NTU ReSlicerBox : entered 5" << std::endl;
+
                imageResult = vtkImageChangeInformation::New();
                imageResult->SetInput( slicer->GetOutput() );
                double spc[3];
@@ -43,6 +53,8 @@ void ReSlicerBox::Process()
        {
                bbSetOutputOut( bbGetInputIn() );
        }
+
+       std::cout << "NTU ReSlicerBox : out" << std::endl;
          
 }
 void ReSlicerBox::bbUserSetDefaultValues()
@@ -50,7 +62,7 @@ void ReSlicerBox::bbUserSetDefaultValues()
        std::vector<int> empty;
        bbSetInputOrigin(empty); 
     bbSetInputIn(NULL); 
-    bbSetInputTransform(vtkTransform::New());
+    bbSetInputTransform(NULL);
     bbSetOutputOut(NULL);
        bbSetInputCentered(false);
        bbSetInputInterpolate(false);
@@ -68,12 +80,7 @@ void ReSlicerBox::bbUserInitializeProcessing()
        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();
index d8ee00b72d1da8170bfa36e3e57557b0fb98f1b5..3d9dbbb62525f00ee0a0bb30da384d75418de222 100644 (file)
@@ -22,14 +22,14 @@ class bbPackRecalage_EXPORT Transform2DBox
                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*/
index 450df87222c0ba01bee5c9aa32de2ebf01febef6..02bf6009be3080c759a21bf238de24e84658424d 100644 (file)
@@ -50,7 +50,7 @@ void Convolution::Run()
                _convolve->SetKernel3x3(kernel);
                _convolve->Update();
                _cast->SetInput(_convolve->GetOutput());
-               _cast->SetOutputScalarTypeToDouble();
+               //_cast->SetOutputScalarTypeToDouble();
                _cast->Update();
        }
        else