]> Creatis software - creaContours.git/commitdiff
Changes with manualBaseModel. It improves the functionality with the new
authorRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Tue, 13 Oct 2009 02:37:21 +0000 (02:37 +0000)
committerRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Tue, 13 Oct 2009 02:37:21 +0000 (02:37 +0000)
 points contour and some saving and loading aspects of the contours

23 files changed:
data/Icons/Letter.PNG [new file with mode: 0644]
data/Icons/Points.png [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfEditMenu.cxx
lib/Interface_Icons_NDimensions/interfEditMenu.h
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
lib/Interface_Icons_NDimensions/interfNewContourMenu.h
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h
lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h
lib/kernel_ManagerContour_NDimensions/ContourThing.cxx
lib/kernel_ManagerContour_NDimensions/ContourThing.h
lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx
lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h
lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx
lib/kernel_ManagerContour_NDimensions/OutlineModelManager.h

diff --git a/data/Icons/Letter.PNG b/data/Icons/Letter.PNG
new file mode 100644 (file)
index 0000000..791d0b7
Binary files /dev/null and b/data/Icons/Letter.PNG differ
diff --git a/data/Icons/Points.png b/data/Icons/Points.png
new file mode 100644 (file)
index 0000000..4f7e241
Binary files /dev/null and b/data/Icons/Points.png differ
index 878041200491b39f420e54f69775b3102c553b78..2aea2621f2396b86c0a4c493957bfae353212fb0 100644 (file)
@@ -30,6 +30,12 @@ void interfEditMenu::initButtons(wxEvtHandler* evtHandler) {
        nom.push_back("Redo  ctrl + y");
        funct.push_back((wxObjectEventFunction) &interfEditMenu:: onRedo);
 
+//CMRU 17-08-09 ------------------------------------------------------------------
+       path.push_back(datadir + "/Letter.PNG");
+       nom.push_back("Insert a Label");
+       funct.push_back((wxObjectEventFunction)&interfEditMenu::onPrintLabel);
+//-------------------------------------------------------------------------------
+
     this->addButtons(path, nom);
        this->setVectorFunction(funct);
 
@@ -54,6 +60,9 @@ void interfEditMenu::onUndo(wxCommandEvent& event){
 void interfEditMenu::onRedo(wxCommandEvent& event){
        interfMainPanel::getInstance()->onRedo();
 }
+void interfEditMenu::onPrintLabel(wxCommandEvent& event){
+       interfMainPanel::getInstance()->onPrintLabel();
+}
 
 interfEditMenu::~interfEditMenu()
 {
index 17582f096539cde8002e16042d4691629a5ec5fd..58100b51f1e46c8602fb6f1ecf920e91470baacc 100644 (file)
@@ -19,6 +19,7 @@ public:
        void onPaste(wxCommandEvent& event);
        void onUndo(wxCommandEvent& event);
        void onRedo(wxCommandEvent& event);
+       void onPrintLabel(wxCommandEvent& event);
        
 };
 
index 40456bf8f691ba68fffbc1038ab59ebedf7a9c90..b5da6290946a2b1fbfb180fe7a3fcf12ca8f0468 100644 (file)
@@ -35,7 +35,11 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        mirrorPanel                     = NULL;
        thresholdPanel          = NULL;
        currentWindow           = NULL;
-       
+
+//CMRU 17-08-09 ------------------------------------------------------------------
+       infoPanelCalibration = NULL;
+       panelAux = NULL;
+//--------------------------------------------------------------------------------
        splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T("")));
 
        splitterwindow->SetMinimumPaneSize( 10 );
@@ -106,11 +110,11 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);      
        infoPanel->SetSizer(infosizer, true);
        infoPanel->SetAutoLayout( true );       
-               
+
        splitterwindow->Initialize(toolpanel);
        splitterwindow->SetSashGravity(1);
        splitterwindow->SplitHorizontally(toolpanel, infoPanel);        
-               
+
        Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
@@ -349,6 +353,14 @@ void interfMainPanel::onCreateContourLine( ){
        wxContourMainFrame::getInstance()->showAxis(false);
     wxContourMainFrame::getInstance()->onCreateContourLine();
 }
+
+// RaC 09-09 ---------------------
+void interfMainPanel::onCreateContourPoints( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+    wxContourMainFrame::getInstance()->onCreateContourPoints();
+}
+// RaC 09-09 ---------------------
+
 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull){
        wxContourMainFrame::getInstance()->showAxis(false);
        wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
@@ -455,7 +467,6 @@ void interfMainPanel::onSegmentationPressedITK(){
                //wxPanel* panel = contourevent->getSegmentationPanelITK(segmentPanelITK);
                wxPanel* panel = new interfSegmentationPanelITK(segmentPanelITK);
        
-
                wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T("   Automatic ITK Segmentation   ")), wxDefaultPosition,
                        wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
 
@@ -578,11 +589,18 @@ void interfMainPanel::onInformationPressed(){
                        //contourevent->FillGridWithContoursInformation();
                        infoWin->Show(true);
                }
+       }
+               
+//CMRU 29-08-09----------------------------------------------------------------------------------------------- 
+       if(panelAux == NULL)
+       {
+               panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
        }       
-       
+//------------------------------------------------------------------------------------------------------------
+
        // mask view control panel
        if(infoPanelMask == NULL){
-               infoPanelMask = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
+               infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
                wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
                infoPanelMask->SetSizer(flexsizer, true);
                infoPanelMask->SetAutoLayout( true );   
@@ -597,7 +615,36 @@ void interfMainPanel::onInformationPressed(){
                infoPanelMask->Layout();
                
        }
-       showPanel(infoPanelMask);
+       
+//CMRU 29-08-09-----------------------------------------------------------------------------------------------
+       //Calibration panel
+       if(infoPanelCalibration == NULL)
+       {
+               infoPanelCalibration = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER , wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               infoPanelCalibration->SetSizer(flexsizer, true);
+               infoPanelCalibration->SetAutoLayout( true );    
+
+               wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
+               wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T("              Calibration               ")), wxDefaultPosition,
+                                                                                                 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+               
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               
+               flexsizer->Add(panel, wxEXPAND);
+               infoPanelCalibration->Layout();
+       }
+
+       wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
+       panelAux->SetSizer(sizer, true);
+       panelAux->SetAutoLayout( true );        
+       sizer->Add(infoPanelMask);
+       sizer->Add(infoPanelCalibration);
+       
+       showPanel(panelAux);
+
+//------------------------------------------------------------------
+
        wxContourMainFrame::getInstance()->changeInstant();
 }
 
@@ -758,3 +805,92 @@ void interfMainPanel::SetContourGroup(int contourGroup)
 {
        wxContourMainFrame::getInstance()->SetContourGroup( contourGroup);
 }
+
+//CMRU 17-08-09 ---------------------------------------------
+void interfMainPanel::onPrintLabel () 
+{
+       wxString label;
+       manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
+
+       if(manualModel==NULL)
+       {
+        wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+               dial->ShowModal();
+               return;
+       }
+
+       wxTextEntryDialog* dialog = new wxTextEntryDialog(this,"Enter a tag name: ") ;
+       
+       if (dialog->ShowModal() == wxID_OK)
+       {
+               label = dialog->GetValue(); 
+
+               if(label.Len()!=0)
+               {
+                       wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel);
+                       wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION);
+                       dial->ShowModal();
+               }
+               else
+               {
+                       wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+                       dial->ShowModal();
+               }
+       }
+}
+void interfMainPanel::onCalibration(wxString size, int unit)
+{
+       int type = 0;
+       double contourSize = 0.0; 
+       double realSizeDouble = 0.0;
+
+       type = wxContourMainFrame::getInstance()->getType(); 
+       contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
+
+       std::cout<<"Cata->TamaƱo del contorno en pixeles:"<<contourSize<<endl;
+       
+       if ( type == 6 ) 
+       {
+               if (size.ToDouble(&realSizeDouble))
+               {
+                       if(unit==1)
+                       {
+                               realSizeDouble = realSizeDouble * 10;
+                       }
+                       if(unit==2)
+                       {
+                               realSizeDouble = realSizeDouble * 25.4;
+                       }
+                       std::cout<< "Valor del usuario" << realSizeDouble<< endl ; 
+                       onePixelSize (realSizeDouble,contourSize);
+                }
+                else
+                {
+                       wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+                       dial->ShowModal();
+                }              
+       }
+       else 
+       {
+       
+               wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+               dial->ShowModal();
+       }
+       
+       wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
+       dial->ShowModal();
+       std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
+}
+
+double interfMainPanel::onePixelSize (double realSize,double sizePixel) 
+{
+       _pixelValue = realSize/sizePixel;
+       std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
+       wxContourMainFrame::getInstance()->onePixelSize (_pixelValue);
+       return _pixelValue ;
+}
+double interfMainPanel::GetPixelValue()
+{
+       return _pixelValue;
+}
+//------------------------------------------------------------------------------------------------------------
\ No newline at end of file
index 9c3868d46186cde815975b6cb0955a127b985323..460fbf26c5cb5c537c5ee5bbf1fb359571103c95 100644 (file)
@@ -95,6 +95,11 @@ public:
        void onCreateContourRectangle( );
        void onCreateContourCircle( );
        void onCreateContourLine( );
+       
+       // RaC 09-09 ---------------------
+       void onCreateContourPoints( );
+       // RaC 09-09 ---------------------
+       
        void onCreateContoursBullEye(wxPanel* panBull);
        /////////////////////////////////
        void onDeleteContour();
@@ -157,6 +162,34 @@ public:
        void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
        void SetContourGroup(int contourGroup);
 
+//CMRU 29-08-09-----------------------------------------------------------------------------------------------
+       
+       /**
+       * Associates the current selected contour with a label
+       */
+       void onPrintLabel();
+       
+       
+       /**
+       * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
+       * @param size Size in milimeters of the selected contour
+       * @param unit Measurement unit
+       */
+       void onCalibration(wxString size, int unit);
+       
+       /**
+       * Calculate the pixel value in milimeters
+       * @param realSize Size of the contour in milimeters
+       * @param sizePixel Size of the contour in pixels
+       */
+       double onePixelSize (double realSize,double sizePixel);
+       
+       /**
+       * Returns the value of a pixel in milimeters
+       */
+       double GetPixelValue();
+//------------------------------------------------------------------------------------------------------------
+
 private:
        
 
@@ -177,6 +210,24 @@ private:
        wxPanel* infoPanel;
        wxPanel* infoPanelMask;
 
+//CMRU 17-08-09 ------------------------------------------------------------------
+       
+       /**
+       * Panel with the calibration options
+       */
+       wxPanel* infoPanelCalibration;
+       
+       /**
+       * Panel who contains the calibration panel and the information panel mask
+       */
+       wxPanel* panelAux;
+
+       /**
+       * Value of a pixel in milimeters
+       */
+       double _pixelValue; 
+//--------------------------------------------------------------------------------
+
        wxStaticText* statictext;
        wxStaticText* statictext1;
        wxStaticText* statictext2;
index 42d97ba3822036ad0b2c91eebc167689a04edf08..35cb02bfd61a3b774ecb2a6f11092817d5007383 100644 (file)
@@ -43,12 +43,14 @@ void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) {
        nom.push_back("Create a Line");
        funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine);
        hand.push_back(this);
-/*
-       path.push_back(datadir + "/Line.png");
+
+       // RaC 09-09 ---------------------
+       path.push_back(datadir + "/Points.png");
        nom.push_back("Create Points");
        funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints);
        hand.push_back(this);
-*/     
+       // RaC 09-09 ---------------------      
+
     this->addButtons(path, nom);
 
        this->setVectorFunction(funct); 
@@ -90,9 +92,10 @@ void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ){
 void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ){
        interfMainPanel::getInstance()->onCreateContourLine();
 }
-/*
+
+// RaC 09-09 ---------------------
 void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event ){
-       interfMainPanel::getInstance()->onCreateContourLine();
+       interfMainPanel::getInstance()->onCreateContourPoints();
 }
-*/
+// RaC 09-09 ---------------------
 
index 21c1b5a7430e608f589f4995862ed2e133b644d8..3584d955b8ae89834723484b9ae67328241bf663 100644 (file)
@@ -46,7 +46,10 @@ private:
        **/
        void onCreateContourLine( wxCommandEvent& event );
        
-       //void onCreateContourPoints( wxCommandEvent& event );
+       /**
+       **      This method is in charge of capturing the event when the button is clicked
+       **/
+       void onCreateContourPoints( wxCommandEvent& event );
        
 };
 
index a93ae0ac3de1118b2706233fcc699ccf16c0d35e..c4a05d0dbfc2700017249bbbfa1780468b681683 100644 (file)
@@ -455,3 +455,44 @@ void interfInformationPanel::onContourGroup(wxCommandEvent& event)
        interfMainPanel::getInstance()->SetContourGroup( _radiolstboxContourGroup->GetSelection() );    
 }
 
+//CMRU 29-08-09-----------------------------------------------------------------------------------------------
+interfCalibrationPanel:: interfCalibrationPanel(wxWindow * parent)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+{
+       double range[2];
+       interfMainPanel::getInstance()->getImageRange(range);
+
+       //Radio buttons
+       wxString options[3];
+       options[0]=_T("mm");
+       options[1]=_T("cm");
+       options[2]=_T("inch");
+
+       _unitsRadiobox = new wxRadioBox(this, -1, _T("Unit of measurement"), wxPoint(2, 25), wxSize(145,45), 3 , options,  3, wxRA_SPECIFY_COLS);
+       _unitsRadiobox->SetSelection(0);
+       
+       //The label
+       new wxStaticText(this, wxID_ANY, wxT("Real Size: "),   wxPoint(2, 5));
+       
+       //Text Control
+       _size = new wxTextCtrl(this, wxID_ANY, wxT(""),  wxPoint(78,3),   wxSize(70, 20), 0, wxDefaultValidator, wxTextCtrlNameStr);
+       
+       //The button
+       new wxButton(this, 1, wxT("Calibrate"), wxPoint(78, 70), wxSize(70, 25), 0, wxDefaultValidator, wxT("button"));
+
+       //Conexion del boton con su respectivo manejador
+       Connect(1, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfCalibrationPanel::onCalibrate);
+       
+}
+
+interfCalibrationPanel:: ~interfCalibrationPanel()
+{
+}
+
+void interfCalibrationPanel::onCalibrate(wxCommandEvent& event)
+{
+       wxString size =_size->GetValue();
+       int unit = _unitsRadiobox->GetSelection();
+       interfMainPanel::getInstance()->onCalibration(size, unit);
+}
+//------------------------------------------------------------------------------------------------------------
\ No newline at end of file
index 093349ed4bbde8eeacd6d03db7089261cd8a3fec..e0784f26d5b63e2297846a25b69557d6e9871062 100644 (file)
@@ -92,7 +92,41 @@ private:
        
                
 };
+//CMRU 29-08-09-----------------------------------------------------------------------------------------------
+/**
+* This class represents the calibration panel in the interface icons
+*/
+class interfCalibrationPanel
+       : public wxPanel
+{
+public:
+
+       /**
+       * Initialized the panel
+       * @param parent Window who contains the panel
+       */
+       interfCalibrationPanel(wxWindow * parent);      
+
+       ~interfCalibrationPanel();
 
+       /**
+       * Manages the event associated with the button of calibration
+       */
+       void onCalibrate(wxCommandEvent& event);
+
+private:
+
+       /**
+       * Text field of the calibration measure
+       */
+       wxTextCtrl * _size;
+
+       /**
+       * Radio Box with the measurement units
+       */
+       wxRadioBox * _unitsRadiobox;
+};
+//------------------------------------------------------------------------------------------------------------
 #endif
  
  
index 5596ea4a2b6c5a9c4871ebac77672f5014fe4480..41a380463ed91a7f30274c5cbc61635ffa5b6293 100644 (file)
@@ -15,7 +15,8 @@
 #include "ConceptDataWrap.h"
 #include <creaWx.h>
 
-
+#include <string>
+using namespace std;
 
 //----------------------------------------------------------------------------------------------------------------
 // Class implementation
@@ -336,12 +337,21 @@ void wxContourMainFrame::onCreateContourLine( ){
        createContour( 6 );
 }
 
+// RaC 09-09 --------------------------------------
+void wxContourMainFrame::onCreateContourPoints( ){
+    //JCP 20-10-08 Undo redo implementation
+       saveState();
+       //JCP 20-10-08 Undo redo implementation 
+       createContour( 7 );
+}
+// RaC 09-09 --------------------------------------
+
 //------------------------------------------------------------------------------------------------------------
 
 void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel )
 {
-       //Creating the manualContourModel and including in the model
-       manualContourModel * manModelContour = factoryManualContourModel(panel );
+       //Creating the manualBaseModel and including in the model
+       manualBaseModel * manModelContour = factoryManualContourModel(panel );
 
        std::vector<int> instantVector;
        _instantPanel->getInstant( instantVector );
@@ -366,8 +376,7 @@ void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel )
 void wxContourMainFrame :: createContour( int typeContour )
 {
        //Creating the manualContourModel and including in the model
-       manualContourModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
-
+       manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
 
        std::vector<int> instantVector;
        _instantPanel->getInstant( instantVector );
@@ -389,10 +398,10 @@ void wxContourMainFrame :: createContour( int typeContour )
        }       
 
 }
-manualContourModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
+manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
 
        manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
-       manualContourModel *manModelContour=NULL;
+       manualBaseModel *manModelContour=NULL;
        manModelContour = manModelContourBullEye;
        if (panel!=NULL){
                int iCrown,sizeCrowns,iSector,sizeSectors;
@@ -753,7 +762,7 @@ void wxContourMainFrame::onRedo(){
 void wxContourMainFrame :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
 {
        std::string cloneName = kernelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
-       manualContourModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
+       manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
        _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
 }
 
@@ -761,7 +770,7 @@ void wxContourMainFrame :: createCopyContourOf ( std::string anExistingKName, st
 void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
 {
        std::string cloneName = kernelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
-       manualContourModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
+       manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
 
        manualPoint * refPoint1 = _refLineModel->GetManualPoint(0);
        manualPoint * refPoint2 = _refLineModel->GetManualPoint(1);
@@ -840,7 +849,7 @@ void wxContourMainFrame ::loadContours( FILE *pFile, bool staticContour )
 
        std::vector<int> instantVector;
        int typeContourModel;
-       manualContourModel *manModelContour;
+       manualBaseModel *manModelContour;
        int typeView;
 
        int i;
@@ -896,11 +905,41 @@ void wxContourMainFrame ::loadContours( FILE *pFile, bool staticContour )
 void wxContourMainFrame::onLoad()
 {
        char tmp[255];
-       wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
-       if (dialog.ShowModal() == wxID_OK)
+       char tmpD[255];
+       std::string fileNameContourROI = GetFileLocation();
+
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+       if(GetFileLocation().empty())
+       {
+//------------------------------------------------------------------------------------------------------------
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
+               if (dialog.ShowModal() == wxID_OK)
+               {
+                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+               }
+       }
+
+       FILE *pFile =fopen(fileNameContourROI.c_str(),"r+");
+
+
+//CMRU 03-09-09- ----------------------------------------------------------------------------------------------
+       if(pFile != NULL)
        {
-               std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-               FILE *pFile=fopen(fileNameContourROI.c_str(),"r+");
+//------------------------------------------------------------------------------------------------------------
+        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.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--
 
@@ -911,24 +950,29 @@ void wxContourMainFrame::onLoad()
                //AD:02-06-09
                if (version=="1.0.2")
                {
-                       openContours(pFile,2,false);
-                       openContours(pFile,2,true);     //Load StaticContours
+                       openContours(pFile,pFileData,2,false);
+                       openContours(pFile,pFileData,2,true);   //Load StaticContours
                }
                
                //AD:02-06-09
                else if (version=="1.0.1")
                {
-                       openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
-                       openContours(pFile,1,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
+                       openContours(pFile,pFileData,1,false); //Skips ImageDimensions and ImageSpacing
+                       openContours(pFile,pFileData,1,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
                }
                
                //AD:02-06-09
                else if (version=="1.0.0")
                {
-                       openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
+                       openContours(pFile,pFileData,1,false); //Skips ImageDimensions and ImageSpacing
                }
 
                fclose(pFile);
+
+               if(pFileData != NULL)
+               {
+                       fclose(pFileData);
+               }
        }
        _theViewPanel->getSceneManager()->removeSceneContours();
        changeInstant();
@@ -936,13 +980,28 @@ void wxContourMainFrame::onLoad()
 
 //AD: 29-05-09
 void wxContourMainFrame::onSave(){
-       wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
-       if (dialog.ShowModal() == wxID_OK)
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+       if(GetFileLocation().empty())
        {
-               std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+//------------------------------------------------------------------------------------------------------------
+               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
+               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 );
+               saveFileWithContours( fileNameContourROI);
        }
+//------------------------------------------------------------------------------------------------------------
 }
 
 //AD: 29-05-09
@@ -950,11 +1009,26 @@ 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.2" );
+
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+       fprintf(pFileData,"--CreaContour--\n");
+       fprintf(pFileData,"Version %s\n", "1.0.2" );
+       fprintf(pFileData,"OnePixelSize %f\n", _onePixelSize);
+       std::cout<<"Valor de un pixel: "<<_onePixelSize<<std::endl;             
+       
+//------------------------------------------------------------------------------------------------------------
        
        vtkImageData *image = _images[0];
 
@@ -974,9 +1048,22 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
        sizeLstNameThings       = lstNameThings.size(); 
        fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
 
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+       fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings );
+//------------------------------------------------------------------------------------------------------------
+
        for (i=0 ; i<sizeLstNameThings ; i++) 
        {
-               kernelManager->SaveThingName( pFile, lstNameThings[i] );
+//CMRU 03-09-09-----------------------------------------------------------------------------------------------
+               manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
+               double sizeInPixel = manualModel ->GetPathSize();
+               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
 
@@ -989,16 +1076,22 @@ void wxContourMainFrame::saveFileWithContours( std::string filename )
        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, lstNameThings[i] );
+               kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
                _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
        }// for i
        fclose(pFile);
+       fclose(pFileData);
 }
 
 //AD:04-06-09
-void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticContour )
+void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, int version, bool staticContour )
 {
        char tmp[255];
        
@@ -1045,7 +1138,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticCont
 
        std::vector<int> instantVector;
        int typeContourModel;
-       manualContourModel *manModelContour;
+       manualBaseModel *manModelContour;
        int typeView;
 
        if (compatible==true)
@@ -1076,6 +1169,10 @@ void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticCont
 
                        manModelContour =  kernelManager->factoryManualContourModel(typeContourModel);
                        manModelContour->Open(pFile);
+                       if(pFileData != NULL)
+                       {
+                               manModelContour->OpenData(pFileData);
+                       }
 
                        fscanf(pFile,"%s",tmp); // TypeView
                        fscanf(pFile,"%s",tmp); // ##
@@ -1158,7 +1255,10 @@ void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticCont
 
                        manModelContour =  kernelManager->factoryManualContourModel(typeContourModel);
                        manModelContour->Open(pFile);
-
+                       if(pFileData != NULL)
+                       {
+                               manModelContour->OpenData(pFileData);
+                       }
                        if (transform==true)
                        {
                                if (typeOfTransformation==0)
@@ -1579,7 +1679,7 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d
 
        int j,sizeCtrPt = vecCtrlPointX.size();
        
-       manualContourModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
+       manualBaseModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
        manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
        if (sizeCtrPt>=3){
                for (j=0 ; j<sizeCtrPt ; j++)
@@ -1823,7 +1923,7 @@ myfile.close();
        actualInstantVector[1]=z;
 
        int j,sizeCtrPt = vecCtrlPointX.size();
-       manualContourModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
+       manualBaseModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
        manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
        if (sizeCtrPt>=3){
                for (j=0 ; j<sizeCtrPt ; j++)
@@ -2162,7 +2262,7 @@ void wxContourMainFrame::onSpreadGo(int type){
 
                int typeofcontour = 1;
                std::string theName;
-               manualContourModel* manModelContour = kernelManager->GetPoints(z, type, &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ, theName,typeofcontour, tempVector);
+               manualBaseModel* manModelContour = kernelManager->GetPoints(z, type, &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ, theName,typeofcontour, tempVector);
 
                if( manModelContour!=NULL ){
                        double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
@@ -2206,9 +2306,9 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
        
        _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
-       std::vector<manualContourModel*> lstManConMod;
-       std::vector<manualContourModel*> lstManConModTmp;
-       std::vector<manualContourModel*> lstManConModExp;
+       std::vector<manualBaseModel*> lstManConMod;
+       std::vector<manualBaseModel*> lstManConModTmp;
+       std::vector<manualBaseModel*> lstManConModExp;
        std::vector<double> pLstValue;
        std::vector<double> pLstValuePosX;
        std::vector<double> pLstValuePosY;
@@ -2276,8 +2376,8 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                        ContourThing **contourthing = lstContourThings[ii];
                        lstManConMod.push_back( (*contourthing)->getModel() );
                }
-               lstManConModExp =  kernelManager->ExploseEachModel( lstManConMod );
 
+               lstManConModExp =  kernelManager->ExploseEachModel( lstManConMod );
 
                tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
                interfMainPanel::getInstance()->setRowLabelInfoPanel(z, tempString);
@@ -2298,10 +2398,11 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
 
                int tmpIntA;
 
-
-
                for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
                        lstManConModTmp.clear();
+
+                       
+
                        if (typeContourGroup==3) // contour separete
                        {
                                lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
@@ -2319,6 +2420,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel
                                                                                                                &pLstValuePosX,
                                                                                                                &pLstValuePosY,
                                                                                                                &pLstValuePosZ);
+
                        // Statistics of each slice.
                        _contourextractdata->Statistics( &pLstValue,
                                                                                        grayRangeMin,
@@ -2508,9 +2610,9 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil
        //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
        _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
-       std::vector<manualContourModel*> lstManConMod;
-       std::vector<manualContourModel*> lstManConModTmp;
-       std::vector<manualContourModel*> lstManConModExp;
+       std::vector<manualBaseModel*> lstManConMod;
+       std::vector<manualBaseModel*> lstManConModTmp;
+       std::vector<manualBaseModel*> lstManConModExp;
        std::vector<double> pLstValue;
        std::vector<double> pLstValuePosX;
        std::vector<double> pLstValuePosY;
@@ -2638,9 +2740,9 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value
        }
        _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
 
-       std::vector<manualContourModel*> lstManConMod;
-       std::vector<manualContourModel*> lstManConModTmp;
-       std::vector<manualContourModel*> lstManConModExp;
+       std::vector<manualBaseModel*> lstManConMod;
+       std::vector<manualBaseModel*> lstManConModTmp;
+       std::vector<manualBaseModel*> lstManConModExp;
 
        std::vector<int> tempVector;
        _instantPanel->getInstant( tempVector );
@@ -2882,8 +2984,82 @@ wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
        return _viewThresholdImagePanel;
 }
 
+//CMRU 17-08-09-----------------------------------------------------------------------------------------------
+int wxContourMainFrame::getType ()
+{
+       int tipo = 0;
+       std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
+
+       if(!currentSelection.empty())
+       {
+               std::string cloneName = currentSelection [0];
+               manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
+               tipo = manualModel-> GetTypeModel();    
+               return tipo;
+       }
+}
+double wxContourMainFrame::getContourSizeInPixels()
+{
+       double contourSize = 0; 
+
+       std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();        if(!currentSelection.empty())
+       if(!currentSelection.empty())
+       {
+               std::string cloneName = currentSelection [0];
+               
+               manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
+               contourSize = manualModel-> GetPathSize();
+       }       
+       return contourSize;
+}
+manualBaseModel * wxContourMainFrame::getContour ()
+{
+       std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
+
+       if(!currentSelection.empty())
+       {
+               std::string cloneName = currentSelection [0];
+               manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
+               return manualModel; 
+       }
+       return NULL;
+}
+void wxContourMainFrame::onPrintLabel (wxString label, manualBaseModel* manualModel) 
+{
+       std::string labelAscii(label.ToAscii());
+       int pos = labelAscii.find(" ");
 
+       int j;
+       
+       for (j=0 ; pos != string::npos;j++) 
+       {
+               labelAscii.replace( pos, 1, "_" );
+               pos= labelAscii.find(" ");
+       }
 
+       manualModel -> SetLabel(labelAscii); 
+}
+void wxContourMainFrame::onInsertCalculation(manualBaseModel* manualModel)
+{
+       double sizeInPixel = manualModel ->GetPathSize();
+       double onePixelRealSize = interfMainPanel::getInstance()->GetPixelValue();;
+       double realContourSize = sizeInPixel*onePixelRealSize;
+       manualModel ->SetRealSize(realContourSize); 
+}
 
+double wxContourMainFrame::onePixelSize( double value)
+{
+       return _onePixelSize = value;   
+}
 
+std::string wxContourMainFrame::GetFileLocation()
+{
+       return _fileLocation;
+}
 
+void wxContourMainFrame::SetFileLocation(std::string newFileLocation)
+{
+       _fileLocation = newFileLocation;
+       std::cout<<"GETFILELOCATION:"<<_fileLocation<<std::endl;
+}
+//------------------------------------------------------------------------------------------------------------
\ No newline at end of file
index 00f9ec2b539bfda3b6ad96d0da6b1a4cdccddcf7..21004c63d2766ea2574c70b14570e4264da9cca0 100644 (file)
@@ -189,6 +189,7 @@ class wxContourMainFrame : public wxPanel {
        static wxContourMainFrame* getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style  = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, std::string datadir="C:/Creatis/creaContoursBin/RelWithDebInfo/");
        static wxContourMainFrame* getInstance();
        static void resetInstance();
+
        //------------------------------------------------------------------------------------------------------------
        //  Other functional methods
        //------------------------------------------------------------------------------------------------------------
@@ -206,6 +207,7 @@ class wxContourMainFrame : public wxPanel {
        void onCreateContourRectangle( );
        void onCreateContourCircle( );
        void onCreateContourLine( );
+       void onCreateContourPoints( );
        void onCreateContourBullEye(wxPanel* pan);
        /////////////////////////////////
        void onDeleteContour();
@@ -241,7 +243,7 @@ class wxContourMainFrame : public wxPanel {
        void onLoad();
        void onSave();
        
-       void openContours( FILE *pFile, int version, bool staticContour );
+       void openContours( FILE *pFile, FILE *pFileData, int version, bool staticContour );
 
        void RefreshInterface();
 
@@ -293,6 +295,10 @@ class wxContourMainFrame : public wxPanel {
 
        std::vector<std::string> getOutlinesName(int slide);
 
+       //
+       //
+       // @param typeContourGroup - int The operation id (AND,OR,XOR,ALL=3)
+       //
        void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax);
 
        void onSaveResults(std::string directory,std::string namefile, std::string filename, 
@@ -314,6 +320,56 @@ class wxContourMainFrame : public wxPanel {
        void SetContourGroup(int contourGroup);
        wxPanel *getThresholdImageViewPanel(wxWindow *parent);
 
+
+//CMRU 17-08-09-----------------------------------------------------------------------------------------------
+
+       /**
+       * Associates the String parameter with the contour
+       * @param label Label entered by the user 
+       * @param manualBaseModel Currently selected contour 
+       */
+       void onPrintLabel (wxString label, manualBaseModel* manualModel);
+
+       /**
+       * Calculates the size of the contour received as a parameter. Uses the measure of a pixel in millimeters. 
+       * @param manualBaseModel Currently selected contour 
+       */
+       void onInsertCalculation(manualBaseModel* manualModel);
+
+       /**
+       * Assigns and returns the value of a pixel in millimeters 
+       @ param value Measure of the pixel in millimeters
+       */
+       double onePixelSize(double value);
+
+       /**
+       * Returns the type of the currently selected contour
+       */
+       int getType();
+       
+       /**
+       * Returns the size in pixels of the currently selected contour 
+       */
+       double getContourSizeInPixels();
+       
+       /**
+       * Returns the currently selected contour. If no contour is selected returns NULL 
+       */ 
+       manualBaseModel* getContour();
+       
+       /**
+       * Returns the Path of the data persistence file
+       */
+       std::string GetFileLocation();
+       
+       /**
+       * Assign a new path to the data persistence file
+       @ param newFileLocation New path of the file 
+       */
+       void SetFileLocation(std::string newFileLocation);
+//------------------------------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------------------------------
        
 private:
        //------------------------------------------------------------------------------------------------------------
@@ -382,7 +438,7 @@ private:
 
        //manualContourModel * factoryManualContourModel(int typeContour);
 
-       manualContourModel * factoryManualContourModel(wxPanel* panel);
+       manualBaseModel * factoryManualContourModel(wxPanel* panel);
        
        ContourExtractData      *_contourextractdata;
 
@@ -400,6 +456,15 @@ private:
 
        static char COPY;
 
+//CMRU 17-08-09-----------------------------------------------------------------------------------------------
+       wxWindow *infoWin2;
+       wxPanel *calibrationPanel;
+       wxPanel *calibrationPanelError;
+       double _onePixelSize;
+       std::string _imageLocation;
+       std::string _fileLocation;
+//------------------------------------------------------------------------------------------------------------
+
 };
 
 #endif 
index 4bfd0fd4b890a3ed125b310877797798a54e341d..a3611aaffffff8bb25f559dbcdfff15324e53003 100644 (file)
@@ -753,7 +753,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                return _sceneManager->GetImageData();
        }
 
-       void wxContourViewPanel::configureViewControlTo(std::string theName,manualContourModel* manModelContour,double* spc,int typeofcontour){
+       void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour){
                _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
        }
 
@@ -786,8 +786,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){
                wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
                vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-               imageviewer->SetColorWindow(colorwindow);
-               imageviewer->SetColorLevel(windowlevel);        
+               //AMP//imageviewer->SetColorWindow(colorwindow);
+               //AMP//imageviewer->SetColorLevel(windowlevel); 
        }
 
        void wxContourViewPanel::onInterpolation(bool interpolate){
index 660df4fdc86b88a00fdc6b6bfaff9a34ba1d2f59..4b688478afa05f0f15330f341ce184eef9d25c7c 100644 (file)
@@ -307,7 +307,7 @@ class wxContourViewPanel : public wxPanel {// public wxScrolledWindow {
 
        vtkImageData* getImageData();
 
-       void configureViewControlTo(std::string theName,manualContourModel* manModelContour,double* spc,int typeofcontour);
+       void configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour);
 
        int GetImageDataSizeZ();
 
index 4e14484d72f53506ff2cc54958fa80fd9b588946..ea1cfeaf9a1180866d618e6e63f90d2c61e33758 100644 (file)
@@ -134,8 +134,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHOOSER_CHANGE )
                int value = _lastConceptUpdated->getActualValue();
                int min = _lastConceptUpdated->getMinValue();
                int max = _lastConceptUpdated->getMaxValue();
-               int delta = (int) (pow((double) 2,(double) _resolutionSlider->GetValue() ));
-
+               int delta = (int) (pow( 2, _resolutionSlider->GetValue() ));
                int minTmp   = value - delta/2;
                int maxTmp   = value + delta/2;
                if (minTmp<min)
@@ -389,7 +388,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHOOSER_CHANGE )
                int value = theConceptToUpdate->getActualValue();
                int min = theConceptToUpdate->getMinValue();
                int max = theConceptToUpdate->getMaxValue();
-               int delta = (int) (pow( (double)2, (double)_resolutionSlider->GetValue() ));
+               int delta = (int) (pow( 2, _resolutionSlider->GetValue() ));
                int minTmp   = value - delta/2;
                int maxTmp   = value + delta/2;
                if (minTmp<min)
index 5aabd85529be24397810b43f5488869125ecfe59..a6ceb2031d5c4e066156fdea94fceed86d685b58 100644 (file)
@@ -124,7 +124,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                return _wxVtk_BaseView;
        }
        //------------------------------------------------------------------------------------------------------------
-       void wxVtkBaseView_SceneManager :: configureViewControlTo( std::string theKeyName, manualContourModel * manModelContour, double * spc,int typeContour)
+       void wxVtkBaseView_SceneManager :: configureViewControlTo( std::string theKeyName, manualBaseModel * manModelContour, double * spc,int typeContour)
        {
                //setControlActiveStateOfALL( false );
                _creatingROI = true;
@@ -142,6 +142,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                manualViewBaseContour           *manViewerContour;
 
                // Creating the view manualViewContour and the manualContourControler
+               // NOTE: The model is created in the KernelManagerContour class, factoryManualContourModel method
                if (typeContour==1)
                {
                        manContourControl       = new manualContourControler();
@@ -171,6 +172,11 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                        manContourControl       = new manualLineControler();
                        manViewerContour        = new manualViewLine();
                }
+               if (typeContour==7)
+               {
+                       manContourControl       = new manualContourControler();
+                       manViewerContour        = new manualViewPoints();
+               }
 
 
 
@@ -328,7 +334,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
        //  Other functional methods
        //------------------------------------------------------------------------------------------------------------
 
-       void wxVtkBaseView_SceneManager :: createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append )
+       void wxVtkBaseView_SceneManager :: createCopyContourOf( std::string anExistingKName, std::string cloneName, manualBaseModel * manualModel, bool append )
        {
                if ( !append )
                {
@@ -340,7 +346,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
 
                iter = _contours_ViewControl->find( anExistingKName );
 
-               manualContourModel                      *cModule        = manualModel;
+               manualBaseModel                 *cModule        = manualModel;
                manualViewBaseContour           *cViewer        = iter->second->getViewer()->Clone();
                manualContourBaseControler      *cControl       = iter->second->getControler()->Clone(  );
 
@@ -1109,7 +1115,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                if (currentSelection.size()>=1){
                        
                        manualContourBaseControler *cControler  = this->getControlerOf( currentSelection[0] );
-                       manualContourModel *cModel                              = cControler->GetManualContourModel();
+                       manualBaseModel *cModel                         = cControler->GetManualContourModel();
                        int i,size = cModel->GetNumberOfPointsSpline();
                        double x,y,z;
                        for (i=0; i<size; i++) 
index d4f5bc26ddb0c5aa30d78e70484363fd5ce4df65..2dafb31c8e49ccd3457bbfa0e1dec6b848ec40c8 100644 (file)
@@ -33,6 +33,7 @@
 #include "manualViewBullEye.h"
 #include "manualViewCircle.h"
 #include "manualViewLine.h"
+#include "manualViewPoints.h"
 #include "manualViewRoi.h"
 #include <wx/event.h>
 
@@ -92,7 +93,25 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
        void setWxVtkViewBase( wxVtkBaseView * theBaseView );
        void setWxEventHandler( wxEvtHandler * theEventHandler );
        wxVtkBaseView * getWxVtkViewBase();
-       void configureViewControlTo( std::string theKeyName, manualContourModel * manContourControl, double * spc ,int typeContour);
+
+       //
+       // Method which creates and associates view and controller to the contour model type pointed in parameter.
+       // The possible contour types are:
+       // 0-spline
+       // 1-spline
+       // 2-rectangle
+       // 3-circle
+       // 4-BullEye
+       // 5-BullEyeSector
+       // 6-Line
+       // 7-Points
+       // NOTE: The model is created in the KernelManagerContour class, factoryManualContourModel method
+       // @param typeContour - int
+       // @param theKeyName - string
+       // @param manContourControl - manualBaseModel
+       // @param spc - double*  3-pos Array 
+       void configureViewControlTo( std::string theKeyName, manualBaseModel * manContourControl, double * spc ,int typeContour);
+
        void configureSelectionROI( double * spc );
        ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour ); 
        void desconfigureViewControlOf( std::string theKeyName );
@@ -116,7 +135,7 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
        //  Other functional methods
        //------------------------------------------------------------------------------------------------------------
 
-       void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append = false );
+       void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualBaseModel * manualModel, bool append = false );
        void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
        void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
        void removeSceneContours( );
@@ -211,7 +230,7 @@ private:
        bool                                    _drawingSelectionROI;
        manualRoiControler              *_controlerSelectionROI;
        manualViewRoi                   *_viewerSelectionROI;
-       manualContourModel              *_modelSelectionROI;
+       manualBaseModel         *_modelSelectionROI;
        double                                  _widthOfContour;
 
        bool _ctrlKey;
index aa8747804e4f7b2972242de093205f522d2e48cd..648ee8828e08d0d16d64102cf85cc38b554903b1 100644 (file)
@@ -16,7 +16,7 @@
        /*
        * Creates a ContourThing 
        */
-       ContourThing :: ContourThing(manualContourModel * model)
+       ContourThing :: ContourThing(manualBaseModel * model)
        {
                setModel( model );
        }
                outlineName = aName;
        }
 
-       manualContourModel * ContourThing ::getModel()
+       manualBaseModel * ContourThing ::getModel()
        {
                return theModel;
        }
 
-       void ContourThing :: setModel(manualContourModel * model)
+       void ContourThing :: setModel(manualBaseModel * model)
        {
                theModel = model;
        }
index 80e3e8a06529f98f7d9e9d7f9654381c18a528fe..45b2f08c960703874a61ff830f52ec40c9a775a2 100644 (file)
@@ -22,7 +22,7 @@ public:
        /*
        * Creates a ContourThing 
        */
-       ContourThing(manualContourModel * model);
+       ContourThing(manualBaseModel * model);
 
        /*
        * Destroys a ContourThing 
@@ -43,9 +43,9 @@ public:
        void setName(std::string  aName);
 
        
-       manualContourModel * getModel();
+       manualBaseModel * getModel();
 
-       void setModel(manualContourModel * model);
+       void setModel(manualBaseModel * model);
 
        /*
        * Executes the given command if posible and returns is posible or not
@@ -73,6 +73,6 @@ private:
 
        std::string outlineName;
 
-       manualContourModel * theModel;
+       manualBaseModel * theModel;
 };
 #endif
index 9d3f861c36c4e01e4ab0f245637e629d87b91f11..236e4a5556eb41acffe248539567a397581bd632 100644 (file)
@@ -130,7 +130,7 @@ OutlineModelManager* KernelManagerContour::getOutlineModelManager(){
        return modelManager;
 }
 
-std::string KernelManagerContour::createOutline(manualContourModel * manModelContour,std::vector<int> instantVector){
+std::string KernelManagerContour::createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector){
        return modelManager->createOutline( manModelContour, instantVector );
 }
 
@@ -153,8 +153,8 @@ std::vector<std::string> KernelManagerContour::GetLstNameThingsStatic(){
        return modelManager->GetLstNameThingsStatic();
 }
 
-void KernelManagerContour::SaveThingName(FILE* pFile, std::string name ){
-       modelManager->SaveThingName(pFile, name);
+void KernelManagerContour::SaveThingName(FILE* pFile, FILE *pFileData, std::string name ){
+       modelManager->SaveThingName(pFile, pFileData, name);
 }
 std::vector<std::string> KernelManagerContour::GetLstNameThings(){
        return modelManager->GetLstNameThings();
@@ -168,7 +168,7 @@ bool KernelManagerContour::IsPartOfStaticList(std::string theKeyName){
 }
 
 void KernelManagerContour::deleteCModel(std::string theKeyName){
-       manualContourModel* cModel              = modelManager->getOutlineByKeyName(theKeyName)->getModel();
+       manualBaseModel* cModel         = modelManager->getOutlineByKeyName(theKeyName)->getModel();
        modelManager->removeOutline( theKeyName );
 
        delete cModel;
@@ -207,7 +207,7 @@ std::string KernelManagerContour::createCopyContourOf ( std::string anExistingKN
 {
        return modelManager->createCopyContourOf(anExistingKName, instantNoTouchData);
 }
-manualContourModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName){
+manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName){
        return modelManager->getOutlineByKeyName (cloneName )->getModel();
 }
 
@@ -314,11 +314,11 @@ void KernelManagerContour::CalculeSplinePropagation(){
        _contourPropagation->CalculeSplinePropagation();
 }
 
-manualContourModel* KernelManagerContour::GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector){
+manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector){
     
        
        bool addedModel = false;
-       manualContourModel* manModelContour=NULL;
+       manualBaseModel* manModelContour=NULL;
 
        if (_contourPropagation->ifSliceKeyContourExist(z)==false){
 
@@ -358,9 +358,12 @@ manualContourModel* KernelManagerContour::GetPoints(int z,int type, std::vector<
        return manModelContour;
 }
 
-manualContourModel * KernelManagerContour::factoryManualContourModel(int typeContour)
+manualBaseModel * KernelManagerContour::factoryManualContourModel(int typeContour)
 {      
-       manualContourModel *manModelContour=NULL;
+       manualBaseModel *manModelContour=NULL;
+
+       // Creating the model
+       // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
 
        // spline
        if (typeContour==0)
@@ -391,6 +394,12 @@ manualContourModel * KernelManagerContour::factoryManualContourModel(int typeCon
        {
                manModelContour = new manualContourModelLine();
        }
+       
+       // points
+       if (typeContour==7)
+       {
+               manModelContour = new manualBaseModel();
+       }
 
        return manModelContour;
 }
@@ -410,9 +419,9 @@ std::vector<ContourThing**> KernelManagerContour::getOutlinesAtInstant(Instant*
        return modelManager->getOutlinesAtInstant(instant);
 }
 
-std::vector<manualContourModel*> KernelManagerContour::ExploseEachModel( std::vector<manualContourModel*> lstManConMod ){
-       std::vector<manualContourModel*> lstTmp;
-       std::vector<manualContourModel*> lstResult;
+std::vector<manualBaseModel*> KernelManagerContour::ExploseEachModel( std::vector<manualBaseModel*> lstManConMod ){
+       std::vector<manualBaseModel*> lstTmp;
+       std::vector<manualBaseModel*> lstResult;
        int j,jSize;
        int i,iSize=lstManConMod.size();
        for (i=0;i<iSize;i++)
index 023846c7164fbce76065d74f40b6253f6e440976..d89f6c4de6c10a239b57c1a0ce76d3e83b246fe7 100644 (file)
@@ -58,14 +58,14 @@ public:
        **      This methods connect the event in the class interfNewContourMenu with the world of the appli
        **/     
 
-       std::string createOutline(manualContourModel * manModelContour,std::vector<int> instantVector);
+       std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
        /////////////////////////////////
 
        std::string intToString(int num);
 
        std::vector<std::string> GetLstNameThingsStatic();
 
-       void SaveThingName(FILE* pFile, std::string name );
+       void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
 
        std::vector<std::string> GetLstNameThings();
 
@@ -89,7 +89,7 @@ public:
        
        Instant * getCurrentInstant();
 
-       manualContourModel* getOutlineByKeyName(std::string cloneName);
+       manualBaseModel* getOutlineByKeyName(std::string cloneName);
 
        bool onRedo(std::string& filename);
 
@@ -107,9 +107,22 @@ public:
 
        void getMaxMinZ(double *minZ,double *maxZ);
 
-       manualContourModel* GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector);
-
-       manualContourModel* factoryManualContourModel(int typeContour);
+       manualBaseModel* GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector);
+
+       //
+       // Method which creates the model associated with the type in parameter. The possible contour types are:
+       // 0-spline
+       // 1-spline
+       // 2-rectangle
+       // 3-circle
+       // 4-BullEye
+       // 5-BullEyeSector
+       // 6-Line
+       // 7-Points
+       // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
+       // @param typeContour - int
+       // @return manualBaseModel - Model created based on the type
+       manualBaseModel* factoryManualContourModel(int typeContour);
 
        void CalculeSplinePropagation();
 
@@ -117,7 +130,7 @@ public:
 
        std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
 
-       std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
+       std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
 
        
        void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
index 89d0b6da6df88b33a53f905c56a10cce3ac0759b..c2301ce8fb3ebfd906c169e98781f643b350404e 100644 (file)
                * @return Returns the key name of the created outline, or ""if it wasn't created
        */
 //     bool OutlineModelManager :: createOutline(std::string aName, ContourThing * &theOutline)
-       std::string  OutlineModelManager :: createOutline(manualContourModel * model, std::vector<int> theInstantData, std::string aName)
+       std::string  OutlineModelManager :: createOutline(manualBaseModel * model, std::vector<int> theInstantData, std::string aName)
        {
                ContourThing * theOutline = new ContourThing ( model );
                theOutline->setName(aName);             
 
        std::string OutlineModelManager :: createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData )
        {
-               manualContourModel * manModelContour  = getOutlineByKeyName( anExistingKName )->getModel()->Clone();
+               manualBaseModel * manModelContour  = getOutlineByKeyName( anExistingKName )->getModel()->Clone();
                return createOutline( manModelContour, instantNoTouchData );
        }
 
-       void OutlineModelManager::SaveThingName( FILE *pFile, std::string nameThing )
+       void OutlineModelManager::SaveThingName( FILE *pFile, FILE *pFileData, std::string nameThing )
        {
                std::vector< Instant * > *lstInstants;
                lstInstants = outlinesEnvironment->getInstantsOfThing( nameThing );
                fprintf(pFile,"\n");
                ContourThing *contourthing = *outlinesEnvironment->getThingByName(nameThing);
                contourthing->getModel()->Save(pFile);
+               contourthing->getModel()->SaveData(pFileData);
        }
 
index 63feb9e84cb96766d722fb8150d124c838b52854..8520b6aa32524859c24cd2e300c893e9e69b9abb 100644 (file)
@@ -170,7 +170,7 @@ public:
        * @return Returns the key name of the created outline, or ""if it wasn't created
        */
        //bool createOutline(std::string aName, ContourThing * &theOutline);
-       std::string createOutline(manualContourModel * model, std::vector<int>  theInstantData, std::string aName = "" );
+       std::string createOutline(manualBaseModel * model, std::vector<int>  theInstantData, std::string aName = "" );
 
        /*
        * Creates an axeThing with a given name
@@ -358,7 +358,7 @@ public:
        void removeAllOutlines();
        std::string createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData );
 
-       void SaveThingName( FILE *pFile, std::string nameThing );
+       void SaveThingName( FILE *pFile, FILE *pFileData, std::string nameThing );
 
        void ChangeContourOfList(std::string keyName, Instant *instant);
        int IsPartOfStaticList(std::string ss);