From 3daae2bd6af3744f72c316b8155131ff1ca8f617 Mon Sep 17 00:00:00 2001 From: donadio Date: Fri, 5 Jun 2009 17:30:16 +0000 Subject: [PATCH] Transform Roi --- .../wxContourMainFrame.cxx | 123 ++++++++++-------- 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index a8734c0..b95f0c4 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1049,7 +1049,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) else if (compatible==false) { - wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(250,160)); + wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(260,160)); wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL); wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL); @@ -1058,7 +1058,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) lstOptOperation[1]=_T("By Spacing"); wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 2 , lstOptOperation, 2, wxRA_SPECIFY_COLS); - dialSizer->Add( new wxStaticText(dial,-1,_T("The actual image is not compatible with the ")) , 0, wxGROW ); + dialSizer->Add( new wxStaticText(dial,-1,_T("The image resolution is not compatible with the ")) , 0, wxGROW ); dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW ); dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW ); dialSizer->Add(radioOpts,0,wxGROW); @@ -1068,69 +1068,86 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) dial->Layout(); dial->ShowModal(); + int typeOfTransformation = -1; + bool transform = false; + if (dial->GetReturnCode() == wxID_OK) { int typeOfTransformation = radioOpts->GetSelection(); - - int i; - for (i=0;ifactoryManualContourModel(typeContourModel); + transform = true; + + } + + int i; + for (i=0;ifactoryManualContourModel(typeContourModel); + manModelContour->Open(pFile); + if (transform) + { if (typeOfTransformation==0) { - manModelContour->OpenAndTransformDimension(pFile, imageDim, tempDim); + double transX, transY; + transX = (double) imageDim[0]/tempDim[0]; + transY = (double) imageDim[1]/tempDim[1]; + + manModelContour->Transform_Ax_Plus_B(transX,0,transY,0); } + else if (typeOfTransformation==1) { - manModelContour->OpenAndTransformSpacing(pFile, imageSpac, tempSpac); + double transX, transY; + transX = (double) tempSpac[0]/imageSpac[0]; + transY = (double) tempSpac[1]/imageSpac[1]; + + manModelContour->Transform_Ax_Plus_B(transX,0,transY,0); } + } - fscanf(pFile,"%s",tmp); // TypeView - fscanf(pFile,"%s",tmp); // ## - typeView = atoi(tmp); + fscanf(pFile,"%s",tmp); // TypeView + fscanf(pFile,"%s",tmp); // ## + typeView = atoi(tmp); - std::string theName; - theName = kernelManager->createOutline( manModelContour, instantVector ); - bool addedModel = theName.compare("") != 0; - if( addedModel ) - { - double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default - _theViewPanel->getSpacing(spc); - //Adding the manualContourControler to interface objects structure - //Adding the manualViewContour to interface objects structure - //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active. - _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; - } - - if (version==0) //StaticContours (will appear in all slices) - { - Instant instant(&instantVector); - kernelManager->changeContourOfManager( theName , &instant ); - } - }// for numberOfContours - } + std::string theName; + theName = kernelManager->createOutline( manModelContour, instantVector ); + bool addedModel = theName.compare("") != 0; + if( addedModel ) + { + double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default + _theViewPanel->getSpacing(spc); + //Adding the manualContourControler to interface objects structure + //Adding the manualViewContour to interface objects structure + //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active. + _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; + } + + if (version==0) //StaticContours (will appear in all slices) + { + Instant instant(&instantVector); + kernelManager->changeContourOfManager( theName , &instant ); + } + }// for numberOfContours } } -- 2.45.1