X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FSubstraction.cxx;h=96f01a402ecb28569f88fd9c2b41cc9fa064781b;hb=1a574b510e27eb5b5f00bd37bf451cedd1b0a8d4;hp=c0be6d87ba896e338b4b9df3c75828c111694dd9;hpb=bb6bffc75df349b5f74f4197206718a87b42e4a7;p=creaRigidRegistration.git diff --git a/lib/Substraction.cxx b/lib/Substraction.cxx index c0be6d8..96f01a4 100644 --- a/lib/Substraction.cxx +++ b/lib/Substraction.cxx @@ -6,7 +6,7 @@ Substraction::Substraction(vtkImageData* imageData1,vtkImageData* imageData2, in sizeImage=0; uZeroLevel=uZLevel; lZeroLevel=lZLevel; - if(uColor.size() != NULL) + if(uColor.size() != 0) { upperColor[0] = uColor[0]; upperColor[1] = uColor[1]; @@ -18,7 +18,7 @@ Substraction::Substraction(vtkImageData* imageData1,vtkImageData* imageData2, in upperColor[1] = 255; upperColor[2] = 255; } - if(mColor.size() != NULL) + if(mColor.size() != 0) { mediumColor[0] = mColor[0]; mediumColor[1] = mColor[1]; @@ -30,7 +30,7 @@ Substraction::Substraction(vtkImageData* imageData1,vtkImageData* imageData2, in mediumColor[1] = 125; mediumColor[2] = 125; } - if(lColor.size() != NULL) + if(lColor.size() != 0) { lowerColor[0] = lColor[0]; lowerColor[1] = lColor[1]; @@ -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); } /* @@ -327,4 +326,4 @@ vtkImageData* Substraction::getSubstractedImage() int Substraction::getImageSize() { return sizeImage; -} \ No newline at end of file +}