]> Creatis software - creaRigidRegistration.git/commitdiff
Chasse aux variables non initialisées
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 17 Feb 2010 17:41:52 +0000 (17:41 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 17 Feb 2010 17:41:52 +0000 (17:41 +0000)
CMakeLists.txt
PackRecalage/bbs/appli/ExampleRecalage.bbs
PackRecalage/src/bbPackRecalageReSlicerBox.cxx
PackRecalage/src/bbPackRecalageResampleBox.cxx
PackRecalage/src/bbPackRecalageResampleBox.h
PackRecalage/src/bbPackRecalageTransform3D3PointsBox.cxx
lib/CheckBoard.cpp
lib/Substraction.cxx
lib/Surface.cxx

index c81b8a93bf4d590b7d7057c5c77da5f0e98514bb..d9613c21b20d509e7ce86f6e90bfdcb3c630341d 100644 (file)
@@ -10,7 +10,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 ###################################
-PROJECT(CreaRecalage)
+PROJECT(creaRigidRegistration)
 ###################################
 
 #==================================
index 463371c4d194de8d4b200fd8614499b8484079f1..ea5ea42ab76cbd49a61d4480a09391e0936243e0 100644 (file)
@@ -98,7 +98,6 @@ new ViewerNV viewer3
 
 new CommandButton butExec
   //set butExec.Label "Execute"
 
 //Tab for the first image
 
@@ -140,4 +139,4 @@ connect tab1.Widget main.Widget1
 connect tab2.Widget main.Widget2
 //connect result.Widget main.Widget3
 
-exec main
\ No newline at end of file
+exec main
index 7719669172df88cf7d90ce9aeee46b8c49b61b80..0786a1d299d217f80efdd181ec18a9978b6343a4 100644 (file)
@@ -37,11 +37,11 @@ void ReSlicerBox::Process()
                imageResult->SetOutputSpacing( spc ); 
                imageResult->SetOutputOrigin( 0,0,0 ); 
        
-               bbSetOutputOut( imageResult->GetOutput() );                     
+               bbSetOutputOut( imageResult->GetOutput() );
        }
        else
        {
-               bbSetOutputOut( NULL );         
+               bbSetOutputOut( NULL );
        }  
 }
 void ReSlicerBox::bbUserSetDefaultValues()
index 3a5a7b8af0d792f6ed5119233185703e40052501..9350844d189e6e922e28e3982285fb363024d996 100644 (file)
@@ -3,8 +3,8 @@
 namespace bbPackRecalage
 {
 
-BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ResampleBox)
-BBTK_BLACK_BOX_IMPLEMENTATION(ResampleBox,bbtk::AtomicBlackBox);
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage, ResampleBox)
+BBTK_BLACK_BOX_IMPLEMENTATION(ResampleBox, bbtk::AtomicBlackBox);
 void ResampleBox::Process()
 {
     if(bbGetInputIn() != NULL && bbGetInputFactor() != 0)
@@ -24,20 +24,24 @@ void ResampleBox::Process()
                bbSetOutputOut(NULL);
        }
 }
+
 void ResampleBox::bbUserSetDefaultValues()
 {
     bbSetInputIn(NULL);
        bbSetInputFactor(0);
        bbSetOutputOut(NULL);
 }
+
 void ResampleBox::bbUserInitializeProcessing()
 {
        resample = vtkImageResample::New();
 }
+
 void ResampleBox::bbUserFinalizeProcessing()
 {
        resample->Delete(); 
 }
+
 }
 // EO namespace bbPackRecalage
 
index 8cf3b37af7c6f6dc852a93edef9c693cb289227a..33d7eb24e5cb35d741e3c4f7fa5293ba93ff1a8c 100644 (file)
@@ -13,7 +13,7 @@ class bbPackRecalage_EXPORT ResampleBox
  : 
    public bbtk::AtomicBlackBox
 {
-  BBTK_BLACK_BOX_INTERFACE(ResampleBox,bbtk::AtomicBlackBox);
+  BBTK_BLACK_BOX_INTERFACE(ResampleBox, bbtk::AtomicBlackBox);
   BBTK_DECLARE_INPUT(In,vtkImageData *);
   BBTK_DECLARE_INPUT(Factor,double);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData *);
index 009c16a7814c668ecb3d4e7df7813a6fd5f3e1d1..b4eb9dff0d9df561c9b8bf1da9f4165f798ff063 100644 (file)
@@ -16,7 +16,7 @@ void Transform3D3PointsBox::Process()
                double A2[3];
                double B2[3];
                double O2[3];
-               
+
                //In case there is an order in the points
                if(!bbGetInputLabels1().empty() && !bbGetInputLabels2().empty() && bbGetInputLabels1()[0].compare("1") == 0 && bbGetInputLabels1()[1].compare("2") == 0 && bbGetInputLabels1()[2].compare("3") == 0)
                {
@@ -92,7 +92,7 @@ void Transform3D3PointsBox::Process()
                }
 
                //Create the new center point
-               double centerPoint[3];
+               double centerPoint[3];  // JPR
                centerPoint[0] = O2[0];
                centerPoint[1] = O2[1];
                centerPoint[2] = O2[2];
@@ -252,3 +252,4 @@ void Transform3D3PointsBox::bbUserFinalizeProcessing()
 }
 }
 // EO namespace bbPackRecalage
+
index cb3bdc69a2da882c2ce2560bcf3c205fd7160fea..a0ae2d74423d1a9dc21a4ae4039a1d72d2bb2c75 100644 (file)
@@ -1,12 +1,22 @@
 #include "CheckBoard.h"
 
-
 /*
 * Constructor
 */
 //------------------------------------------------------------
 CheckBoard::CheckBoard()
+:              // use 'Initialization List'! //JPR
+       image1(NULL);
+       image2(NULL);
+       squaresX(0);
+       squaresY(0);
+       newImage(NULL);
+       processed(false);
+       newImage(NULL);
+       resample(NULL);
+       result(NULL);
 {
+/*
        image1=NULL;
        image2=NULL;
        squaresX=0;
@@ -16,6 +26,7 @@ CheckBoard::CheckBoard()
        newImage = NULL;
        resample = NULL;
        result = NULL;
+*/
 }
 
 /*
@@ -27,7 +38,7 @@ CheckBoard::~CheckBoard()
        //if (image1 != NULL ) { image1->Delete(); }
        //if (image2 != NULL ) { image2->Delete(); }
        if (newImage != NULL ) { newImage->Delete(); }
-       if (result != NULL ) { result->Delete(); }
+       if (result   != NULL ) { result->Delete();   }
 }
 
 //------------------------------------------------------------
@@ -36,7 +47,6 @@ void CheckBoard::calculateImage()
 
        if(image1!=NULL && image2!=NULL)
        {
-
                // IMAGE 1
                        
                // Information from image1
@@ -44,7 +54,7 @@ void CheckBoard::calculateImage()
                image1->GetExtent(extImg1);
 
                type = image1->GetScalarType();
-               
+
                // The Z dimension is 1 for a 2D image
                dimImg1[0] = extImg1[1] - extImg1[0]+1;
                dimImg1[1] = extImg1[3] - extImg1[2]+1;
@@ -63,7 +73,7 @@ void CheckBoard::calculateImage()
 
                long numPixelsImg1 = dimImg1[0]*dimImg1[1];
                long numPixelsImg2 = dimImg2[0]*dimImg2[1];
-               
+
                double factorX = 1;
                double factorY = 1;
                resample = vtkImageResample::New();
@@ -81,7 +91,6 @@ void CheckBoard::calculateImage()
                        result = resample->GetOutput();
                        result->Update();
                        createImage(result,image2,dimImg2[0],dimImg2[1]);               
-                       
                } //if
                else if (numPixelsImg1>numPixelsImg2)
                {
@@ -94,7 +103,7 @@ void CheckBoard::calculateImage()
 
                        initialize(dimImg1, spcImg1);
                        result = resample->GetOutput();
-                       
+
                        result->Update();
 
                        createImage(image1,result,dimImg1[0],dimImg1[1]);
@@ -114,11 +123,11 @@ void CheckBoard::calculateImage()
 
                        result = resample->GetOutput();
                        result->Update();
-                       
+
                        createImage(image1,result,dimImg1[0],dimImg1[1]);
 
                } //else
-               
+
                resample->Delete();             
                processed=true;
        }
@@ -137,8 +146,6 @@ void CheckBoard::initialize(int dimensions[], double spacing[])
        newImage->SetDimensions(dimensions);
        newImage->AllocateScalars();
        newImage->Update();
-       
-
 }
 
 //------------------------------------------------------------
@@ -247,7 +254,6 @@ void CheckBoard::createImage(vtkImageData *img1, vtkImageData *img2, int sizeX,
                createImageByType(dataImagePointer1,dataImagePointer2,dataImageResultPointer,img1,img2,sizeX,sizeY);
        }
 
-               
        //std::cout << "The image has been checkboardized!" << std::endl;
    newImage->Update();
 //   newImage->Modified();
@@ -260,7 +266,7 @@ void CheckBoard::createImageByType(T* dataImagePointer1, T* dataImagePointer2, T
        dataImagePointer1 = (T*) img1->GetScalarPointer(0,0,0);
        dataImagePointer2 = (T*) img2->GetScalarPointer(0,0,0);
        dataImageResultPointer = (T*) newImage->GetScalarPointer(0,0,0);
-       
+
        if(squaresX == 0)
        {
                squaresX = 1;
@@ -268,11 +274,12 @@ void CheckBoard::createImageByType(T* dataImagePointer1, T* dataImagePointer2, T
        if(squaresY == 0)
        {
                squaresY = 1;
-       }    
+       }
 
        int divX = sizeX/squaresX;
        int divY = sizeY/squaresY;
-       int i, j, counterX, counterY;
+       int i, j;
+       int counterX=0, counterY;  // JPR : uninitialized
        for(i = 0; i < sizeX; i++)
        {
                counterY = 0; 
@@ -341,4 +348,3 @@ void CheckBoard::setRows(int rows)
 {
        squaresY=rows;
 }
-
index 853e5de3d98c610337725f09f6a0428108f5e4b3..96f01a402ecb28569f88fd9c2b41cc9fa064781b 100644 (file)
@@ -44,7 +44,7 @@ Substraction::Substraction(vtkImageData* imageData1,vtkImageData* imageData2, in
        }
        
        //Original image type this case is an unsigned char (3)
-       int t=imageData1->GetScalarType();
+       //int t=imageData1->GetScalarType(); // JPR : unused
        //substracting the image
        substractImage(imageData1, imageData2);
 }
@@ -58,7 +58,6 @@ Substraction::~Substraction()
 // Methods
 //----------------------------------------------------------------------------
 
-
 /*
 Calculate the new image and save it in the attribute imageResult
 it is used if the user had given the imageData
@@ -66,27 +65,27 @@ it is used if the user had given the imageData
 void Substraction::substractImage(vtkImageData* imageData1, vtkImageData* imageData2)
 {
        //dimensions of the image (extent)
-       int ext[6];
+    int ext[6];
        //setting the dimensionality (1d or 2d or 3d )
     int newDim[3];
        //image spacing
     double spc[3];
   
        //getting the information from the original image
-       imageData1->GetSpacing(spc);
-       imageData1->GetExtent(ext);
+    imageData1->GetSpacing(spc);
+    imageData1->GetExtent(ext);
        
        //this a 2d image
-       newDim[0]=ext[1]-ext[0]+1;
+    newDim[0]=ext[1]-ext[0]+1;
     newDim[1]=ext[3]-ext[2]+1;
     newDim[2]=1;// in general it is ext[5]-ext[4]+1
 
 
-       imageType = imageData1->GetScalarType();
+    imageType = imageData1->GetScalarType();
        //initializing the image that represents the substracted image
-       initialize(newDim,spc);
+    initialize(newDim,spc);
        //Time to substract
-       substract(imageData1, imageData2);      
+    substract(imageData1, imageData2); 
 }
 
 /*
index 08993a91925fc4959d37d82edd5c8549602f4154..0886e13cc743f4a608b8493bc0a808b83eeac40e 100644 (file)
@@ -233,7 +233,8 @@ void Surface::surfaceByType(T* dataImagePointer, vtkImageData* imageData, T max)
        //-----------------
        //walking in the image
        int i=0,j=0,k=0;
-       double sum1=0,sum2=0,sum3=0,sum4=0;     
+       double sum1=0;  
+       //double sum2=0,sum3=0,sum4=0;  // JPR : unused
        for(i=0;i<sx;i++)
        {
                for(j=0;j<sy;j++)