#include <ContourCrownWidget.h>
Public Member Functions | |
wxMaracasCoutourTool (wxWindow *parent, wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata) | |
~wxMaracasCoutourTool () | |
void | OnContourA (wxCommandEvent &event) |
void | OnContourB (wxCommandEvent &event) |
void | OnContourAB (wxCommandEvent &event) |
void | ConfigureVTK () |
void | GetValuesInsideCrown (std::vector< double > *pLstValue, std::vector< double > *pLstValuePosX, std::vector< double > *pLstValuePosY, std::vector< double > *pLstValuePosZ) |
wxVtkBaseView * | GetWxVtkBaseView () |
vtkImageData * | GetVtkImageValueResult () |
vtkImageData * | GetVtkImageMaskResult () |
void | GetSplinePoints (std::vector< double > *pLstContourX, std::vector< double > *pLstContourY, std::vector< double > *pLstContourZ) |
void | SetControlPoints (std::vector< double > *InVectorX, std::vector< double > *InVectorY, std::vector< double > *InVectorZ) |
void | OnSaveContour (wxCommandEvent &event) |
void | OnSaveControlPoints (wxCommandEvent &event) |
void | EreaseLastContour (wxCommandEvent &event) |
void | EreaseLastCP (wxCommandEvent &event) |
Private Member Functions | |
bool | isInside (int x, int y) |
void | GetMinMaxPoint (int *minPoint, int *maxPoint) |
void | GetMinMaxPoint (int *minPoint, int *maxPoint, manualViewBaseContour *manualviewbaseecontour, manualContourModel *manualcontourmodel) |
int | AnalisisContourInside (int x, int y, manualViewBaseContour *manualviewbaseecontour, manualContourModel *manualcontourmodel) |
double | GetDataValue (int x, int y) |
void | ResetImageResult () |
void | PutVtkImageDataResultValue (int x, int y, double value) |
void | InitVtkImagesResult () |
Private Attributes | |
mBarRange * | mbarrange |
vtkImageData * | imagedata |
vtkImageData * | imagedataValueResult |
vtkImageData * | imagedataMaskResult |
wxVtkBaseView * | wxvtkbaseview |
std::vector< double > | _tempCX |
std::vector< double > | _tempCY |
std::vector< int > | _tempCZ |
std::vector< int > | _SizesC |
std::vector< double > | _tempCPX |
std::vector< double > | _tempCPY |
std::vector< int > | _tempCPZ |
std::vector< int > | _SizesCP |
std::vector< double > * | pControlVectorX |
std::vector< double > * | pControlVectorY |
std::vector< double > * | pControlVectorZ |
int | _zz |
manualPoint * | _mpoint |
ContourPropagation * | _contprop |
manualContourControler * | _manContourControl_1 |
manualContourModel * | _mContourModel_1 |
manualViewContour * | _mViewContour_1 |
manualContourControler * | _manContourControl_2 |
manualContourModel * | _mContourModel_2 |
manualViewContour * | _mViewContour_2 |
manualRoiControler * | _manRoiControl |
manualContourModel * | _mContourModel |
manualViewRoi * | _mViewRoi |
Definition at line 19 of file ContourCrownWidget.h.
wxMaracasCoutourTool::wxMaracasCoutourTool | ( | wxWindow * | parent, | |
wxVtkBaseView * | wxvtkbaseview, | |||
vtkImageData * | imagedata | |||
) |
Definition at line 11 of file ContourCrownWidget.cxx.
References EreaseLastContour(), EreaseLastCP(), wxVtkBaseView::GetRenderer(), imagedataMaskResult, InitVtkImagesResult(), OnContourA(), OnContourAB(), OnContourB(), OnSaveContour(), and OnSaveControlPoints().
00012 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) 00013 { 00014 //EED this->mbbtkContourCrown = contourcrown; 00015 this->imagedata = imagedata; 00016 this->wxvtkbaseview = wxvtkbaseview; 00017 wxPanel *panel = this; 00018 wxSizer *sizer = NULL; 00019 00020 InitVtkImagesResult(); 00021 00022 vtkLookupTable *table = vtkLookupTable::New(); 00023 // table->SetAlphaRange(128,255); 00024 table->SetRange(0, 255); // image intensity range 00025 // table->SetValueRange(0.0, 1.0); // from black to white 00026 table->SetValueRange(0.0, 255.0); // from black to white 00027 00028 table->SetTableValue (0, 1.0 , 1.0 , 1.0 , 0.1 ); 00029 table->SetTableValue (255, 1.0 , 1.0 , 0.0 , 0.1); 00030 00031 // table->SetTableValue (0, 0.0 , 0.0 , 1.0 , 0.35 ); 00032 // table->SetTableValue (255, 1.0 , 0.0 , 0.0 , 0.10); 00033 00034 table->SetSaturationRange(0.0, 0.0); // no color saturation 00035 table->SetRampToLinear(); 00036 table->Build(); 00037 00038 vtkImageMapToColors *mapperImage = vtkImageMapToColors::New(); 00039 mapperImage->SetLookupTable(table); 00040 mapperImage->SetInput( imagedataMaskResult ); 00041 vtkImageActor *actorImage = vtkImageActor::New(); 00042 actorImage->SetInput( mapperImage->GetOutput() ); 00043 actorImage->SetOpacity(1); 00044 00045 wxvtkbaseview->GetRenderer()->AddActor(actorImage); 00046 00047 // Widget interface 00048 wxButton *btnContourA = new wxButton( panel, -1, _T("Crown Extern")); 00049 wxButton *btnContourB = new wxButton( panel, -1, _T("Crown Intern")); 00050 wxButton *btnContourAB = new wxButton( panel, -1, _T("Crown Extern and Intern")); 00051 00052 //JSTG 21-03-08 -------------------------------------------------------------------- 00053 wxButton *btnSaveContour = new wxButton( panel, -1, _T("Save Contour")); 00054 wxButton *btnSaveControlPoints = new wxButton( panel, -1, _T("Save Control Points")); 00055 //JSTG 11-04-08 00056 wxButton *btnEreaseLastContour = new wxButton( panel, -1, _T("Erease Last Contour")); 00057 wxButton *btnEreaseLastCP = new wxButton( panel, -1, _T("Erease Last Control Points")); 00058 //---------------------------------------------------------------------------------- 00059 00060 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(10); //Original Value = 10 00061 sizer1->Add(new wxStaticText(panel,-1,_T(" "))); 00062 sizer1->Add(new wxStaticText(panel,-1,_T(" "))); 00063 00064 Connect(btnContourA->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::OnContourA ); 00065 Connect(btnContourB->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::OnContourB ); 00066 Connect(btnContourAB->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::OnContourAB ); 00067 00068 //JSTG 21-03-08 --------------------------------------------------------------------- 00069 Connect(btnSaveContour->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::OnSaveContour ); 00070 Connect(btnSaveControlPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::OnSaveControlPoints ); 00071 //JSTG 11-04-08 00072 Connect(btnEreaseLastContour->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::EreaseLastContour ); 00073 Connect(btnEreaseLastCP->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasCoutourTool::EreaseLastCP ); 00074 //----------------------------------------------------------------------------------- 00075 00076 sizer1->Add(btnContourA); 00077 sizer1->Add(btnContourB); 00078 sizer1->Add(btnContourAB); 00079 00080 //JSTG 21-03-08 -------------------- 00081 sizer1->Add(btnSaveContour); 00082 sizer1->Add(btnSaveControlPoints); 00083 //JSTG 11-04-08 00084 sizer1->Add(btnEreaseLastContour); 00085 sizer1->Add(btnEreaseLastCP); 00086 //---------------------------------- 00087 sizer = sizer1; 00088 panel -> SetSizer(sizer); 00089 panel -> SetAutoLayout(true); 00090 panel -> Layout(); 00091 00092 }
wxMaracasCoutourTool::~wxMaracasCoutourTool | ( | ) |
Definition at line 96 of file ContourCrownWidget.cxx.
int wxMaracasCoutourTool::AnalisisContourInside | ( | int | x, | |
int | y, | |||
manualViewBaseContour * | manualviewbaseecontour, | |||
manualContourModel * | manualcontourmodel | |||
) | [private] |
Definition at line 275 of file ContourCrownWidget.cxx.
References manualViewBaseContour::GetNumberOfPoints(), manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), and manualContourModel::UpdateSpline().
Referenced by isInside().
00280 { 00281 int result = 0; 00282 int i; 00283 int np = manualviewbaseecontour->GetNumberOfPoints( ); // number of control points 00284 00285 // JSTG 26-02-08 --------------------------------------------------------------------------------------- 00286 //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline 00287 int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline 00288 //double x1,y1,z1,x2,y2,z2,t; 00289 double x1,y1,z1,x2,y2,z2; 00290 double xx1, yy1,xx2, yy2; 00291 //double delta=( double ) ( np ) / ( double ) ( nps ); 00292 manualcontourmodel->UpdateSpline(); 00293 //------------------------------------------------------------------------------------------------------ 00294 double d; 00295 bool ok; 00296 if (np>=2) 00297 { 00298 // JSTG 26-02-08 --------------------------------------------------------------------------------------- 00299 nps--; 00300 //manualcontourmodel->GetSplinePoint(0,x1,y1,z1); 00301 manualcontourmodel->GetSpline_i_Point(0,&x1,&y1,&z1); 00302 for (i=1; i<=nps; i++) 00303 { 00304 ok=false; 00305 //t= delta * (double)(i%nps); 00306 //manualcontourmodel->GetSplinePoint(t,x2,y2,z2); 00307 manualcontourmodel->GetSpline_i_Point(i,&x2,&y2,&z2); 00308 //------------------------------------------------------------------------------------------------------ 00309 //by triangle similarity 00310 if ( ((y1<y2)&&(y>=y1)&&(y<y2)) || ((y1>y2)&&(y<=y1)&&(y>y2)) ) 00311 { 00312 if (y1<y2) { xx1=x1; yy1=y1; xx2=x2; yy2=y2;} else { xx1=x2; yy1=y2; xx2=x1; yy2=y1; } 00313 d = ( fabs(xx2-xx1)*(y-yy1) ) / (yy2-yy1) ; 00314 if ( ((xx1<xx2)&&(x<(xx1+d))) || ((xx1>xx2)&&(x<(xx1-d))) ) { result++; } 00315 } 00316 x1=x2; y1=y2; z1=z2; 00317 } 00318 } 00319 return result; 00320 }
void wxMaracasCoutourTool::ConfigureVTK | ( | ) |
Definition at line 109 of file ContourCrownWidget.cxx.
References _contprop, _manContourControl_1, _manContourControl_2, _mContourModel_1, _mContourModel_2, _mViewContour_1, _mViewContour_2, manualContourBaseControler::CreateNewManualContour(), wxVtkBaseView::GetInteractorStyleBaseView(), imagedata, manualViewContour::RefreshContour(), InteractorStyleMaracas::SetActive(), manualViewBaseContour::SetColorEditContour(), manualViewBaseContour::SetColorNormalContour(), manualViewBaseContour::SetModel(), manualContourBaseControler::SetModelView(), manualContourModel::SetNumberOfPointsSpline(), manualViewBaseContour::SetRange(), manualViewBaseContour::SetSpacing(), manualViewBaseContour::SetWxVtkBaseView(), manualViewBaseContour::SetZ(), and wxvtkbaseview.
00110 { 00111 double spc[3]; 00112 this->imagedata->GetSpacing(spc); 00113 00114 // Contorno 1 00115 _manContourControl_1 = new manualContourControler(); 00116 _mContourModel_1 = new manualContourModel(); 00117 _mViewContour_1 = new manualViewContour(); 00118 _mViewContour_1->SetModel( _mContourModel_1 ); 00119 _mViewContour_1->SetWxVtkBaseView( this->wxvtkbaseview ); 00120 _mViewContour_1->SetRange( 2 ); 00121 _mViewContour_1->SetZ( 1000 ); 00122 00123 //JSTG 18-06-07 00124 _mContourModel_1->SetNumberOfPointsSpline(100); 00125 00126 00127 //EED 3 oct 2006 00128 _mViewContour_1->SetSpacing(spc); 00129 00130 00131 //EED 3 oct 2006 00132 _mViewContour_1->SetColorNormalContour(0, 0, 1); 00133 _mViewContour_1->SetColorEditContour(0.5, 0.5, 0.5); 00134 00135 00136 _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 ); 00137 ((vtkInteractorStyleBaseView*)this->wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 ); 00138 _manContourControl_1->CreateNewManualContour(); 00139 _manContourControl_1->SetActive(false); 00140 _mViewContour_1->RefreshContour(); 00141 00142 00143 // Contorno 2 00144 _manContourControl_2 = new manualContourControler(); 00145 _mContourModel_2 = new manualContourModel(); 00146 _mViewContour_2 = new manualViewContour(); 00147 _mViewContour_2->SetModel( _mContourModel_2 ); 00148 _mViewContour_2->SetWxVtkBaseView( this->wxvtkbaseview ); 00149 _mViewContour_2->SetRange( 2 ); 00150 _mViewContour_2->SetZ( 1000 ); 00151 00152 //EED 3 oct 2006 00153 _mViewContour_2->SetSpacing(spc); 00154 00155 //EED 3 oct 2006 00156 _mViewContour_2->SetColorNormalContour(1, 0, 0); 00157 _mViewContour_2->SetColorEditContour(0.5, 0.5, 0.5); 00158 00159 00160 _manContourControl_2->SetModelView( _mContourModel_2 , _mViewContour_2 ); 00161 ((vtkInteractorStyleBaseView*)this->wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_2 ); 00162 _manContourControl_2->CreateNewManualContour(); 00163 _manContourControl_2->SetActive(false); 00164 _mViewContour_2->RefreshContour(); 00165 00166 // Refresh(); 00167 00168 //JSTG 16-06-08 00169 _contprop = new ContourPropagation(); 00170 }
void wxMaracasCoutourTool::EreaseLastContour | ( | wxCommandEvent & | event | ) |
Definition at line 549 of file ContourCrownWidget.cxx.
References _SizesC, _SizesCP, _tempCPX, _tempCPY, _tempCPZ, _tempCX, _tempCY, and _tempCZ.
Referenced by wxMaracasCoutourTool().
00550 { 00551 char firstline[30]; 00552 int size = 0,i,j; 00553 double x,y; 00554 int z; 00555 00556 _tempCX.clear(); 00557 _tempCY.clear(); 00558 _tempCZ.clear(); 00559 _tempCPX.clear(); 00560 _tempCPY.clear(); 00561 _tempCPZ.clear(); 00562 _SizesC.clear(); 00563 _SizesCP.clear(); 00564 00565 FILE* fd; 00566 fd = fopen("C:/bbtk_JS/data/SavedContours.txt","r"); 00567 if(fd!=NULL) 00568 { 00569 while(!feof(fd)) 00570 { 00571 // //fscanf(fd," %s %d",&firstline,&size); // JPRx 00572 fscanf(fd," %s %d",firstline,&size); 00573 00574 _SizesC.push_back(size); 00575 for(j=0; j<size; j++) 00576 { 00577 fscanf(fd,"%lf %lf %d",&x,&y,&z); 00578 _tempCX.push_back(x); 00579 _tempCY.push_back(y); 00580 _tempCZ.push_back(z); 00581 } 00582 } 00583 } 00584 else 00585 { 00586 printf("\nJSTG - wxMaracasCoutourTool::EreaseLastContour - FILE NOT FOUND"); 00587 } 00588 fclose(fd); 00589 00590 for(i=0; i<size; i++) 00591 { 00592 _tempCX.pop_back(); 00593 _tempCY.pop_back(); 00594 _tempCZ.pop_back(); 00595 } 00596 _SizesC.pop_back(); 00597 00598 fd = fopen("C:/bbtk_JS/data/SavedContours.txt","w"); 00599 if(fd!=NULL) 00600 { 00601 int cont = 0; 00602 for(i=0; i<(int)(_SizesC.size()); i++) 00603 { 00604 fprintf(fd,"\nNumberOfPoints %d", _SizesC[i] ); 00605 for(j=0; j<_SizesC[i]; j++) 00606 { 00607 fprintf(fd,"\n%f %f %d",_tempCX[j+cont],_tempCY[j+cont],_tempCZ[j+cont]); 00608 } 00609 cont = _SizesC[i]; 00610 } 00611 } 00612 else 00613 { 00614 printf("\nJSTG - wxMaracasCoutourTool::EreaseLastContour - FILE NOT FOUND"); 00615 } 00616 fclose(fd); 00617 00618 }
void wxMaracasCoutourTool::EreaseLastCP | ( | wxCommandEvent & | event | ) |
Definition at line 620 of file ContourCrownWidget.cxx.
References _SizesC, _SizesCP, _tempCPX, _tempCPY, _tempCPZ, _tempCX, _tempCY, and _tempCZ.
Referenced by wxMaracasCoutourTool().
00621 { 00622 char firstline[30]; 00623 int size = 0,i,j; 00624 double x,y; 00625 int z; 00626 00627 _tempCX.clear(); 00628 _tempCY.clear(); 00629 _tempCZ.clear(); 00630 _tempCPX.clear(); 00631 _tempCPY.clear(); 00632 _tempCPZ.clear(); 00633 _SizesC.clear(); 00634 _SizesCP.clear(); 00635 00636 FILE* fd; 00637 fd = fopen("C:/bbtk_JS/data/SavedManualPoints.txt","r"); 00638 if(fd!=NULL) 00639 { 00640 while(!feof(fd)) 00641 { 00642 //fscanf(fd,""); // ?? JPRx 00643 //fscanf(fd," %s %d",&firstline,&size);// JPRx 00644 fscanf(fd," %s %d",firstline,&size); 00645 _SizesC.push_back(size); 00646 for(j=0; j<size; j++) 00647 { 00648 fscanf(fd,"%lf %lf %d",&x,&y,&z); 00649 _tempCX.push_back(x); 00650 _tempCY.push_back(y); 00651 _tempCZ.push_back(z); 00652 } 00653 } 00654 } 00655 else 00656 { 00657 printf("\nJSTG - wxMaracasCoutourTool::EreaseLastContour - FILE NOT FOUND"); 00658 } 00659 fclose(fd); 00660 00661 for(i=0; i<size; i++) 00662 { 00663 _tempCX.pop_back(); 00664 _tempCY.pop_back(); 00665 _tempCZ.pop_back(); 00666 } 00667 _SizesC.pop_back(); 00668 00669 fd = fopen("C:/bbtk_JS/data/SavedManualPoints.txt","w"); 00670 if(fd!=NULL) 00671 { 00672 int cont = 0; 00673 for(i=0; i<(int)(_SizesC.size()); i++) 00674 { 00675 fprintf(fd,"\nNumberOfControlPoints %d", _SizesC[i] ); 00676 for(j=0; j<_SizesC[i]; j++) 00677 { 00678 fprintf(fd,"\n%f %f %d",_tempCX[j+cont],_tempCY[j+cont],_tempCZ[j+cont]); 00679 } 00680 cont = _SizesC[i]; 00681 } 00682 } 00683 else 00684 { 00685 printf("\nJSTG - wxMaracasCoutourTool::EreaseLastContour - FILE NOT FOUND"); 00686 } 00687 fclose(fd); 00688 }
double wxMaracasCoutourTool::GetDataValue | ( | int | x, | |
int | y | |||
) | [private] |
Definition at line 344 of file ContourCrownWidget.cxx.
References _zz, wxVtk2DBaseView::GetVtkBaseData(), vtkBaseData::GetZ(), imagedata, and wxvtkbaseview.
Referenced by GetValuesInsideCrown().
00345 { 00346 unsigned short *p; 00347 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview; 00348 int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ(); 00349 //JSTG 13-03-08----- 00350 _zz = z; 00351 //------------------ 00352 p = (unsigned short *)imagedata->GetScalarPointer(x,y,z); 00353 return (double)(*p); 00354 }
void wxMaracasCoutourTool::GetMinMaxPoint | ( | int * | minPoint, | |
int * | maxPoint, | |||
manualViewBaseContour * | manualviewbaseecontour, | |||
manualContourModel * | manualcontourmodel | |||
) | [private] |
Definition at line 241 of file ContourCrownWidget.cxx.
References manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), and manualContourModel::UpdateSpline().
00246 { 00247 int i; 00248 //int np = manualviewbaseecontour->GetNumberOfPoints( ); // number of control points // JPRx 00249 00250 // JSTG 26-02-08 --------------------------------------------------------------------------------------- 00251 //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline 00252 int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline 00253 //------------------------------------------------------------------------------------------------------ 00254 00255 // JSTG 26-02-08 --------------------------------------------------------------------------------------- 00256 //double x,y,z,t; 00257 double x,y,z; 00258 //double delta=( double ) ( np ) / ( double ) ( nps ); 00259 manualcontourmodel->UpdateSpline(); 00260 for (i=0; i<nps; i++) 00261 { 00262 //t= delta * (double)i; 00263 //manualcontourmodel->GetSplinePoint(t,x,y,z); 00264 manualcontourmodel->GetSpline_i_Point(i,&x,&y,&z); 00265 if (x<minPoint[0]){ minPoint[0]=(int)x; } 00266 if (y<minPoint[1]){ minPoint[1]=(int)y; } 00267 if (x>maxPoint[0]){ maxPoint[0]=(int)x; } 00268 if (y>maxPoint[1]){ maxPoint[1]=(int)y; } 00269 } 00270 //------------------------------------------------------------------------------------------------------ 00271 }
void wxMaracasCoutourTool::GetMinMaxPoint | ( | int * | minPoint, | |
int * | maxPoint | |||
) | [private] |
void wxMaracasCoutourTool::GetSplinePoints | ( | std::vector< double > * | pLstContourX, | |
std::vector< double > * | pLstContourY, | |||
std::vector< double > * | pLstContourZ | |||
) |
Definition at line 202 of file ContourCrownWidget.cxx.
References _mContourModel_1, _zz, manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), and manualContourModel::UpdateSpline().
00205 { 00206 int i; 00207 double x,y,z; 00208 _mContourModel_1->UpdateSpline(); 00209 00210 for(i=0; i<_mContourModel_1->GetNumberOfPointsSpline(); i++) 00211 { 00212 _mContourModel_1->GetSpline_i_Point( i, &x, &y, &z ); 00213 pLstContourX->push_back(x); 00214 pLstContourY->push_back(y); 00215 //pLstContourY->push_back(z); //Fake Z -> For Visualization 00216 pLstContourZ->push_back(_zz); //True Z -> For processing 00217 } 00218 }
void wxMaracasCoutourTool::GetValuesInsideCrown | ( | std::vector< double > * | pLstValue, | |
std::vector< double > * | pLstValuePosX, | |||
std::vector< double > * | pLstValuePosY, | |||
std::vector< double > * | pLstValuePosZ | |||
) |
Definition at line 390 of file ContourCrownWidget.cxx.
References _mContourModel_1, _mContourModel_2, _mViewContour_1, _mViewContour_2, GetDataValue(), GetMinMaxPoint(), imagedataMaskResult, imagedataValueResult, isInside(), PutVtkImageDataResultValue(), and ResetImageResult().
00394 { 00395 pLstValue->clear(); 00396 pLstValuePosX->clear(); 00397 pLstValuePosY->clear(); 00398 pLstValuePosZ->clear(); 00399 ResetImageResult(); 00400 00401 int minPoint[2]; 00402 int maxPoint[2]; 00403 int i,j; 00404 double value; 00405 00406 00407 minPoint[0]=999999; 00408 minPoint[1]=999999; 00409 maxPoint[0]=-999999; 00410 maxPoint[1]=-999999; 00411 00412 GetMinMaxPoint(minPoint,maxPoint, _mViewContour_1, _mContourModel_1); 00413 GetMinMaxPoint(minPoint,maxPoint, _mViewContour_2, _mContourModel_2); 00414 00415 for (j=minPoint[1]; j<maxPoint[1]; j++) 00416 { 00417 for (i=minPoint[0]; i<maxPoint[0]; i++) 00418 { 00419 if (isInside(i,j)==true) 00420 { 00421 value = GetDataValue(i,j); 00422 PutVtkImageDataResultValue(i,j, value ); 00423 pLstValue -> push_back( value ); 00424 pLstValuePosX -> push_back( i ); 00425 pLstValuePosY -> push_back( j ); 00426 pLstValuePosZ -> push_back( -1 ); 00427 } // if 00428 } // for 00429 } // for 00430 00431 imagedataValueResult->Modified(); 00432 imagedataMaskResult->Modified(); 00433 }
vtkImageData * wxMaracasCoutourTool::GetVtkImageMaskResult | ( | ) |
Definition at line 442 of file ContourCrownWidget.cxx.
References imagedataMaskResult.
00443 { 00444 return imagedataMaskResult; 00445 }
vtkImageData * wxMaracasCoutourTool::GetVtkImageValueResult | ( | ) |
Definition at line 437 of file ContourCrownWidget.cxx.
References imagedataValueResult.
00438 { 00439 return imagedataValueResult; 00440 }
wxVtkBaseView * wxMaracasCoutourTool::GetWxVtkBaseView | ( | ) |
Definition at line 101 of file ContourCrownWidget.cxx.
References wxvtkbaseview.
00102 { 00103 return this->wxvtkbaseview; 00104 }
void wxMaracasCoutourTool::InitVtkImagesResult | ( | ) | [private] |
Definition at line 447 of file ContourCrownWidget.cxx.
References imagedata, imagedataMaskResult, and imagedataValueResult.
Referenced by wxMaracasCoutourTool().
00448 { 00449 int ext[6]; 00450 int newDim[3]; 00451 double spc[3]; 00452 int scalartype; 00453 00454 imagedata->GetSpacing(spc); 00455 imagedata->GetExtent(ext); 00456 newDim[0]=ext[1]-ext[0]+1; 00457 newDim[1]=ext[3]-ext[2]+1; 00458 newDim[2]=1; 00459 scalartype = imagedata->GetScalarType(); 00460 00461 imagedataValueResult = vtkImageData::New(); 00462 // imagedataValueResult->SetScalarType(scalartype); 00463 imagedataValueResult->SetScalarTypeToUnsignedShort(); 00464 imagedataValueResult->SetSpacing(spc); 00465 imagedataValueResult->SetDimensions( newDim ); 00466 imagedataValueResult->AllocateScalars(); 00467 00468 imagedataMaskResult = vtkImageData::New(); 00469 // imagedataMaskResult->SetScalarType(scalartype); 00470 imagedataMaskResult->SetScalarTypeToUnsignedShort(); 00471 imagedataMaskResult->SetSpacing(spc); 00472 imagedataMaskResult->SetDimensions( newDim ); 00473 imagedataMaskResult->AllocateScalars(); 00474 00475 }
bool wxMaracasCoutourTool::isInside | ( | int | x, | |
int | y | |||
) | [private] |
Definition at line 325 of file ContourCrownWidget.cxx.
References _mContourModel_1, _mContourModel_2, _mViewContour_1, _mViewContour_2, AnalisisContourInside(), and imagedataValueResult.
Referenced by GetValuesInsideCrown().
00326 { 00327 bool result=false; 00328 00329 int ext[6]; 00330 imagedataValueResult->GetExtent(ext); 00331 00332 if ((x>=0) && (x<=ext[1]) && (y>=0) && (y<=ext[3])) 00333 { 00334 int numberLeftA=AnalisisContourInside(x,y,_mViewContour_1, _mContourModel_1); 00335 int numberLeftB=AnalisisContourInside(x,y,_mViewContour_2, _mContourModel_2); 00336 if ( (numberLeftA+numberLeftB) % 2 ==1){ result = true; } 00337 } 00338 00339 return result; 00340 }
void wxMaracasCoutourTool::OnContourA | ( | wxCommandEvent & | event | ) |
Definition at line 222 of file ContourCrownWidget.cxx.
References _manContourControl_1, and _manContourControl_2.
Referenced by wxMaracasCoutourTool().
00223 { 00224 _manContourControl_1 -> SetActive(true); 00225 _manContourControl_2 -> SetActive(false); 00226 }
void wxMaracasCoutourTool::OnContourAB | ( | wxCommandEvent & | event | ) |
Definition at line 234 of file ContourCrownWidget.cxx.
References _manContourControl_1, and _manContourControl_2.
Referenced by wxMaracasCoutourTool().
00235 { 00236 _manContourControl_1 -> SetActive(true); 00237 _manContourControl_2 -> SetActive(true); 00238 }
void wxMaracasCoutourTool::OnContourB | ( | wxCommandEvent & | event | ) |
Definition at line 228 of file ContourCrownWidget.cxx.
References _manContourControl_1, and _manContourControl_2.
Referenced by wxMaracasCoutourTool().
00229 { 00230 _manContourControl_1 -> SetActive(false); 00231 _manContourControl_2 -> SetActive(true); 00232 }
void wxMaracasCoutourTool::OnSaveContour | ( | wxCommandEvent & | event | ) |
Definition at line 478 of file ContourCrownWidget.cxx.
References _contprop, _mContourModel_1, _mpoint, ContourPropagation::appendContour(), manualContourModel::GetNumberOfPointsSpline(), manualContourModel::GetSpline_i_Point(), wxVtk2DBaseView::GetVtkBaseData(), vtkBaseData::GetZ(), and wxvtkbaseview.
Referenced by wxMaracasCoutourTool().
00479 { 00480 //For write the actual time and date 00481 /* 00482 time_t timer; 00483 struct tm *tblock; 00484 timer = time(NULL); 00485 tblock = localtime(&timer); 00486 */ 00487 00488 FILE *fd; 00489 00490 //WHERE CAN I MAKE THEM DELETE!!! 00491 _mpoint = new manualPoint(); 00492 00493 std::vector<double> tempX; 00494 std::vector<double> tempY; 00495 std::vector<double> tempZ; 00496 tempX.clear(); 00497 tempY.clear(); 00498 tempZ.clear(); 00499 00500 int size = _mContourModel_1->GetNumberOfPointsSpline(); 00501 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview; 00502 int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ(); 00503 double xx, yy, zz; 00504 00505 fd = fopen("C:/bbtk_JS/data/SavedContours.txt","a"); 00506 //fprintf(fd,"Date %s", asctime(tblock) ); 00507 fprintf(fd,"\nPointsContour %d", size ); 00508 for(int i=0; i<size; i++) 00509 { 00510 _mContourModel_1->GetSpline_i_Point(i,&xx,&yy,&zz); 00511 fprintf(fd,"\n%f %f %d",xx,yy,z); //z -> Contain the true value || zz -> Contain the cheating value for visualitation 00512 tempX.push_back(xx); 00513 tempY.push_back(yy); 00514 tempZ.push_back(z); 00515 } 00516 fclose(fd); 00517 00518 //JSTG 16-06-08 00519 _contprop->appendContour(&tempX,&tempY,&tempZ); 00520 }
void wxMaracasCoutourTool::OnSaveControlPoints | ( | wxCommandEvent & | event | ) |
Definition at line 523 of file ContourCrownWidget.cxx.
References _mContourModel_1, _mpoint, manualContourModel::GetManualPoint(), manualContourModel::GetSizeLstPoints(), wxVtk2DBaseView::GetVtkBaseData(), manualPoint::GetX(), manualPoint::GetY(), vtkBaseData::GetZ(), and wxvtkbaseview.
Referenced by wxMaracasCoutourTool().
00524 { 00525 //For write the actual time and date 00526 /* 00527 time_t timer; 00528 struct tm *tblock; 00529 timer = time(NULL); 00530 tblock = localtime(&timer); 00531 */ 00532 FILE *fd; 00533 _mpoint = new manualPoint(); 00534 int size = _mContourModel_1->GetSizeLstPoints(); 00535 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)wxvtkbaseview; 00536 int z = (int)wxvtk2dbaseview->GetVtkBaseData()->GetZ(); 00537 00538 fd = fopen("C:/bbtk_JS/data/SavedManualPoints.txt","a"); 00539 //fprintf(fd,"Date %s", asctime(tblock) ); 00540 fprintf(fd,"\nNumberOfControlPoints %d", size ); 00541 for(int i=0; i<size; i++) 00542 { 00543 _mpoint = _mContourModel_1->GetManualPoint(i); 00544 fprintf(fd,"\n%f %f %d",_mpoint->GetX(),_mpoint->GetY(),z); 00545 } 00546 fclose(fd); 00547 }
void wxMaracasCoutourTool::PutVtkImageDataResultValue | ( | int | x, | |
int | y, | |||
double | value | |||
) | [private] |
Definition at line 358 of file ContourCrownWidget.cxx.
References imagedataMaskResult, and imagedataValueResult.
Referenced by GetValuesInsideCrown().
00359 { 00360 unsigned short *pValue; 00361 unsigned short *pMask; 00362 pValue = (unsigned short *)imagedataValueResult->GetScalarPointer(x,y,0); 00363 pMask = (unsigned short *)imagedataMaskResult->GetScalarPointer(x,y,0); 00364 *pMask = 255; 00365 *pValue = (unsigned short)value; 00366 }
void wxMaracasCoutourTool::ResetImageResult | ( | ) | [private] |
Definition at line 369 of file ContourCrownWidget.cxx.
References imagedataMaskResult, and imagedataValueResult.
Referenced by GetValuesInsideCrown().
00370 { 00371 unsigned short *pValue; 00372 unsigned short *pMask; 00373 pValue = (unsigned short *)imagedataValueResult->GetScalarPointer(0,0,0); 00374 pMask = (unsigned short *)imagedataMaskResult->GetScalarPointer(0,0,0); 00375 00376 int ext[6]; 00377 imagedataValueResult->GetExtent(ext); 00378 00379 int i,size = (ext[1]-ext[0]+1) * (ext[3]-ext[2]+1); 00380 for(i=0; i<size; i++) 00381 { 00382 *pMask = 0; 00383 *pValue = 0; 00384 pMask++; 00385 pValue++; 00386 } 00387 }
void wxMaracasCoutourTool::SetControlPoints | ( | std::vector< double > * | InVectorX, | |
std::vector< double > * | InVectorY, | |||
std::vector< double > * | InVectorZ | |||
) |
Definition at line 173 of file ContourCrownWidget.cxx.
References _mContourModel_1, _mViewContour_1, manualViewBaseContour::AddPoint(), manualContourModel::AddPoint(), manualViewBaseContour::CreateNewContour(), manualContourModel::DeleteAllPoints(), manualViewBaseContour::DeleteContour(), manualViewContour::RefreshContour(), and manualContourModel::UpdateSpline().
00176 { 00177 int lstSize; 00178 if (InVectorX!=NULL) 00179 { 00180 int i,size=InVectorX->size(); 00181 if (size!=0) 00182 { 00183 _mContourModel_1->DeleteAllPoints(); 00184 _mViewContour_1->DeleteContour(); 00185 00186 for (i=0;i<size;i++) 00187 { 00188 lstSize = _mContourModel_1->AddPoint( (*InVectorX)[i] , (*InVectorY)[i] , (*InVectorZ)[i] ); 00189 _mViewContour_1->AddPoint(); 00190 } 00191 //_manContourControl_1->CreateNewManualContour(); 00192 //_manContourControl_1->SetActive(true); 00193 _mViewContour_1->CreateNewContour(); 00194 _mContourModel_1->UpdateSpline(); 00195 _mViewContour_1->RefreshContour(); 00196 //_mViewContour_1->Refresh (); 00197 } 00198 } 00199 }
Definition at line 79 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), and OnSaveContour().
Definition at line 82 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), OnContourA(), OnContourAB(), and OnContourB().
Definition at line 86 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), OnContourA(), OnContourAB(), and OnContourB().
Definition at line 90 of file ContourCrownWidget.h.
Definition at line 91 of file ContourCrownWidget.h.
Definition at line 83 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetSplinePoints(), GetValuesInsideCrown(), isInside(), OnSaveContour(), OnSaveControlPoints(), and SetControlPoints().
Definition at line 87 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetValuesInsideCrown(), and isInside().
manualPoint* wxMaracasCoutourTool::_mpoint [private] |
Definition at line 76 of file ContourCrownWidget.h.
Referenced by OnSaveContour(), and OnSaveControlPoints().
Definition at line 84 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetValuesInsideCrown(), isInside(), and SetControlPoints().
Definition at line 88 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetValuesInsideCrown(), and isInside().
manualViewRoi* wxMaracasCoutourTool::_mViewRoi [private] |
Definition at line 92 of file ContourCrownWidget.h.
std::vector<int> wxMaracasCoutourTool::_SizesC [private] |
Definition at line 67 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<int> wxMaracasCoutourTool::_SizesCP [private] |
Definition at line 71 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<double> wxMaracasCoutourTool::_tempCPX [private] |
Definition at line 68 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<double> wxMaracasCoutourTool::_tempCPY [private] |
Definition at line 69 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<int> wxMaracasCoutourTool::_tempCPZ [private] |
Definition at line 70 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<double> wxMaracasCoutourTool::_tempCX [private] |
Definition at line 64 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<double> wxMaracasCoutourTool::_tempCY [private] |
Definition at line 65 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
std::vector<int> wxMaracasCoutourTool::_tempCZ [private] |
Definition at line 66 of file ContourCrownWidget.h.
Referenced by EreaseLastContour(), and EreaseLastCP().
int wxMaracasCoutourTool::_zz [private] |
Definition at line 75 of file ContourCrownWidget.h.
Referenced by GetDataValue(), and GetSplinePoints().
vtkImageData* wxMaracasCoutourTool::imagedata [private] |
Definition at line 58 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetDataValue(), and InitVtkImagesResult().
vtkImageData* wxMaracasCoutourTool::imagedataMaskResult [private] |
Definition at line 60 of file ContourCrownWidget.h.
Referenced by GetValuesInsideCrown(), GetVtkImageMaskResult(), InitVtkImagesResult(), PutVtkImageDataResultValue(), ResetImageResult(), and wxMaracasCoutourTool().
vtkImageData* wxMaracasCoutourTool::imagedataValueResult [private] |
Definition at line 59 of file ContourCrownWidget.h.
Referenced by GetValuesInsideCrown(), GetVtkImageValueResult(), InitVtkImagesResult(), isInside(), PutVtkImageDataResultValue(), and ResetImageResult().
mBarRange* wxMaracasCoutourTool::mbarrange [private] |
Definition at line 56 of file ContourCrownWidget.h.
std::vector<double>* wxMaracasCoutourTool::pControlVectorX [private] |
Definition at line 72 of file ContourCrownWidget.h.
std::vector<double>* wxMaracasCoutourTool::pControlVectorY [private] |
Definition at line 73 of file ContourCrownWidget.h.
std::vector<double>* wxMaracasCoutourTool::pControlVectorZ [private] |
Definition at line 74 of file ContourCrownWidget.h.
wxVtkBaseView* wxMaracasCoutourTool::wxvtkbaseview [private] |
Definition at line 61 of file ContourCrownWidget.h.
Referenced by ConfigureVTK(), GetDataValue(), GetWxVtkBaseView(), OnSaveContour(), and OnSaveControlPoints().