CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
###################################
-PROJECT(CreaRecalage)
+PROJECT(creaRigidRegistration)
###################################
#==================================
new CommandButton butExec
//set butExec.Label "Execute"
-
//Tab for the first image
connect tab2.Widget main.Widget2
//connect result.Widget main.Widget3
-exec main
\ No newline at end of file
+exec main
imageResult->SetOutputSpacing( spc );
imageResult->SetOutputOrigin( 0,0,0 );
- bbSetOutputOut( imageResult->GetOutput() );
+ bbSetOutputOut( imageResult->GetOutput() );
}
else
{
- bbSetOutputOut( NULL );
+ bbSetOutputOut( NULL );
}
}
void ReSlicerBox::bbUserSetDefaultValues()
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)
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
:
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 *);
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)
{
}
//Create the new center point
- double centerPoint[3];
+ double centerPoint[3]; // JPR
centerPoint[0] = O2[0];
centerPoint[1] = O2[1];
centerPoint[2] = O2[2];
}
}
// EO namespace bbPackRecalage
+
#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;
newImage = NULL;
resample = NULL;
result = NULL;
+*/
}
/*
//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(); }
}
//------------------------------------------------------------
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;
}
-
}
//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);
}
// Methods
//----------------------------------------------------------------------------
-
/*
Calculate the new image and save it in the attribute imageResult
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);
}
/*
//-----------------
//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++)