-#include "CheckBoard.h"
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+#include "CheckBoard.h"
/*
* Constructor
*/
//------------------------------------------------------------
-CheckBoard::CheckBoard()
+CheckBoard::CheckBoard() :
+ image1(NULL),
+ image2(NULL),
+ squaresX(0),
+ squaresY(0),
+ newImage(NULL),
+ processed(false),
+ resample(NULL),
+ result(NULL)
{
+/*
image1=NULL;
image2=NULL;
squaresX=0;
newImage = NULL;
resample = NULL;
result = NULL;
+*/
}
/*
//if (image1 != NULL ) { image1->Delete(); }
//if (image2 != NULL ) { image2->Delete(); }
if (newImage != NULL ) { newImage->Delete(); }
- if (resample != NULL ) { resample->Delete(); }
- if (result != NULL ) { result->Delete(); }
+ if (result != NULL ) { result->Delete(); }
}
//------------------------------------------------------------
if(image1!=NULL && image2!=NULL)
{
-
// IMAGE 1
// Information from image1
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;
long numPixelsImg1 = dimImg1[0]*dimImg1[1];
long numPixelsImg2 = dimImg2[0]*dimImg2[1];
-
+
double factorX = 1;
double factorY = 1;
resample = vtkImageResample::New();
result = resample->GetOutput();
result->Update();
createImage(result,image2,dimImg2[0],dimImg2[1]);
-
} //if
else if (numPixelsImg1>numPixelsImg2)
{
initialize(dimImg1, spcImg1);
result = resample->GetOutput();
-
+
result->Update();
createImage(image1,result,dimImg1[0],dimImg1[1]);
result = resample->GetOutput();
result->Update();
-
+
createImage(image1,result,dimImg1[0],dimImg1[1]);
} //else
-
+
resample->Delete();
processed=true;
}
newImage->SetDimensions(dimensions);
newImage->AllocateScalars();
newImage->Update();
-
-
}
//------------------------------------------------------------
createImageByType(dataImagePointer1,dataImagePointer2,dataImageResultPointer,img1,img2,sizeX,sizeY);
}
-
//std::cout << "The image has been checkboardized!" << std::endl;
newImage->Update();
// newImage->Modified();
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;
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;
{
squaresY=rows;
}
-