#include <wxEmptyPanelWidget_2.h>
Public Member Functions | |
virtual void | SetInput (marExperiment *input) |
void | SetBranchLevel (int branchLevel) |
marExperiment * | GetInput () |
vtkImageData * | GetVolume () |
void | Update () |
void | SetCleanTreeLevel (int cleanLevel) |
Static Public Member Functions | |
static TreeExtraction_MH_JFC * | New () |
Protected Member Functions | |
TreeExtraction_MH_JFC () | |
~TreeExtraction_MH_JFC () | |
void | Execute (int count, int sens=1, double *vit=NULL, int cleanLevel=0) |
Private Member Functions | |
void | Reset () |
void | InitImagaDataResult () |
void | BruleVolume (vtkImageData *imagedata, int x, int y, int z, int r, int value) |
void | BruleVolume (vtkImageData *imagedata, vtkPolyData *inputAxisRadio, int value) |
void | FindVit (marExperiment *newExperiment, int actualAxis, double *pointBif, double *vit) |
Private Attributes | |
double | _cleanLevel |
int | _branchLevel |
carotidaBifurcacion * | _prgov |
vtkImageData * | _imagedataResult |
marExperiment * | _marExperiment |
Definition at line 24 of file wxEmptyPanelWidget_2.h.
TreeExtraction_MH_JFC::TreeExtraction_MH_JFC | ( | ) | [protected] |
Definition at line 55 of file wxEmptyPanelWidget_2.cxx.
References _branchLevel, _cleanLevel, and _imagedataResult.
00055 { 00056 _branchLevel = 2; 00057 _imagedataResult = NULL; 00058 _cleanLevel = 400; 00059 }
TreeExtraction_MH_JFC::~TreeExtraction_MH_JFC | ( | ) | [protected] |
Definition at line 61 of file wxEmptyPanelWidget_2.cxx.
References Reset().
00061 { 00062 Reset(); 00063 }
void TreeExtraction_MH_JFC::BruleVolume | ( | vtkImageData * | imagedata, | |
vtkPolyData * | inputAxisRadio, | |||
int | value | |||
) | [private] |
Definition at line 113 of file wxEmptyPanelWidget_2.cxx.
References BruleVolume().
00114 { 00115 int x,y,z,r; 00116 double point[3],radio; 00117 double fractpart, intpart; 00118 int i,maxPoints=inputAxisRadio->GetPoints()->GetNumberOfPoints(); 00119 vtkDoubleArray *allRadios = (vtkDoubleArray*)(inputAxisRadio->GetPointData()->GetScalars("radio")); 00120 for (i=0; i<maxPoints; i++){ 00121 inputAxisRadio->GetPoints()->GetPoint(i,point); 00122 radio=allRadios->GetValue(i); 00123 x = (int)(point[0]); 00124 y = (int)(point[1]); 00125 z = (int)(point[2]); 00126 fractpart = modf (radio , &intpart); 00127 if (fractpart>=0.5){ 00128 intpart++; 00129 } 00130 r = (int)( intpart ); 00131 BruleVolume(imagedata,x,y,z,r,value); 00132 } 00133 }
void TreeExtraction_MH_JFC::BruleVolume | ( | vtkImageData * | imagedata, | |
int | x, | |||
int | y, | |||
int | z, | |||
int | r, | |||
int | value | |||
) | [private] |
Definition at line 76 of file wxEmptyPanelWidget_2.cxx.
Referenced by BruleVolume(), and Execute().
00077 { 00078 int ext[6]; 00079 int i, j, k, ii,jj,kk; 00080 imagedata->GetExtent(ext); 00081 unsigned short *ptr; 00082 int x1=x-r; 00083 int x2=x+r; 00084 int y1=y-r; 00085 int y2=y+r; 00086 int z1=z-r; 00087 int z2=z+r; 00088 double tmpsqrt; 00089 for(i=x1;i<=x2;i++){ 00090 for(j=y1;j<=y2;j++){ 00091 for(k=z1;k<=z2;k++){ 00092 ptr=(unsigned short *) imagedata->GetScalarPointer(i,j,k); 00093 ii=i-x; 00094 jj=j-y; 00095 kk=k-z; 00096 tmpsqrt=ii*ii + jj*jj + kk*kk; 00097 if ((ptr!=NULL) && ( sqrt(tmpsqrt)<=r)) 00098 { 00099 if (value==0){ 00100 *ptr=value; 00101 } else { 00102 if (*ptr==0) { 00103 *ptr=value; 00104 } 00105 } 00106 } 00107 } // for z 00108 } // for y 00109 } // fox x 00110 }
void TreeExtraction_MH_JFC::Execute | ( | int | count, | |
int | sens = 1 , |
|||
double * | vit = NULL , |
|||
int | cleanLevel = 0 | |||
) | [protected] |
Definition at line 173 of file wxEmptyPanelWidget_2.cxx.
References _cleanLevel, _imagedataResult, _marExperiment, _prgov, BruleVolume(), marExperiment::extractVascularTree(), FindVit(), marExperiment::getAxis(), marAxis::GetAxisData(), marExperiment::getDynData(), marExperiment::getNumberOfAxes(), marDynData::getVolume(), New(), carotidaBifurcacion::SetHumbral(), carotidaBifurcacion::SetInput(), carotidaBifurcacion::SetInput2(), carotidaBifurcacion::SetMaxPropMasa(), carotidaBifurcacion::SetMaxPropRadio(), carotidaBifurcacion::SetMinPropMasa(), and marExperiment::setStartPoint().
Referenced by Update().
00174 { 00175 //------------Arbre Extraction -------------- 00176 // Call Maracas axis extraction 00177 count--; 00178 /* 00179 time_t start,end; 00180 double dif; 00181 time (&start); 00182 */ 00183 int idActualAxis_Before = _marExperiment->getNumberOfAxes(); 00184 _marExperiment->extractVascularTree( sens , vit, cleanLevel ); 00185 /* 00186 time (&end); 00187 dif = difftime (end,start); 00188 FILE *ff; 00189 ff=fopen("c:/temp/MaracasTIME.txt","a+"); 00190 fprintf(ff,"\n TreeExtraction_MH_JFC::Execute %d \n",count); 00191 fprintf(ff,"evt %.2lf \n",dif); 00192 fclose(ff); 00193 */ 00194 int idActualAxis = _marExperiment->getNumberOfAxes(); 00195 // Bifurcation Detection JFC 00196 marAxis *maraxis = _marExperiment->getAxis( ); 00197 if ((maraxis!=NULL) && (idActualAxis_Before!=idActualAxis)) { 00198 vtkImageData *imagedata = _marExperiment->getDynData( )->getVolume( )->castVtk(); 00199 vtkPolyData *inputAxisRadio = maraxis->GetAxisData(); 00200 00201 if (count>0){ 00202 /* 00203 time (&start); 00204 */ 00205 _prgov = carotidaBifurcacion::New(); 00206 _prgov->SetMaxPropRadio(5); 00207 _prgov->SetHumbral(0.45); 00208 _prgov->SetMaxPropMasa(10); 00209 _prgov->SetMinPropMasa(0.01); 00210 _prgov->SetInput( inputAxisRadio ); 00211 _prgov->SetInput2( imagedata ); 00212 _prgov->Update(); 00213 /* 00214 time (&end); 00215 dif = difftime (end,start); 00216 ff=fopen("c:/temp/MaracasTIME.txt","a+"); 00217 fprintf(ff,"\tcB %.2lf \n",dif); 00218 fclose(ff); 00219 */ 00220 } 00221 00222 // Brule Volume 00223 BruleVolume(imagedata , inputAxisRadio , 0 ); 00224 BruleVolume(_imagedataResult , inputAxisRadio , idActualAxis ); 00225 inputAxisRadio->Delete(); 00226 00227 00228 if (count>0){ 00229 // LOOP for branch extraction 00230 vtkPolyData *bifurcations = _prgov->GetOutput(); 00231 int i,maxPoints = bifurcations->GetPoints()->GetNumberOfPoints(); 00232 int x,y,z; 00233 double point[3], vit[3]; 00234 for (i=0; i<maxPoints; i++){ 00235 bifurcations->GetPoints()->GetPoint(i,point); 00236 x = (int)(point[0]); 00237 y = (int)(point[1]); 00238 z = (int)(point[2]); 00239 FindVit( _marExperiment , idActualAxis , point , vit ); 00240 _marExperiment->setStartPoint( x , y , z ); 00241 //Branch extraction; 00242 Execute(count, 0 , vit , (int)_cleanLevel ); 00243 } 00244 bifurcations->Delete(); 00245 // _prgov->Delete(); 00246 // _prgov = NULL; 00247 } // of count>0 00248 00249 } // maraxi=NULL 00250 }
void TreeExtraction_MH_JFC::FindVit | ( | marExperiment * | newExperiment, | |
int | actualAxis, | |||
double * | pointBif, | |||
double * | vit | |||
) | [private] |
Definition at line 138 of file wxEmptyPanelWidget_2.cxx.
References marExperiment::getAxis(), marAxis::GetAxisData(), marExperiment::getNumberOfAxes(), min, and marExperiment::setAxis().
Referenced by Execute().
00139 { 00140 double dist,min=-1; 00141 double point[3]; 00142 double dx,dy,dz; 00143 int jPoint,maxPoints; 00144 int iAxis,maxAxis; 00145 00146 maxAxis=newExperiment->getNumberOfAxes(); 00147 for (iAxis=0;iAxis<maxAxis;iAxis++){ 00148 if (iAxis!=actualAxis){ 00149 newExperiment->setAxis(iAxis); 00150 marAxis *maraxis = newExperiment->getAxis( ); 00151 if (maraxis!=NULL) { 00152 vtkPolyData *axisVtk = maraxis->GetAxisData(); 00153 maxPoints=axisVtk->GetPoints()->GetNumberOfPoints(); 00154 for (jPoint=0; jPoint<maxPoints; jPoint++){ 00155 axisVtk->GetPoints()->GetPoint(jPoint,point); 00156 dx = pointBif[0]-point[0]; 00157 dy = pointBif[1]-point[1]; 00158 dz = pointBif[2]-point[2]; 00159 dist = sqrt( dx*dx + dy*dy + dz*dz ); 00160 if ((min==-1) || (dist<min)) { 00161 min=dist; 00162 vit[0] = dx; 00163 vit[1] = dy; 00164 vit[2] = dz; 00165 } //if 00166 } // for 00167 } // if maraxis!=NULL 00168 } // i!=actualAxis 00169 } //for 00170 }
marExperiment * TreeExtraction_MH_JFC::GetInput | ( | ) |
Definition at line 291 of file wxEmptyPanelWidget_2.cxx.
References _marExperiment.
00291 { 00292 return _marExperiment; 00293 }
vtkImageData * TreeExtraction_MH_JFC::GetVolume | ( | ) |
Definition at line 295 of file wxEmptyPanelWidget_2.cxx.
References _imagedataResult.
Referenced by wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
00295 { 00296 return _imagedataResult; 00297 }
void TreeExtraction_MH_JFC::InitImagaDataResult | ( | ) | [private] |
Definition at line 253 of file wxEmptyPanelWidget_2.cxx.
References _imagedataResult, _marExperiment, marExperiment::getDynData(), marDynData::getVolume(), New(), and Reset().
Referenced by Update().
00253 { 00254 Reset(); 00255 vtkImageData *imagedata = _marExperiment->getDynData( )->getVolume( )->castVtk(); 00256 imagedata->Update(); 00257 _imagedataResult = vtkImageData::New(); 00258 int dim[3]; 00259 imagedata->GetDimensions(dim); 00260 _imagedataResult->SetScalarType(imagedata->GetScalarType()); 00261 00262 _imagedataResult->SetDimensions(dim[0],dim[1],dim[2]); 00263 _imagedataResult->SetExtent( 0 , dim[0]-1 , 0 , dim[1]-1 , 0 , dim[2]-1 ); 00264 _imagedataResult->SetWholeExtent(0 , dim[0]-1 , 0 , dim[1]-1 , 0 , dim[2]-1 ); 00265 _imagedataResult->SetSpacing( imagedata->GetSpacing() ); 00266 _imagedataResult->SetOrigin( 0,0,0 ); 00267 _imagedataResult->Update(); 00268 _imagedataResult->UpdateData(); 00269 unsigned short *ptr; 00270 int i,j,k; 00271 for ( i=0 ; i<dim[0] ; i++ ){ 00272 for ( j=0 ; j<dim[1] ; j++ ){ 00273 for ( k=0 ; k<dim[2] ; k++ ){ 00274 ptr = (unsigned short *) _imagedataResult->GetScalarPointer(i,j,k); 00275 *ptr = 0; 00276 } 00277 } 00278 } 00279 }
static TreeExtraction_MH_JFC* TreeExtraction_MH_JFC::New | ( | ) | [static] |
Referenced by Execute(), InitImagaDataResult(), and wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
void TreeExtraction_MH_JFC::Reset | ( | ) | [private] |
Definition at line 65 of file wxEmptyPanelWidget_2.cxx.
References _imagedataResult.
Referenced by InitImagaDataResult(), and ~TreeExtraction_MH_JFC().
00065 { 00066 if (_imagedataResult!=NULL){ 00067 _imagedataResult->Delete(); 00068 } 00069 }
void TreeExtraction_MH_JFC::SetBranchLevel | ( | int | branchLevel | ) |
Definition at line 299 of file wxEmptyPanelWidget_2.cxx.
References _branchLevel.
Referenced by wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
00299 { 00300 _branchLevel = branchLevel; 00301 }
void TreeExtraction_MH_JFC::SetCleanTreeLevel | ( | int | cleanLevel | ) |
Definition at line 303 of file wxEmptyPanelWidget_2.cxx.
References _cleanLevel.
Referenced by wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
00303 { 00304 _cleanLevel = (double)cleanLevel; 00305 }
void TreeExtraction_MH_JFC::SetInput | ( | marExperiment * | input | ) | [virtual] |
Definition at line 71 of file wxEmptyPanelWidget_2.cxx.
References _marExperiment.
Referenced by wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
00071 { 00072 _marExperiment = input; 00073 }
void TreeExtraction_MH_JFC::Update | ( | ) |
Definition at line 281 of file wxEmptyPanelWidget_2.cxx.
References _branchLevel, Execute(), and InitImagaDataResult().
Referenced by wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC().
00281 { 00282 /* 00283 FILE *ff; 00284 ff=fopen("c:/temp/MaracasTIME.txt","w"); 00285 fclose(ff); 00286 */ 00287 InitImagaDataResult(); 00288 Execute(_branchLevel); 00289 }
int TreeExtraction_MH_JFC::_branchLevel [private] |
Definition at line 42 of file wxEmptyPanelWidget_2.h.
Referenced by SetBranchLevel(), TreeExtraction_MH_JFC(), and Update().
double TreeExtraction_MH_JFC::_cleanLevel [private] |
Definition at line 41 of file wxEmptyPanelWidget_2.h.
Referenced by Execute(), SetCleanTreeLevel(), and TreeExtraction_MH_JFC().
vtkImageData* TreeExtraction_MH_JFC::_imagedataResult [private] |
Definition at line 44 of file wxEmptyPanelWidget_2.h.
Referenced by Execute(), GetVolume(), InitImagaDataResult(), Reset(), and TreeExtraction_MH_JFC().
Definition at line 45 of file wxEmptyPanelWidget_2.h.
Referenced by Execute(), GetInput(), InitImagaDataResult(), and SetInput().
carotidaBifurcacion* TreeExtraction_MH_JFC::_prgov [private] |
Definition at line 43 of file wxEmptyPanelWidget_2.h.
Referenced by Execute().