]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
#3383 NDimension changeImage
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index c50fa9b4f3356b0f3c2aa4548369f7e37b9754de..3961f40d8aedb16ddd4220f21bcdfc18d447cb66 100644 (file)
@@ -131,6 +131,16 @@ char wxContourMainFrame::COPY = 'C';
                _contourextractdata                     = NULL;
 }
 
+
+void wxContourMainFrame::changeImage(int id, vtkImageData *img)
+{
+    if ( id<_images.size() ) _images[id]=img;
+    kernelManager->changeImage(id,img);
+    _theViewPanel->changeImage(img);
+//    updateInstantImageData();
+    
+}
+
 void wxContourMainFrame::configure(std::vector<vtkImageData*> imgs)
 {
        _images = imgs;
@@ -734,7 +744,6 @@ void wxContourMainFrame::updateInstantImageData()
 {
        std::vector<int> inst;
        _instantPanel->getInstant(inst);
-
        vtkImageData* img = kernelManager->getImageAtInstant(inst);
        if(img!=NULL)
        {
@@ -894,7 +903,6 @@ void  wxContourMainFrame::SetZForAllContours(int pz)
        sizeLstNameThings       = lstNameThings.size(); 
        for (i=0 ; i<sizeLstNameThings ; i++)
        {
-printf("EED wxContourMainFrame::SetZForAllContours contour=%d \n", i );
                manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
                sizeLstPoints = manualModel->GetSizeLstPoints();
                for (ii=0 ; ii<sizeLstPoints ; ii++)
@@ -1066,70 +1074,49 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
        fprintf(pFileData,"--CreaContour--\n");
        fprintf(pFileData,"Version %s\n", "1.0.3" );
        fprintf(pFileData,"OnePixelSize %f\n", _onePixelSize);
-
 //------------------------------------------------------------------------------------------------------------
-
        vtkImageData *image = _images[0];
-
        int dimRange[3];
        image->GetDimensions(dimRange);
-
        fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
-
        double spaRange[3];
        image->GetSpacing(spaRange);
-
        fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
-
        // Normal Contours
-
        lstNameThings           = kernelManager->GetLstNameThings();
        sizeLstNameThings       = lstNameThings.size();
        fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
-
 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
        fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings );
 //------------------------------------------------------------------------------------------------------------
-
-
 // EED 2017-05-30
        double spc[3];
        spc[0]=1; 
        spc[1]=1; 
-       spc[2]=1; 
-
+       spc[2]=1;
        for (i=0 ; i<sizeLstNameThings ; i++)
        {
 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
                manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
-
 // EED 2017-05-30
 //             double sizeInPixel = manualModel ->GetPathSize(  );
                double sizeInPixel = manualModel ->GetPathSize( spc );
-
                double realContourSize = sizeInPixel*_onePixelSize;
                manualModel ->SetRealSize(realContourSize);
 //------------------------------------------------------------------------------------------------------------
-
        //int size= kernelManager->GetLstNameThings().size();
-
                kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
                _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
        }// for i
-
        //-- Static Contours
-
 //     fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
 //     fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
-
        lstNameThings           = kernelManager->GetLstNameThingsStatic();
        sizeLstNameThings       = lstNameThings.size();
        fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
-
 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
        fprintf(pFileData,"NumberOfContoursStatic %d\n", sizeLstNameThings );
 //------------------------------------------------------------------------------------------------------------
-
        for (i=0 ; i<sizeLstNameThings ; i++)
        {
                kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
@@ -1740,10 +1727,6 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me
 
 void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
 {
-
-//printf("EED wxContourMainFrame::SegmentationOneSlice Start=%d  %d\n",sampling,method );
-//printf("EED wxContourMainFrame::SegmentationOneSlice %d %d %d  \n",x,y,z );
-
        int typeofcontour = 1;
        //--Extracting Contour
        vtkImageData    *imagedata      = getImageData();
@@ -2234,7 +2217,6 @@ int wxContourMainFrame::getWindowLevel()
 void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
 {
        _theViewPanel->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
-
        RefreshInterface();
 }
 
@@ -3087,7 +3069,6 @@ void wxContourMainFrame::onSnakePressed(){
 
 void wxContourMainFrame::saveFileWithContoursAutomatique()
 {
-printf("EED wxContourMainFrame::saveFileWithContoursAutomatique \n");
        std::string filename = kernelManager->getCurrentFileName();
        if(filename.compare("")!=0){
                saveFileWithContours(filename);
@@ -3095,22 +3076,19 @@ printf("EED wxContourMainFrame::saveFileWithContoursAutomatique \n");
                onSave();
        }
 }
+
 void wxContourMainFrame::ShowToolsPanel(bool show)
 {
        _pannew->Show(show);
 }
 
-
-
 void wxContourMainFrame::SetContourGroup(int contourGroup)
 {
        _contourGroup = contourGroup;
 }
 
-
 wxPanel *wxContourMainFrame::getMaskImageViewPanel(wxWindow *parent)
 {
        if      (_viewMaskImagePanel==NULL)
        {
                _contourextractdata = new ContourExtractData(true);