]> Creatis software - creaContours.git/commitdiff
Resize by Spacing
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 7 Dec 2020 14:36:35 +0000 (15:36 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 7 Dec 2020 14:36:35 +0000 (15:36 +0100)
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx

index 37cc8d33f88d2aa9c4fc62b5071fb2bbab335de2..48c038b0a87b3279d93362d81e89b534ac091673 100644 (file)
@@ -1177,10 +1177,11 @@ void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption)
 //                     wxBoxSizer              *dialSizer = new wxBoxSizer(wxVERTICAL);
                        wxFlexGridSizer *dialSizer = new wxFlexGridSizer(1);
 
-                       wxString lstOptOperation[2];
-                       lstOptOperation[0]=_T("By Dimension");
-                       lstOptOperation[1]=_T("By Spacing");
-                       wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,90), 2 , lstOptOperation,  2, wxRA_SPECIFY_COLS);
+                       wxString lstOptOperation[3];
+                       lstOptOperation[0]=_T("By Dimension (XY)");
+                       lstOptOperation[1]=_T("By Spacing   (XY)");
+                       lstOptOperation[2]=_T("By Spacing   (XYZ)");
+                       wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(370,200), 3 , lstOptOperation,  3, wxRA_SPECIFY_ROWS);
 
                        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 );
@@ -1192,7 +1193,7 @@ void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption)
                        dial->Layout();
                        dial->ShowModal();
 
-                       int _tmpReadFileTypeOfTransformation = -1;
+                       _tmpReadFileTypeOfTransformation = -1;
 //EED                  bool transform = false;
 
                        if (dial->GetReturnCode() == wxID_OK)
@@ -1210,7 +1211,7 @@ void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption)
 //AD:04-06-09
 void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool staticContour )
 {
-
+printf ("EED wxContourMainFrame::openContours Start \n");
        char tmp[255];
 
        vtkImageData    *image = _images[0];
@@ -1328,14 +1329,22 @@ void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool static
                 //nothing to do..
             } else if (_tmpReadFileTypeOfTransformation==0){
                 double transX, transY;
-                transX = (double) imageDim[0]/_tmpReadFileImageDim[0];
-                transY = (double) imageDim[1]/_tmpReadFileImageDim[1];
-                manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
+                transX = (double) imageDim[0]/_tmpReadFileImageDim[0];                    // X
+                transY = (double) imageDim[1]/_tmpReadFileImageDim[1];                    // Y
+                manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);                
             } else if (_tmpReadFileTypeOfTransformation==1) {
                 double transX, transY;
-                transX = (double) _tmpReadFileImageSpac[0]/imageDim[0];
-                transY = (double) _tmpReadFileImageSpac[1]/imageDim[1];
+                transX = (double) _tmpReadFileImageSpac[0]/imageSpac[0];                  // X
+                transY = (double) _tmpReadFileImageSpac[1]/imageSpac[1];                  // Y
+                manModelContour->Transform_Ax_Plus_B(transX,0,transY,0); 
+            } else if (_tmpReadFileTypeOfTransformation==2) {  // with Z include
+                double transX, transY;
+                transX = (double) _tmpReadFileImageSpac[0]/imageSpac[0];                   // X
+                transY = (double) _tmpReadFileImageSpac[1]/imageSpac[1];                   // Y 
+                instantVector[1]=instantVector[1]*_tmpReadFileImageSpac[2]/imageSpac[2];   // Z
                 manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
+            }else {
+                   printf ("EED Warnning! wxContourMainFrame::openContours _tmpReadFileTypeOfTransformation not set. \n");
             }
 
                        fscanf(pFile,"%s",tmp); // TypeView
@@ -1364,6 +1373,8 @@ void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool static
 
 /*     }    */
 
+printf ("EED wxContourMainFrame::openContours END \n");
+
 }
 
 void wxContourMainFrame::RefreshInterface()