#include <ContourPropagation.h>
Public Member Functions | |
ContourPropagation () | |
~ContourPropagation () | |
void | resetAppend () |
void | appendContour (std::vector< double > *InX, std::vector< double > *InY, std::vector< double > *InZ) |
void | GetContour (int id, std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ) |
void | GetInitialControlPoints (int id, std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ) |
void | GetControlPoints (int id, std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ) |
void | CalculeSplinePropagation () |
void | GetControlPoints (int id, double samp, std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ) |
int | FindIdWithZ (double z) |
void | getMaxMinZ (double *minz, double *maxz) |
void | setInterpolationNumber (int num) |
void | appendContour () |
vtkImageData * | GetKeyContours (std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ, std::vector< int > *vecS) |
bool | ifSliceKeyContourExist (int slice) |
Private Member Functions | |
bool | mustOrderAppend () |
void | orderAppend () |
void | OrdenarSliceKeyContourVec () |
Private Attributes | |
PropContour * | _propc |
AutoControlPoints * | _autoc |
ExtractControlPoints2D * | _ext2D |
std::vector< double > | _InX |
std::vector< double > | _InY |
std::vector< double > | _InZ |
std::vector< int > | _InS |
std::vector< int > | _sliceKeyContourVec |
std::vector< Vector > | _planevector |
Definition at line 10 of file ContourPropagation.h.
ContourPropagation::ContourPropagation | ( | ) |
Definition at line 4 of file ContourPropagation.cxx.
References _autoc, _ext2D, _InX, _InY, _InZ, _propc, and _sliceKeyContourVec.
00005 { 00006 _propc = new PropContour(); 00007 _autoc = new AutoControlPoints(); 00008 _ext2D = new ExtractControlPoints2D(); 00009 _InX.clear(); 00010 _InY.clear(); 00011 _InZ.clear(); 00012 _sliceKeyContourVec.clear(); 00013 }
ContourPropagation::~ContourPropagation | ( | ) |
Definition at line 15 of file ContourPropagation.cxx.
void ContourPropagation::appendContour | ( | ) |
Definition at line 97 of file ContourPropagation.cxx.
References _InS, _InX, _InY, _InZ, _propc, PropContour::GetKeyContours(), PropContour::ReadKeyContour(), and PropContour::ResetKeyContours().
00098 { 00099 _InX.clear(); 00100 _InY.clear(); 00101 _InZ.clear(); 00102 _InS.clear(); 00103 _propc->ResetKeyContours(); 00104 FILE* fd; 00105 fd = fopen("C:/bbtk_JS/data/SavedContours.txt","r"); 00106 _propc->ReadKeyContour( fd ); 00107 fclose(fd); 00108 _propc->GetKeyContours(&_InX,&_InY,&_InZ,&_InS); 00109 }
void ContourPropagation::appendContour | ( | std::vector< double > * | InX, | |
std::vector< double > * | InY, | |||
std::vector< double > * | InZ | |||
) |
Definition at line 68 of file ContourPropagation.cxx.
References _InS, _InX, _InY, _InZ, _propc, _sliceKeyContourVec, OrdenarSliceKeyContourVec(), and PropContour::SetKeyContours().
Referenced by wxMaracasCoutourTool::OnSaveContour().
00069 { 00070 /* 00071 vectorFunctions *vf = new vectorFunctions(); 00072 vf->copyVector(InX,&_InX); 00073 vf->copyVector(InY,&_InY); 00074 vf->copyVector(InZ,&_InZ); 00075 delete vf; 00076 */ 00077 00078 00079 int i,size = InX->size(); 00080 if(size != 0) 00081 { 00082 _sliceKeyContourVec.push_back( (*InZ)[0] ); 00083 OrdenarSliceKeyContourVec(); 00084 for(i=0; i<size; i++) 00085 { 00086 _InX.push_back( (*InX)[i] ); 00087 _InY.push_back( (*InY)[i] ); 00088 _InZ.push_back( (*InZ)[i] ); 00089 } 00090 } 00091 00092 _InS.push_back(InX->size()); 00093 _propc->SetKeyContours(InX,InY,InZ); 00094 }
void ContourPropagation::CalculeSplinePropagation | ( | ) |
Definition at line 233 of file ContourPropagation.cxx.
References _InS, _InX, _InY, _InZ, _propc, PropContour::CalculeSplinePropagation(), and PropContour::GetKeyContours().
00234 { 00235 //_propc->SetKeyContours(&_InX,&_InY,&_InZ); 00236 _propc->GetKeyContours(&_InX,&_InY,&_InZ,&_InS); 00237 _propc->CalculeSplinePropagation(); 00238 }
int ContourPropagation::FindIdWithZ | ( | double | z | ) |
Definition at line 241 of file ContourPropagation.cxx.
References _propc, and PropContour::FindIdWithZ().
00242 { 00243 return _propc->FindIdWithZ(z); 00244 }
void ContourPropagation::GetContour | ( | int | id, | |
std::vector< double > * | vecX, | |||
std::vector< double > * | vecY, | |||
std::vector< double > * | vecZ | |||
) |
Definition at line 283 of file ContourPropagation.cxx.
References _InX, _InY, _InZ, _propc, PropContour::CalculeSplinePropagation(), PropContour::GetIdContour(), and PropContour::SetKeyContours().
00284 { 00285 //orderAppend(); 00286 _propc->SetKeyContours(&_InX,&_InY,&_InZ); 00287 _propc->CalculeSplinePropagation(); 00288 _propc->GetIdContour(id,vecX,vecY,vecZ); 00289 }
void ContourPropagation::GetControlPoints | ( | int | id, | |
double | samp, | |||
std::vector< double > * | vecX, | |||
std::vector< double > * | vecY, | |||
std::vector< double > * | vecZ | |||
) |
Definition at line 270 of file ContourPropagation.cxx.
References _ext2D, _propc, PropContour::GetIdContour(), ExtractControlPoints2D::GetSamplingControlPoints(), ExtractControlPoints2D::SetContour(), and ExtractControlPoints2D::SetSamplingControlPoints().
00271 { 00272 // //_propc->SetKeyContours(&_InX,&_InY,&_InZ); 00273 // _propc->GetKeyContours(&_InX,&_InY,&_InZ,&_InS); 00274 // _propc->CalculeSplinePropagation(); 00275 // int size = _InX.size(); 00276 _propc->GetIdContour(id,vecX,vecY,vecZ); 00277 // int size2 = vecX->size(); 00278 _ext2D->SetContour(vecX,vecY,vecZ); 00279 _ext2D->SetSamplingControlPoints(samp); 00280 _ext2D->GetSamplingControlPoints(vecX,vecY,vecZ); 00281 }
void ContourPropagation::GetControlPoints | ( | int | id, | |
std::vector< double > * | vecX, | |||
std::vector< double > * | vecY, | |||
std::vector< double > * | vecZ | |||
) |
Definition at line 259 of file ContourPropagation.cxx.
References _ext2D, _propc, ExtractControlPoints2D::GetControlPoints(), PropContour::GetIdContour(), and ExtractControlPoints2D::SetContour().
00260 { 00261 //_propc->SetKeyContours(&_InX,&_InY,&_InZ); 00262 // _propc->CalculeSplinePropagation(); 00263 _propc->GetIdContour(id,vecX,vecY,vecZ); 00264 _ext2D->SetContour(vecX,vecY,vecZ); 00265 _ext2D->GetControlPoints(vecX,vecY,vecZ); 00266 }
void ContourPropagation::GetInitialControlPoints | ( | int | id, | |
std::vector< double > * | vecX, | |||
std::vector< double > * | vecY, | |||
std::vector< double > * | vecZ | |||
) |
Definition at line 250 of file ContourPropagation.cxx.
References _ext2D, _propc, PropContour::GetIdContour(), ExtractControlPoints2D::GetInitialControlPoints(), and ExtractControlPoints2D::SetContour().
00251 { 00252 _propc->GetIdContour(id,vecX,vecY,vecZ); 00253 _ext2D->SetContour(vecX,vecY,vecZ); 00254 _ext2D->GetInitialControlPoints(vecX,vecY,vecZ); 00255 }
vtkImageData * ContourPropagation::GetKeyContours | ( | std::vector< double > * | vecX, | |
std::vector< double > * | vecY, | |||
std::vector< double > * | vecZ, | |||
std::vector< int > * | vecS | |||
) |
Definition at line 292 of file ContourPropagation.cxx.
References _propc, PropContour::CalculeSplinePropagation(), and PropContour::GetKeyContours().
00293 { 00294 //orderAppend(); 00295 _propc->GetKeyContours(vecX,vecY,vecZ,vecS); 00296 return _propc->CalculeSplinePropagation(); 00297 }
void ContourPropagation::getMaxMinZ | ( | double * | minz, | |
double * | maxz | |||
) |
Definition at line 299 of file ContourPropagation.cxx.
References _InZ, vectorFunctions::maxVector(), and vectorFunctions::minVector().
00300 { 00301 vectorFunctions *vf = new vectorFunctions(); 00302 vf->minVector(&_InZ,minz); 00303 vf->maxVector(&_InZ,maxz); 00304 delete vf; 00305 }
bool ContourPropagation::ifSliceKeyContourExist | ( | int | slice | ) |
Definition at line 30 of file ContourPropagation.cxx.
References _sliceKeyContourVec.
00031 { 00032 bool result=false; 00033 int i,size=_sliceKeyContourVec.size(); 00034 for (i=0; ((i<size) && (result==false)); i++) 00035 { 00036 //int temp=_sliceKeyContourVec[i]; // JPRx 00037 if (_sliceKeyContourVec[i]==slice) 00038 { 00039 result=true; 00040 } 00041 if (_sliceKeyContourVec[i]>slice) 00042 { 00043 i=size; 00044 } 00045 } 00046 return result; 00047 }
bool ContourPropagation::mustOrderAppend | ( | ) | [private] |
Definition at line 111 of file ContourPropagation.cxx.
Referenced by orderAppend().
00112 { 00113 bool orderA = true; 00114 bool orderD = true; 00115 bool mustOrder = false; 00116 int i,j; 00117 00118 if(_InS.size()>2) 00119 { 00120 //ASCENDING 00121 j=0; 00122 for(i=0; i<(int)(_InS.size())-1; i++) 00123 { 00124 if(_InZ[j]>_InZ[j+_InS[i]]) 00125 { 00126 orderA = false; 00127 } 00128 j = j+_InS[i]; 00129 } 00130 //DESCENDING 00131 if(orderA == false) 00132 { 00133 j=0; 00134 for(i=0; i<(int)(_InS.size())-1; i++) 00135 { 00136 if(_InZ[j]<_InZ[j+_InS[i]]) 00137 { 00138 orderD = false; 00139 } 00140 j = j+_InS[i]; 00141 } 00142 } 00143 //IS ORGANIZED 00144 if((orderD == false) || (orderA == false)) 00145 { 00146 mustOrder = true; 00147 } 00148 else 00149 { 00150 mustOrder = false; 00151 } 00152 return mustOrder; 00153 } 00154 return mustOrder; 00155 }
void ContourPropagation::OrdenarSliceKeyContourVec | ( | ) | [private] |
Definition at line 50 of file ContourPropagation.cxx.
References _sliceKeyContourVec.
Referenced by appendContour().
00051 { 00052 int i,j,tmp,size=_sliceKeyContourVec.size(); 00053 for (i=0;i<size;i++) 00054 { 00055 for (j=0;j<size;j++) 00056 { 00057 if (_sliceKeyContourVec[i]<_sliceKeyContourVec[j]) 00058 { 00059 tmp=_sliceKeyContourVec[i]; 00060 _sliceKeyContourVec[i]=_sliceKeyContourVec[j]; 00061 _sliceKeyContourVec[j]=tmp; 00062 } 00063 } 00064 } 00065 }
void ContourPropagation::orderAppend | ( | ) | [private] |
Definition at line 157 of file ContourPropagation.cxx.
References _InS, _InX, _InY, _InZ, vectorFunctions::copyVector(), and mustOrderAppend().
00158 { 00159 int i,j,cont,cont2; 00160 std::vector<double> tempX; 00161 std::vector<double> tempY; 00162 std::vector<double> tempZ; 00163 std::vector<int> tempS; 00164 tempX.clear(); 00165 tempY.clear(); 00166 tempZ.clear(); 00167 tempS.clear(); 00168 00169 bool mustOrder = mustOrderAppend(); 00170 00171 while( mustOrder == true ) 00172 { 00173 tempX.clear(); 00174 tempY.clear(); 00175 tempZ.clear(); 00176 tempS.clear(); 00177 cont = 0; 00178 for(i=0; i<(int)(_InS.size())-1; i++) 00179 { 00180 if(_InZ[cont]<_InZ[cont+_InS[i]]) 00181 { 00182 cont2 = cont; 00183 for(j=0; j<_InS[i]; j++) 00184 { 00185 tempX.push_back( _InX[cont2] ); 00186 tempY.push_back( _InY[cont2] ); 00187 tempZ.push_back( _InZ[cont2] ); 00188 cont2++; 00189 } 00190 tempS.push_back( _InS[1] ); 00191 } 00192 if(_InZ[cont]>_InZ[cont+_InS[i]]) 00193 { 00194 cont2 = cont+_InS[i]; 00195 for(j=0; j<_InS[i+1]; j++) 00196 { 00197 tempX.push_back( _InX[cont2] ); 00198 tempY.push_back( _InY[cont2] ); 00199 tempZ.push_back( _InZ[cont2] ); 00200 cont2++; 00201 } 00202 tempS.push_back( _InS[i+1] ); 00203 cont2 = cont; 00204 for(j=0; j<_InS[i]; j++) 00205 { 00206 tempX.push_back( _InX[cont2] ); 00207 tempY.push_back( _InY[cont2] ); 00208 tempZ.push_back( _InZ[cont2] ); 00209 cont2++; 00210 } 00211 tempS.push_back( _InS[i] ); 00212 } 00213 cont = cont + _InS[i]; 00214 } 00215 _InX.clear(); 00216 _InY.clear(); 00217 _InZ.clear(); 00218 _InS.clear(); 00219 vectorFunctions *vf = new vectorFunctions(); 00220 vf->copyVector(&tempX,&_InX); 00221 vf->copyVector(&tempY,&_InY); 00222 vf->copyVector(&tempZ,&_InZ); 00223 delete vf; 00224 for(i=0; i<(int)(tempS.size()); i++) 00225 { 00226 _InS.push_back(tempS[i]); 00227 } 00228 mustOrder = mustOrderAppend(); 00229 } 00230 00231 }
void ContourPropagation::resetAppend | ( | ) |
Definition at line 19 of file ContourPropagation.cxx.
References _InS, _InX, _InY, _InZ, _propc, _sliceKeyContourVec, and PropContour::ResetKeyContours().
00020 { 00021 _InX.clear(); 00022 _InY.clear(); 00023 _InZ.clear(); 00024 _InS.clear(); 00025 _propc->ResetKeyContours(); 00026 _sliceKeyContourVec.clear(); 00027 }
void ContourPropagation::setInterpolationNumber | ( | int | num | ) |
Definition at line 307 of file ContourPropagation.cxx.
References _propc, and PropContour::SetInterpNumber().
00308 { 00309 _propc->SetInterpNumber(num); 00310 }
AutoControlPoints* ContourPropagation::_autoc [private] |
Definition at line 61 of file ContourPropagation.h.
Referenced by ContourPropagation().
ExtractControlPoints2D* ContourPropagation::_ext2D [private] |
Definition at line 62 of file ContourPropagation.h.
Referenced by ContourPropagation(), GetControlPoints(), and GetInitialControlPoints().
std::vector<int> ContourPropagation::_InS [private] |
Definition at line 67 of file ContourPropagation.h.
Referenced by appendContour(), CalculeSplinePropagation(), mustOrderAppend(), orderAppend(), and resetAppend().
std::vector<double> ContourPropagation::_InX [private] |
Definition at line 64 of file ContourPropagation.h.
Referenced by appendContour(), CalculeSplinePropagation(), ContourPropagation(), GetContour(), orderAppend(), and resetAppend().
std::vector<double> ContourPropagation::_InY [private] |
Definition at line 65 of file ContourPropagation.h.
Referenced by appendContour(), CalculeSplinePropagation(), ContourPropagation(), GetContour(), orderAppend(), and resetAppend().
std::vector<double> ContourPropagation::_InZ [private] |
Definition at line 66 of file ContourPropagation.h.
Referenced by appendContour(), CalculeSplinePropagation(), ContourPropagation(), GetContour(), getMaxMinZ(), mustOrderAppend(), orderAppend(), and resetAppend().
std::vector<Vector> ContourPropagation::_planevector [private] |
Definition at line 70 of file ContourPropagation.h.
PropContour* ContourPropagation::_propc [private] |
Definition at line 60 of file ContourPropagation.h.
Referenced by appendContour(), CalculeSplinePropagation(), ContourPropagation(), FindIdWithZ(), GetContour(), GetControlPoints(), GetInitialControlPoints(), GetKeyContours(), resetAppend(), and setInterpolationNumber().
std::vector<int> ContourPropagation::_sliceKeyContourVec [private] |
Definition at line 68 of file ContourPropagation.h.
Referenced by appendContour(), ContourPropagation(), ifSliceKeyContourExist(), OrdenarSliceKeyContourVec(), and resetAppend().