EMLocalRegistrationCostFunction.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003 (c) Copyright 2001 Massachusetts Institute of Technology 
00004 
00005 Permission is hereby granted, without payment, to copy, modify, display 
00006 and distribute this software and its documentation, if any, for any purpose, 
00007 provided that the above copyright notice and the following three paragraphs 
00008 appear on all copies of this software.  Use of this software constitutes 
00009 acceptance of these terms and conditions.
00010 
00011 IN NO EVENT SHALL MIT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, 
00012 INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE 
00013 AND ITS DOCUMENTATION, EVEN IF MIT HAS BEEN ADVISED OF THE POSSIBILITY OF 
00014 SUCH DAMAGE.
00015 
00016 MIT SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING, 
00017 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR 
00018 A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
00019 
00020 THE SOFTWARE IS PROVIDED "AS IS."  MIT HAS NO OBLIGATION TO PROVIDE 
00021 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00022 
00023 =========================================================================auto=*/
00024 
00025 #ifndef _EMLOCALREGISTRATIONCOSTFUNCTION_H_INCLUDED
00026 #define _EMLOCALREGISTRATIONCOSTFUNCTION_H_INCLUDED 1
00027 
00028 #include "assert.h"
00029 
00030 #include "vtkEMSegment.h"
00031 #include "vtkMultiThreader.h"
00032 #include "vtkImageEMGenericClass.h" 
00033 #include "EMLocalInterface.h" 
00034 #include "assert.h"
00035 
00036 // Registration Procedures originally defined by Simon but changed by me 
00037 
00038 // The Registration Parameters 
00039 // A(From Atlas To Structure) = A(Global To Structure) * A(Atlas to Global)
00040 
00041 // #define EMSEGMENT_REGISTRATION_.. is defined in vtkImageEMLocalSuperClass.h
00042 
00043 #define EMLOCALREGISTRATION_MAX_PENALITY float(1.0e20)
00044 
00045 
00046 // --------------------------------------
00047 // Threader Structure
00048 // --------------------------------------
00049 typedef struct {
00050   double Result;
00051   int Real_VoxelStart[3];
00052   int Boundary_VoxelOffset;
00053   // Job specifc number of Voxels in Image Space (not considering boundaries); 
00054   int ROI_NumVoxels;
00055   //int DebugMin[3];
00056   //int DebugMax[3];
00057 
00058 } EMLocalRegistrationCostFunction_MultiThreadedParameters;
00059 
00060 // --------------------------------------
00061 // Cost Function Related Structure
00062 // The parameters are updated whenever the cost function is called 
00063 // --------------------------------------
00064 typedef struct {
00065   float** ClassToAtlasRotationMatrix;   
00066   float** ClassToAtlasTranslationVector; 
00067 
00068   // -----------------------------------------------------
00069   // Registration Specific Region - Defined by Voxel that can influence the Registration 
00070   int     ROI_MinZ;
00071   int     ROI_MinY;
00072   int     ROI_MinX;
00073 
00074   int     ROI_MaxZ;
00075   int     ROI_MaxY;
00076   int     ROI_MaxX;
00077 
00078   // Defined By difference between length of the Segmentation and Registration Space
00079   int     Boundary_OffsetY;
00080   int     Boundary_OffsetZ;
00081 
00082   // MinWeightAtlasCost =sum_x SpatialCostFunction(x)
00083   double MinWeightAtlasCost;
00084   // MinGaussianCost = G(parameters,ClassInvCovariance)
00085   double MinGaussianCost;
00086 } EMLocalRegistrationCostFunction_IterationSpecificVariables;
00087 
00088 
00089 // --------------------------------------
00090 // ROI Related Structure
00091 // Defines Region of interest for the cost function 
00092 // --------------------------------------
00093 class EMLocalRegistrationCostFunction_ROI {
00094   public:
00095   char *MAP;
00096   int MinCoord[3];
00097   int MaxCoord[3];
00098   char ClassOutside;
00099   void CreateMAP(int size);
00100 
00101   EMLocalRegistrationCostFunction_ROI() { this->MAP = NULL; memset(MaxCoord,0,sizeof(int)*3); memset(MinCoord,0,sizeof(int)*3);ClassOutside = -1;}
00102   ~EMLocalRegistrationCostFunction_ROI() {if (this->MAP) {delete[] this->MAP; this->MAP = NULL;}}
00103 }; 
00104 
00105 // --------------------------------------
00106 // ROI Related Structure
00107 // Main Class 
00108 // --------------------------------------
00109 class VTK_EMSEGMENT_EXPORT EMLocalRegistrationCostFunction { 
00110 public:
00111   // -----------------------------------------------
00112   // Core Functions 
00113  
00114  // Call this function before starting optimization
00115   void  InitializeCostFunction();
00116 
00117   // This calculates the metric defined by KL Divergence.
00118   // Call this function by optimization method 
00119   float ComputeCostFunction(const double* parameters) const;
00120 
00121   // Call this function when optimization is ended
00122   void  FinalizeCostFunction(double* Parameters, int NumOfFunctionEvaluations); 
00123   
00124   // Is called from threaded function
00125   void CostFunction_Sum_WeightxProbability(int Real_VoxelStart[3], int Boundary_VoxelOffset, int ROI_NumVoxels, double &result);
00126 
00127   // -----------------------------------------
00128   // Setting Parameters 
00129   int GetROI_MinZ(){return this->ParaDepVar->ROI_MinZ;}
00130   int GetROI_MinY(){return this->ParaDepVar->ROI_MinY;}
00131   int GetROI_MinX(){return this->ParaDepVar->ROI_MinX;}
00132   int GetROI_MaxZ(){return this->ParaDepVar->ROI_MaxZ;}
00133   int GetROI_MaxY(){return this->ParaDepVar->ROI_MaxY;}
00134   int GetROI_MaxX(){return this->ParaDepVar->ROI_MaxX;}
00135 
00136   int GetBoundary_OffsetY(){return this->ParaDepVar->Boundary_OffsetY;}
00137   int GetBoundary_OffsetZ(){return this->ParaDepVar->Boundary_OffsetZ;}
00138    
00139   // Boudnary is the area defined by SegmentationBoundary 
00140   void SetBoundary(int MinX, int MinY, int MinZ, int MaxX, int MaxY, int MaxZ); 
00141   int* GetBoundary_Min() {return this->Boundary_Min;}
00142   int* GetBoundary_Max() {return this->Boundary_Max;}
00143   int  GetBoundary_LengthX() {return this->Boundary_LengthX;}
00144   int  GetBoundary_LengthY() {return this->Boundary_LengthY;} 
00145   int  GetBoundary_LengthXYZ() {return this->Boundary_LengthXYZ;} 
00146 
00147   // Real is the area defined by Extent of image data
00148   void SetImage_Length(int LengthX, int LengthY, int LengthZ);
00149   int* GetImage_Length() {return this->Image_Length;}
00150  
00151   // Corresponds to Simon with Image_MidX = targetmidcol
00152   float GetImage_MidX() {return this->Image_MidX;}
00153   float GetImage_MidY() {return this->Image_MidY;}
00154   float GetImage_MidZ() {return this->Image_MidZ;}
00155 
00156   // Parameter related function 
00157   void SetDimensionOfParameter(int inNumberOfParameterSets, int inTwoDFlag, int inRigidFlag);
00158 
00159   int GetRigidFlag() {return this->RigidFlag;}
00160   int GetTwoDFlag() {return this->TwoDFlag;}
00161 
00162   void SetNumberOfParameterSets(int init) {this->NumberOfParameterSets = init;} 
00163   int  GetNumberOfParameterSets() {return this->NumberOfParameterSets;} 
00164   int  GetNumberOfParameterPerSet() {return this->NumberOfParameterPerSet;}
00165   int  GetNumberOfTotalParameters() { return this->NumberOfParameterSets*this->NumberOfParameterPerSet; }
00166 
00167   // Utility Function 
00168   void SetROI_Weight(EMLocalRegistrationCostFunction_ROI* init) {this->ROI_Weight = init;}
00169   void SetROI_ProbData(EMLocalRegistrationCostFunction_ROI* init) {this->ROI_ProbData = init;}
00170 
00171   void InitializeParameters();
00172 
00173   void ClassInvCovariance_Define(classType* ClassListType, void** ClassList);
00174   void ClassInvCovariance_Print();
00175   void ClassInvCovariance_Delete();
00176 
00177   void DefineRegistrationParametersForThreadedCostFunction(int ROI_MinX, int ROI_MinY, int ROI_MinZ, int ROI_MaxX, int ROI_MaxY, int ROI_MaxZ) const ;
00178 
00179   // -----------------------------
00180   // Registration Specifc Parameters
00181 
00182   // Global Subject (image) corrdinate system to Atlas Coordinate system
00183   // Rember the parameters just describe it the other way around 
00184 
00185   void SetGlobalToAtlasRotationMatrix(float* init)    {this->GlobalToAtlasRotationMatrix = init;}
00186   void SetGlobalToAtlasTranslationVector(float* init) {this->GlobalToAtlasTranslationVector = init;}
00187 
00188   void SetSuperClassToAtlasRotationMatrix(float *init) {this->SuperClassToAtlasRotationMatrix = init;}
00189   void SetSuperClassToAtlasTranslationVector(float *init) {this->SuperClassToAtlasTranslationVector = init;}
00190 
00191   void SetIndependentSubClassFlag(int* init) {this->IndependentSubClassFlag = init;}
00192   void SetClassSpecificRegistrationFlag(int*init) {this->ClassSpecificRegistrationFlag = init;}
00193 
00194   int  GetRegistrationType() {return RegistrationType;} 
00195   void SetRegistrationType(int init) {this->RegistrationType = init;} 
00196 
00197   void SetInterpolationType(int init) {this->InterpolationType = init;}
00198   void SetGenerateBackgroundProbability(int init) { this->GenerateBackgroundProbability = init;}
00199   void SetNumberOfTrainingSamples(int vtkNotUsed(init))
00200     {this->NumberOfTrainingSamples = NumberOfTrainingSamples;}
00201 
00202   void SetBoundary_NumberOfROIVoxels(int init) {this->Boundary_NumberOfROIVoxels = init;}
00203 
00204   // For debugging purposes 
00205   void DebugOn(){this->Debug = 1;}   
00206   void DebugOff(){this->Debug = 0;}   
00207 
00208   // -----------------------------
00209   // Class Specifc Parmeters
00210   void SetEMHierarchyParameters(EMLocal_Hierarchical_Class_Parameters init) {this->EMHierarchyParameters.Copy(init);}  
00211   void Setweights(float** init)            {this->weights = init;}
00212   void SetBoundary_ROIVector(unsigned char * init) {this->Boundary_ROIVector = init;}
00213 
00214   void MultiThreadDelete();
00215   void MultiThreadDefine(int DisableFlag); 
00216 
00217   // -----------------------------
00218   // Do you want to Keep the result for each voxel 
00219   void    SpatialCostFunctionOn(); 
00220   double* GetSpatialCostFunction() {return this->SpatialCostFunction;} 
00221   void    SpatialCostFunctionOff(); 
00222 
00223   // Default functions
00224   EMLocalRegistrationCostFunction() {this->InitializeParameters();}
00225   ~EMLocalRegistrationCostFunction();
00226 
00227   // =====================
00228   int GetNumberOfThreads() { return this->NumberOfThreads;} 
00229   EMLocalRegistrationCostFunction_MultiThreadedParameters* GetMultiThreadedParameters() {return MultiThreadedParameters;}
00230 
00231   int    GetProbDataType() { return this->EMHierarchyParameters.ProbDataType;}
00232   void   SetProbDataPtr(void** init)  {this->ProbDataPtr = init;}
00233   void** GetProbDataPtr()            {return this->ProbDataPtr;}
00234   void*  GetProbDataPtr(int index) {return this->ProbDataPtr[index];}
00235 
00236   int GetDebug() {return this->Debug;}
00237  
00238   unsigned char* GetBoundary_ROIVector() {return this->Boundary_ROIVector;}
00239   int GetBoundary_NumberOfROIVoxels() {return this->Boundary_NumberOfROIVoxels;}
00240  
00241   int    GetNumClasses() const    {return this->EMHierarchyParameters.NumClasses; } 
00242   int*   GetNumChildClasses()     {return this->EMHierarchyParameters.NumChildClasses; } 
00243   int    GetNumTotalTypeCLASS()   {return this->EMHierarchyParameters.NumTotalTypeCLASS;}
00244   int*   GetProbDataIncY()        {return this->EMHierarchyParameters.ProbDataIncY;}
00245   int*   GetProbDataIncZ()        {return this->EMHierarchyParameters.ProbDataIncZ;}
00246   float* GetProbDataMinusWeight() {return this->EMHierarchyParameters.ProbDataMinusWeight;}
00247   float* GetProbDataWeight ()     {return this->EMHierarchyParameters.ProbDataWeight;}
00248 
00249   EMLocalRegistrationCostFunction_ROI* GetROI_Weight() {return this->ROI_Weight;}
00250   EMLocalRegistrationCostFunction_ROI* GetROI_ProbData() {return this->ROI_ProbData;}
00251 
00252   int GetGenerateBackgroundProbability() {return this->GenerateBackgroundProbability;}
00253   int* GetClassSpecificRegistrationFlag() {return this->ClassSpecificRegistrationFlag;}
00254 
00255   vtkMultiThreader* GetThreader() { return this->Threader;}
00256 
00257   double **GetClassInvCovariance() {return this->ClassInvCovariance;}
00258 
00259   double GetMinCost() const {return this->ParaDepVar->MinWeightAtlasCost + this->ParaDepVar->MinGaussianCost;} 
00260   double GetMinWeightAtlasCost() {return this->ParaDepVar->MinWeightAtlasCost;} 
00261   double GetMinGaussianCost() {return this->ParaDepVar->MinGaussianCost;} 
00262 
00263   void ResetMinWeightAtlasCost() {this->ParaDepVar->MinWeightAtlasCost = EMLOCALREGISTRATION_MAX_PENALITY; }
00264   void ResetMinCost() {this->ResetMinWeightAtlasCost();this->ParaDepVar->MinGaussianCost =0;}  
00265 
00266   float** Getweights() { return this->weights; }
00267 
00268   int* GetIndependentSubClassFlag() {return this->IndependentSubClassFlag;}
00269   int GetNumberOfTrainingSamples() {return this->NumberOfTrainingSamples;}
00270 
00271   int  GetInterpolationType() {return this->InterpolationType;}
00272 
00273 private:
00274   // Utility Functions
00275   void ScaleRotationValues(double *FinalParameters);
00276 
00277   void **ProbDataPtr;
00278 
00279   // -----------------------------
00280   // Image Specific Region - defined by Extent (For ProbData)
00281   int     Image_Length[3]; 
00282 
00283   // MidX = targetmidcol in simon code
00284   // MidY = targetmidRow in simon code
00285   // MidZ = targetmidSlice in simon code
00286   float   Image_MidX; 
00287   float   Image_MidY;
00288   float   Image_MidZ;
00289 
00290   // --------------------------------------------------------
00291   // Segmentation Specific Region - defined by SegmentationBoundary* (such as w_m)  
00292   int     Boundary_Min[3];
00293   int     Boundary_Max[3];
00294   
00295   int     Boundary_LengthX;
00296   int     Boundary_LengthY;
00297   int     Boundary_LengthXYZ;
00298 
00299   // Dimension of Boundary_ROIVector is defined by Image_Length -> Defines at each voxel if is it part of the segmentation environment or not 
00300   unsigned char *Boundary_ROIVector;
00301   // Number of Voxels in Boundary_ROIVector that belong to the Region of Interest in the Segmentation Environment
00302   int    Boundary_NumberOfROIVoxels;
00303 
00304   // Each voxel is characterized by the following values 
00305   //  >-1 = one class is only present => can ignore it for registration if Weight and ProbData agree
00306   //  -1  = None of the classes have values greater zero
00307   //  -2  = Multiple classes have values greater zero 
00308   // Makes the algorithm a little bit faster 
00309   EMLocalRegistrationCostFunction_ROI* ROI_Weight;
00310   EMLocalRegistrationCostFunction_ROI* ROI_ProbData;
00311 
00312 
00313   // -----------------------------------------------------
00314   // Parameter Dimensions 
00315 
00316   // How many sets of Registration Parameters do we have to maximize
00317   int    NumberOfParameterSets;
00318   // How many parameters per set 
00319   // => Total Number of parameters to be optimized = NumberOfParameterSets * NumberOfParameterPerSet 
00320   int    NumberOfParameterPerSet; 
00321   // The value of NumberOfParameterPerSet is defined by (TwoDFlag, RigidFlag)
00322   // (1,1) = 3, (1,0) = 5, (0,1) = 6, (1,1) = 9 
00323   int    TwoDFlag;
00324   int    RigidFlag;
00325 
00326   // Global Subject (image) corrdinate system to Atlas Coordinate system
00327   // Rember the parameters just describe it the other way around 
00328 
00329   //Define affine mapping between two spaces 
00330   float  *GlobalToAtlasRotationMatrix;
00331   float  *GlobalToAtlasTranslationVector;
00332 
00333   float  *SuperClassToAtlasRotationMatrix;
00334   float  *SuperClassToAtlasTranslationVector;
00335 
00336   // This is necessary so that we can itegrate our method into itk
00337   EMLocalRegistrationCostFunction_IterationSpecificVariables *ParaDepVar;
00338 
00339   // -----------------------------
00340   // Registration Specifc Parameters
00341 
00342   // Is registration performed for each subclass individually or together
00343   int   *IndependentSubClassFlag;
00344 
00345   // A class is defined by its own set of registration parameters if ClassSpecificRegistrationFlag is set
00346   int   *ClassSpecificRegistrationFlag;
00347 
00348   // RegistrationType can be of the form:
00349   // EMSEGMENT_REGISTRATION_GLOBAL_ONLY, EMSEGMENT_REGISTRATION_CLASS_ONLY, EMSEGMENT_REGISTRATION_SIMULTANEOUS
00350   int    RegistrationType;
00351 
00352   // InterpolationType can be of the form:
00353   // EMSEGMENT_REGISTRATION_INTERPOLATION_NEIGHBOUR, EMSEGMENT_REGISTRATION_INTERPOLATION_LINEAR
00354   int    InterpolationType; 
00355 
00356   int    GenerateBackgroundProbability;
00357   
00358   // For debugging purposes 
00359   int    Debug;  
00360 
00361   // -----------------------------
00362   // Captures the cost at each voxel 
00363   double *SpatialCostFunction;
00364 
00365   // Global Cost Values defined by the transformation (capturered by parameters) minimizing it  
00366   // MinCost = MinWeightAtlasCost + MinGaussianCost
00367   //double MinCost;
00368   // MinWeightAtlasCost =sum_x SpatialCostFunction(x)
00369   //double MinWeightAtlasCost;
00370   // MinGaussianCost = G(parameters,ClassInvCovariance)
00371   //double MinGaussianCost;
00372   double **ClassInvCovariance;
00373 
00374   // -----------------------------
00375   // Thread Specifc Parameters 
00376   int NumberOfThreads;
00377   EMLocalRegistrationCostFunction_MultiThreadedParameters* MultiThreadedParameters;
00378   vtkMultiThreader *Threader;
00379 
00380   // -----------------------------
00381   // Input to Optimization Function - Defined by Segmentation Environment
00382   EMLocal_Hierarchical_Class_Parameters EMHierarchyParameters;
00383   float** weights;
00384   int     NumberOfTrainingSamples;
00385 };
00386 
00387 template <class T> 
00388 inline void EMLocalRegistrationCostFunction_DefineROI_ProbDataValues(EMLocalRegistrationCostFunction* self, T** ProbDataPtr) {
00389   // You have to first create the MAP // => it has to be defined 
00390   assert(((T**) self->GetProbDataPtr()) ==  ProbDataPtr);
00391 
00392   int *Image_Length = self->GetImage_Length();
00393 
00394   EMLocalRegistrationCostFunction_ROI* ROI_ProbData = self->GetROI_ProbData();
00395   assert(ROI_ProbData);
00396   if (!ROI_ProbData->MAP)  ROI_ProbData->CreateMAP(self->GetImage_Length()[0]*self->GetImage_Length()[1]*self->GetImage_Length()[2]);
00397 
00398   ROI_ProbData->MinCoord[0] = Image_Length[0];
00399   ROI_ProbData->MinCoord[1] = Image_Length[1];
00400   ROI_ProbData->MinCoord[2] = Image_Length[2];
00401   ROI_ProbData->MaxCoord[0] = ROI_ProbData->MaxCoord[1] = ROI_ProbData->MaxCoord[2] = 0;
00402   ROI_ProbData->ClassOutside = -1;
00403 
00404 
00405   char ProbDataFlagX;
00406   int  ProbDataFlagY;
00407   int  ProbDataFlagZ = 0;
00408 
00409   int  NumTotalTypeCLASS  = self->GetNumTotalTypeCLASS();
00410   int  NumClasses         = self->GetNumClasses();
00411   int* NumChildClasses    = self->GetNumChildClasses();
00412 
00413   int  ClassStart = self->GetGenerateBackgroundProbability(); 
00414   T** ProbDataPtrCopy = new T*[NumTotalTypeCLASS];
00415   char *MAP = ROI_ProbData->MAP;
00416 
00417   int* ProbDataIncY = self->GetProbDataIncY();
00418   int* ProbDataIncZ = self->GetProbDataIncZ();
00419 
00420   int index = 0;
00421   ProbDataPtrCopy[0] = ProbDataPtr[0];
00422   for (int i = ClassStart; i  < NumClasses; i++) {
00423     ProbDataFlagX = 0;
00424     for (int k = 0; k < NumChildClasses[i]; k++) {
00425       ProbDataPtrCopy[index] = ProbDataPtr[index];
00426       if (!ProbDataPtrCopy[index] || *ProbDataPtrCopy[index] > 0.0) ProbDataFlagX = 1;
00427       index ++;
00428     }
00429     if (ProbDataFlagX) {
00430       if (ROI_ProbData->ClassOutside > -1) {
00431         ROI_ProbData->ClassOutside = -3;
00432     break;
00433       }
00434       else ROI_ProbData->ClassOutside = i;
00435     }
00436   }
00437   //  std::cerr << "Here " << endl;
00438   for (int z = 0; z < Image_Length[2] ; z++) {
00439     // std::cerr << z << endl;
00440     ProbDataFlagZ = 0;
00441     for (int y = 0; y <  Image_Length[1] ; y++) {
00442       ProbDataFlagY = 0;
00443       // std::cerr << y << endl;
00444       for (int x = 0; x < Image_Length[0]; x++) {
00445     index = (self->GetGenerateBackgroundProbability() ? NumChildClasses[0] : 0);
00446         *MAP = -1;
00447     for (int i = ClassStart; i  < NumClasses; i++) {
00448       ProbDataFlagX = 0;
00449       for (int k = 0; k < NumChildClasses[i]; k++) {
00450         if (!ProbDataPtrCopy[index] || *ProbDataPtrCopy[index] > 0.0) ProbDataFlagX = 1;
00451         index ++;
00452       }
00453       if (ProbDataFlagX) {
00454         if (*MAP > -1) {
00455           *MAP = -1;
00456           break;
00457         } else  *MAP = i;   
00458       }
00459     }
00460     if (*MAP != ROI_ProbData->ClassOutside) {
00461       ProbDataFlagY = 1;
00462       ProbDataFlagZ = 1;
00463       if (ROI_ProbData->MinCoord[0] > x)  {
00464         ROI_ProbData->MinCoord[0] = x;
00465       }
00466       if (ROI_ProbData->MaxCoord[0] < x) {
00467         ROI_ProbData->MaxCoord[0] = x;
00468       }
00469     }
00470     MAP++;
00471     for (int j=0; j < NumTotalTypeCLASS; j++) { if (ProbDataPtrCopy[j]) ProbDataPtrCopy[j] ++; }
00472       }
00473       if (ProbDataFlagY) {
00474     if (ROI_ProbData->MinCoord[1] > y)  ROI_ProbData->MinCoord[1] = y;
00475     if (ROI_ProbData->MaxCoord[1] < y)  ROI_ProbData->MaxCoord[1] = y;
00476       }
00477       for (int j=0; j < NumTotalTypeCLASS; j++) { if (ProbDataPtrCopy[j]) ProbDataPtrCopy[j] += ProbDataIncY[j]; }
00478     }
00479     if (ProbDataFlagZ) {
00480       if (ROI_ProbData->MinCoord[2] > z)  ROI_ProbData->MinCoord[2] = z;
00481       ROI_ProbData->MaxCoord[2] = z;
00482     }
00483     for (int j=0; j < NumTotalTypeCLASS; j++) { if (ProbDataPtrCopy[j]) ProbDataPtrCopy[j] += ProbDataIncZ[j]; }
00484   }
00485   // Should not be necessary
00486   // for (int i = 0; i  < NumTotalTypeCLASS; i++)  ProbDataPtrCopy[i] = ProbDataPtr[i];
00487 
00488   delete[]  ProbDataPtrCopy;
00489 }
00490 
00491 
00492 // ===========================================================
00493 //
00494 //
00495 
00496 
00497 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1