+void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface)
+{
+ char tmp[255];
+ char tmpD[255];
+ FILE *pFile =fopen(fileNameContourROI.c_str(),"r+");
+//CMRU 03-09-09- ----------------------------------------------------------------------------------------------
+ if(pFile != NULL)
+ {
+//------------------------------------------------------------------------------------------------------------
+ fileNameContourROI.append("data");
+ FILE *pFileData=fopen(fileNameContourROI.c_str(),"r+");
+ if(pFileData != NULL)
+ {
+ fscanf(pFileData,"%s",tmpD); // --CreaContour--
+ fscanf(pFileData,"%s",tmpD); // Version
+ fscanf(pFileData,"%s",tmpD); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
+
+ fscanf(pFileData,"%s",tmpD); // onePixelSize
+ fscanf(pFileData,"%s",tmpD); // #
+ _onePixelSize = atof(tmpD);
+ fscanf(pFileData,"%s",tmpD); // NumberOfContours
+ fscanf(pFileData,"%s",tmpD); // #
+ }
+
+ fscanf(pFile,"%s",tmp); // --CreaContour--
+
+ fscanf(pFile,"%s",tmp); // Version
+ fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
+ std::string version(tmp);
+
+
+printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() );
+
+
+ //AD:02-06-09
+ _tmpReadFileTypeOfTransformation=-1;
+ if (version=="1.0.3")
+ {
+ readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON
+ openContours(pFile,pFileData,false);
+ openContours(pFile,pFileData,true); //Load StaticContours
+ }
+
+ if (version=="1.0.2")
+ {
+//EED001
+ readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON
+ openContours(pFile,pFileData,false);
+ readDimSpc(pFile,false); // DimSpc interactive OFF
+ openContours(pFile,pFileData,true); // Load StaticContours
+ SetZForAllContours(-900);
+ }
+
+ //AD:02-06-09
+ else if (version=="1.0.1")
+ {
+ openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
+ openContours(pFile,pFileData,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
+ }
+
+ //AD:02-06-09
+ else if (version=="1.0.0")
+ {
+ openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
+ }
+
+ fclose(pFile);
+
+ if(pFileData != NULL)
+ {
+ fclose(pFileData);
+ } // if
+ }
+ _theViewPanel->getSceneManager()->removeSceneContours();
+ changeInstant();
+}
+
+
+void wxContourMainFrame::onImport()
+{
+ std::string filename, filenamecontours;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN );
+#else
+ wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxFD_OPEN );
+#endif
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ filename = dialog.GetPath().mb_str();
+ filenamecontours = kernelManager->parseOsirixFile(filename);
+
+ if(filenamecontours.compare("") != 0){
+ onLoadContours(filenamecontours,true);
+ } // if
+ } // if
+}
+
+void wxContourMainFrame::onTest()
+{
+ std::string filename, filenamecontours;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN );
+#else
+ wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
+#endif
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ filename = dialog.GetPath().mb_str();
+ std::cout << "This is the filename: " << filename << std::endl;
+ } // if
+}
+
+
+//AD: 29-05-09
+void wxContourMainFrame::onSave(){
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+ if(GetFileLocation().empty())
+ {
+//------------------------------------------------------------------------------------------------------------
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+ wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+#else
+ wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_SAVE );
+#endif
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+ kernelManager->setCurrentFileName(fileNameContourROI);
+ saveFileWithContours( fileNameContourROI );
+ }
+ }
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+ else
+ {
+ std::cout<<"Nombre del archivo: "<<GetFileLocation()<<std::endl;
+ std::string fileNameContourROI = GetFileLocation();
+ std::cout<<"Nombre del archivo: "<<fileNameContourROI<<std::endl;
+ kernelManager->setCurrentFileName(fileNameContourROI);
+ saveFileWithContours( fileNameContourROI);
+ }
+//------------------------------------------------------------------------------------------------------------
+}
+
+//AD: 29-05-09
+void wxContourMainFrame::saveFileWithContours( std::string filename )
+{
+
+ FILE *pFile=fopen(filename.c_str(),"w+");
+
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+ filename.append("data");
+ std::cout<<"Nombre del archivo: "<<filename<<std::endl;
+ FILE *pFileData=fopen(filename.c_str(),"w+");
+//------------------------------------------------------------------------------------------------------------
+
+ std::vector< std::string > lstNameThings;
+ int i,sizeLstNameThings;
+
+ fprintf(pFile,"--CreaContour--\n");
+ fprintf(pFile,"Version %s\n", "1.0.3" );
+
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+ 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;
+
+ 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 );