//----------------------------------------------------------------------------------------------------------------
// Class definition include
//----------------------------------------------------------------------------------------------------------------
-
+
#include "wxContourGUIExample.h"
#include "wxContourMainFrame.h"
//#include "OutlineModelManager.h"
//#include "interfMainPanel.h"
-#if defined(MACOSX) // assume this is OSX
+#if defined(MACOSX) // assume this is OSX
# include <sys/param.h>
-# include <mach-o/dyld.h> // _NSGetExecutablePath : must add -framework CoreFoundation to link line
+# include <mach-o/dyld.h> // _NSGetExecutablePath : must add -framework CoreFoundation to link line
# include <string.h>
# ifndef PATH_MAX
# define PATH_MAX MAXPATHLEN
# endif
#endif // MACOSX
*/
-
-#ifndef PATH_MAX // If not defined yet : do it
+
+#ifndef PATH_MAX // If not defined yet : do it
# define PATH_MAX 2048
#endif
#if defined(WIN32)
#include <direct.h>
#else
- #include <dirent.h>
+ #include <dirent.h>
#endif
#include <stdlib.h>
//EED 1Juin2010
- creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
- w.ShowModal();
-
+ creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
+ w.ShowModal();
+
std::vector<vtkImageData*> images;
//EED 1Juin2010
// creaImageIO::WxGimmickReaderDialog w(0,
// -1,
// "creaContours_Descriptor.dscp",
-// "creatisContours DB",
+// "creatisContours DB",
// _T("WxGimmickDialog test"),
// wxDefaultPosition,wxSize(1200,800)
// ,min_image_type,
// max_image_type,
// output_dim,
-// threads);
+// threads);
// w.ShowModal();
//JCP
- //std::string datadir( crea::wx2std(GetExecutablePath()) );
+ //std::string datadir( crea::wx2std(GetExecutablePath()) );
std::string datadir( crea::System::GetExecutablePath() );
//JCP
#ifdef LINUX /* assume this is OSX */
datadir=datadir+"/../share/creaContours";
- #endif // MACOSX
-
+ #endif // MACOSX
+
#ifdef MACOSX /* assume this is OSX */
datadir=datadir+"/../../../../share/creaContours";
- #endif // MACOSX
-
-
+ #endif // MACOSX
+
+
if(w.GetReturnCode() == wxID_OK)
{
std::vector<std::string> s;
else if (w.GetReturnCode() == wxID_CANCEL)
{
vtkMetaImageReader *reader = vtkMetaImageReader::New();
- std::string filename= datadir + "/data/hola.mhd";
+ std::string filename= datadir + "/data/hola.mhd";
infoImage=_T("DEFAULT-Image:")+crea::std2wx(filename);
reader->SetFileName( filename.c_str() );
reader->Update();
images.push_back(reader->GetOutput());
}
else
- {
+ {
return -1;
- }
+ }
wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("Creatis- ROI Application- Evaluation version,01 Agost 2010 ")+infoImage, wxPoint(400,50), wxSize(800, 600) );
- //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
+ //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
frame1->CreateStatusBar();
frame1->Show(TRUE);
}
#if(WIN32)
-int main(int argc, char* argv[])
- {
- return WinMain(::GetModuleHandle(NULL), NULL,
- ::GetCommandLine(), SW_SHOWNORMAL);
- }
+int main(int argc, char* argv[])
+ {
+ return WinMain(::GetModuleHandle(NULL), NULL,
+ ::GetCommandLine(), SW_SHOWNORMAL);
+ }
#else
#endif
PANEL1 = "I/O";
PANEL2 = "Edit";
PANEL3 = "Delete";
- PANEL4 = "Contour Tools";
+ PANEL4 = "Contour Tools";
PANEL5 = "Segmentation";
//EED 07/07/2010
- PANEL6 = "Image Tools";
+ PANEL6 = "Image Tools";
segmentPanel = NULL;
segmentPanelITK = NULL;
wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);
toolpanel->SetSizer(flexsizer, true);
toolpanel->SetAutoLayout( true );
wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
//EED 07/07/2010
wxPanel* mentex6 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
-
- menubar = new interfNewContourMenu (mentex, sizex, sizey, evtHandler, datadir);
- menubar1 = new interfIOMenu (mentex1, sizex, sizey, evtHandler, datadir);
- menubar2 = new interfEditMenu (mentex2, sizex, sizey, evtHandler, datadir);
- menubar3 = new interfDeleteMenu (mentex3, sizex, sizey, evtHandler, datadir);
+
+ menubar = new interfNewContourMenu (mentex, sizex, sizey, evtHandler, datadir);
+ menubar1 = new interfIOMenu (mentex1, sizex, sizey, evtHandler, datadir);
+ menubar2 = new interfEditMenu (mentex2, sizex, sizey, evtHandler, datadir);
+ menubar3 = new interfDeleteMenu (mentex3, sizex, sizey, evtHandler, datadir);
menubar4 = new interfToolsMenu (mentex4, sizex ,sizey, evtHandler, datadir);
menubar5 = new interfSegmentationMenu(mentex5, sizex, sizey, evtHandler, datadir);
menubar6 = new interfImageToolsMenu(mentex6, sizex, sizey, evtHandler, datadir);
-
- statictext = getText(mentex, PANEL);
- statictext1 = getText(mentex1, PANEL1);
- statictext2 = getText(mentex2, PANEL2);
- statictext3 = getText(mentex3, PANEL3);
- statictext4 = getText(mentex4, PANEL4);
- statictext5 = getText(mentex5, PANEL5);
- statictext6 = getText(mentex6, PANEL6);
-
+
+ statictext = getText(mentex, PANEL);
+ statictext1 = getText(mentex1, PANEL1);
+ statictext2 = getText(mentex2, PANEL2);
+ statictext3 = getText(mentex3, PANEL3);
+ statictext4 = getText(mentex4, PANEL4);
+ statictext5 = getText(mentex5, PANEL5);
+ statictext6 = getText(mentex6, PANEL6);
+
flexsizer->Add(b, wxFIXED_MINSIZE);
flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
flexsizer->Add(b1, wxFIXED_MINSIZE);
flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
-
+
flexsizer->Add(b2, wxFIXED_MINSIZE);
flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
-
+
flexsizer->Add(b3, wxFIXED_MINSIZE);
flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
-
+
flexsizer->Add(b4, wxFIXED_MINSIZE);
flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
toolpanel->Layout();
infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
- wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);
+ wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);
infoPanel->SetSizer(infosizer, true);
- infoPanel->SetAutoLayout( true );
+ infoPanel->SetAutoLayout( true );
splitterwindow->Initialize(toolpanel);
splitterwindow->SetSashGravity(1);
//EED splitterwindow->SetSashPosition(600);
splitterwindow->SetSashSize(5);
- splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73);
+ splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73);
Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
{
_newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
-
+
if(interfmainpanel == NULL){
interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir);
}
}
interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
-{
+{
_newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
}
interfMainPanel* interfMainPanel::getInstance()
-{
+{
return interfmainpanel;
}
/**
** Adds a new checkbox to the scrolledwindow using the checkboxsizer
** @Params id of contour
-**
+**
**/
void interfMainPanel::addContourCheckBox(std::string id)
{
/**
** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
** @Params id of contour
-**
+**
**/
void interfMainPanel::removeContourCheckBox(std::string id)
{
dmenu = menubar;
text = statictext;
}else if(dstring.compare(PANEL1)==0 ){
- dmenu = menubar1;
+ dmenu = menubar1;
text = statictext1;
}else if(dstring.compare(PANEL2)==0){
dmenu = menubar2;
sizechange = 1;
b->SetLabel(_T("-"));
}else{
- dmenu->Show(false);
+ dmenu->Show(false);
sizechange = -1;
b->SetLabel(_T("+"));
- }
-
+ }
+
sizechange *= (dmenu->GetSize().GetHeight()-10);
splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+sizechange);
-
+
this->Layout();
this->Refresh();
}
wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom)
{
- return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
+ return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
}
wxButton* interfMainPanel::getButton(wxWindow* parent)
{
- wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
- wxDefaultValidator, wxString(_T("-")));
+ wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+ wxDefaultValidator, wxString(_T("-")));
return b;
}
wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text)
{
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);
parent->SetSizer(flexsizer, true);
parent->SetAutoLayout( true );
}
/**
-** Shows the panel in the
+** Shows the panel in the
**/
void interfMainPanel::showPanel(wxWindow* panel)
{
if(currentWindow != NULL){
currentWindow->Hide();
sizer->Remove(currentWindow);
- }
+ }
sizer->Add(panel);
currentWindow = panel;
currentWindow->Show(true);
void interfMainPanel::onTest(){
if(testPanel==NULL)
{
- testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
+ testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
testPanel->SetSizer(flexsizer, true);
- testPanel->SetAutoLayout( true );
+ testPanel->SetAutoLayout( true );
panelTest = new interfTestPanel(testPanel);
- wxStaticText* stattext = new wxStaticText(mirrorPanel, -1,
- wxString(_T(" Test Panel ")),
- wxDefaultPosition, wxDefaultSize,
+ wxStaticText* stattext = new wxStaticText(mirrorPanel, -1,
+ wxString(_T(" Test Panel ")),
+ wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
flexsizer->Add(panelTest, wxEXPAND);
testPanel->Layout();
showPanel(testPanel);
- }
+ }
}
void interfMainPanel::RefreshInterface()
}
void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString)
-{
+{
((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
}
void interfMainPanel::onSegmentationPressed()
{
if(segmentPanel == NULL){
segmentPanel = new wxPanel(getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
segmentPanel->SetSizer(flexsizer, true);
- segmentPanel->SetAutoLayout(true);
+ segmentPanel->SetAutoLayout(true);
segmentPanel->SetEventHandler(this);
-
+
//wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel);
segmentationPanel = new interfSegmentationPanelVTK(segmentPanel);
-
+
wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString(_T(" Automatic Segmentation ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
{
if(segmentPanelITK == NULL){
segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
-
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
segmentPanelITK->SetSizer(flexsizer, true);
- segmentPanelITK->SetAutoLayout( true );
+ segmentPanelITK->SetAutoLayout( true );
//segmentPanelITK->SetEventHandler(this->contourevent);
-
+
//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("")));
}
void interfMainPanel::onWidthOfContour(double width)
-{
+{
wxContourMainFrame::getInstance()->onWidthOfContour(width);
}
{
if(configPanel == NULL){
configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
configPanel->SetSizer(flexsizer, true);
- configPanel->SetAutoLayout( true );
+ configPanel->SetAutoLayout( true );
//configPanel->SetEventHandler(this->contourevent);
wxPanel* panel = new interfConfigurationPanel(configPanel);
wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString(_T(" Interface Configuration ")), wxDefaultPosition,
if(spreadPanel==NULL){
spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
spreadPanel->SetSizer(flexsizer, true);
- spreadPanel->SetAutoLayout( true );
+ spreadPanel->SetAutoLayout( true );
//spreadPanel->SetEventHandler(this->contourevent);
-
+
//wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
panelSpread = new interfSpreadPanel(spreadPanel);
-
+
wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T(" Automatic Spread ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
flexsizer->Add(panelSpread, wxEXPAND);
spreadPanel->Layout();
- }
+ }
showPanel(spreadPanel);
//hideAxis();
}
wxContourMainFrame::getInstance()->onSpreadAdd();
}
+void interfMainPanel::onSpreadAddAll()
+{
+ wxContourMainFrame::getInstance()->onSpreadAddAll();
+}
+
+
void interfMainPanel::appendStringSpread(std::string val)
{
panelSpread->appendStringSpread(val);
void interfMainPanel::onInformationPressed()
{
-
+
// Statistics frame
if(infoWin ==NULL){
infoWin = new wxFrame (this, -1,_T(" Statistics "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
infoWin->SetSize( wxSize(825,650) );
-
+
wxSize sizepanel(825,675);
informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
infoWin->Show(true);
}
}
-
-//CMRU 29-08-09-----------------------------------------------------------------------------------------------
+
+//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(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
infoPanelMask->SetSizer(flexsizer, true);
- infoPanelMask->SetAutoLayout( true );
+ infoPanelMask->SetAutoLayout( true );
//configPanel->SetEventHandler(this->contourevent);
- wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
+ wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T(" Mask segmentation ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-
+
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-
+
flexsizer->Add(panel, wxEXPAND);
infoPanelMask->Layout();
-
+
}
-
+
//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);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
infoPanelCalibration->SetSizer(flexsizer, true);
- infoPanelCalibration->SetAutoLayout( 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 );
+ panelAux->SetAutoLayout( true );
sizer->Add(infoPanelMask);
sizer->Add(infoPanelCalibration);
-
+
showPanel(panelAux);
//------------------------------------------------------------------
void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax)
{
- wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
+ wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
}
-void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
+void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
{
- wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
+ wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
}
{
mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
mirrorPanel->SetSizer(flexsizer, true);
- mirrorPanel->SetAutoLayout( true );
+ mirrorPanel->SetAutoLayout( true );
panelMirror = new interfMirrorPanel(mirrorPanel);
-
+
wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T(" Mirroring Tool ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
refLineShown=true;
wxContourMainFrame::getInstance()->referenceLine();
- }
+ }
else
{
// Color Image Layer view control panel
if(colorImageLayerPanel == NULL){
colorImageLayerPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
colorImageLayerPanel->SetSizer(flexsizer, true);
- colorImageLayerPanel->SetAutoLayout( true );
+ colorImageLayerPanel->SetAutoLayout( true );
//configPanel->SetEventHandler(this->contourevent);
- wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
+ wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
wxStaticText* stattext = new wxStaticText(colorImageLayerPanel, -1, wxString(_T(" Color Image Layer ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
//EED01
void interfMainPanel::onThresholdPressed()
-{
+{
// Threshold view control panel
if(thresholdPanel == NULL){
thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
- wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
thresholdPanel->SetSizer(flexsizer, true);
- thresholdPanel->SetAutoLayout( true );
+ thresholdPanel->SetAutoLayout( true );
//configPanel->SetEventHandler(this->contourevent);
- wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
+ wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T(" Threshold segmentation ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
flexsizer->Add(panel, wxEXPAND);
- thresholdPanel->Layout();
+ thresholdPanel->Layout();
}
showPanel(thresholdPanel);
wxContourMainFrame::getInstance()->changeInstant();
}
//CMRU 17-08-09 ---------------------------------------------
-void interfMainPanel::onPrintLabel ()
+void interfMainPanel::onPrintLabel ()
{
wxString label;
manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
}
wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
-
+
if (dialog->ShowModal() == wxID_OK)
{
- label = dialog->GetValue();
+ label = dialog->GetValue();
if(label.Len()!=0)
{
void interfMainPanel::onCalibration(wxString size, int unit)
{
int type = 0;
- double contourSize = 0.0;
+ double contourSize = 0.0;
double realSizeDouble = 0.0;
- type = wxContourMainFrame::getInstance()->getType();
+ type = wxContourMainFrame::getInstance()->getType();
contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
std::cout<<"Cata->Tamaño del contorno en pixeles:"<<contourSize<<endl;
-
- if ( type == 6 )
+
+ if ( type == 6 )
{
if (size.ToDouble(&realSizeDouble))
{
{
realSizeDouble = realSizeDouble * 25.4;
}
- std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
+ 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
+ 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)
+double interfMainPanel::onePixelSize (double realSize,double sizePixel)
{
_pixelValue = realSize/sizePixel;
std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;
class interfMainPanel : public wxPanel {
public:
-
+
interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
~interfMainPanel(void);
/**
** Adds a new checkbox to the scrolledwindow using the checkboxsizer
** @Params id of contour
- **
+ **
**/
void addContourCheckBox(std::string id);
/**
** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
** @Params id of contour
- **
+ **
**/
void removeContourCheckBox(std::string id);
void onActionButtonPressed1( wxCommandEvent& event );
/**
- ** Shows the panel in the
+ ** Shows the panel in the
**/
void showPanel(wxWindow* panel);
/**
- ** Hides the panel in the
+ ** Hides the panel in the
**/
void hidePanel( );
** Gets the Information panel
**/
wxPanel* getInfoPanel();
-
+
/**
** This methods connect the event in the class interfNewContourMenu with the world of the appli
**/
void onCreateContourSpline( );
void onCreateContourRectangle( );
void onCreateContourCircle( );
- void onCreateContourLine( );
+ void onCreateContourLine( );
// RaC 09-09 ---------------------
void onCreateContourPoints( );
// RaC 09-09 ---------------------
// RaC 10-09 ---------------------
void onCreateContourPolygon( );
// RaC 10-09 ---------------------
-
+
void onCreateContoursBullEye(wxPanel* panBull);
/////////////////////////////////
void onDeleteContour();
void onConfigurationPressed();
void resetAppend();
void onSpreadAdd();
+ void onSpreadAddAll();
void appendStringSpread(std::string val);
void onSpreadGo(int type);
void setStringSpread(std::string stringtemp);
void getInstantVector(std::vector<int>& tempVector);
std::vector<std::string> getOutlinesName(int slide);
void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
- void setStringInfoPanel(wxString tmpString);
+ void setStringInfoPanel(wxString tmpString);
void setRowLabelInfoPanel(int z, wxString tempString);
int getNumberColsInformationPanel();
void appendColsInformationPanel(int _numberOfVariablesStatistics);
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
*/
//------------------------------------------------------------------------------------------------------------
private:
-
+
static interfMainPanel* interfmainpanel;
wxPanel* infoPanelMask;
//CMRU 17-08-09 ------------------------------------------------------------------
-
+
/**
* Panel with the calibration options
*/
wxPanel* infoPanelCalibration;
-
+
/**
* Panel who contains the calibration panel and the information panel mask
*/
/**
* Value of a pixel in milimeters
*/
- double _pixelValue;
+ double _pixelValue;
//--------------------------------------------------------------------------------
wxStaticText* statictext;
interfSpreadPanel *panelSpread;
wxWindow *infoWin;
wxPanel *informationPanel;
-
+
wxPanel *testPanel;
interfTestPanel *panelTest;
wxPanel *mirrorPanel;
- interfMirrorPanel *panelMirror;
+ interfMirrorPanel *panelMirror;
wxPanel *thresholdPanel;
wxPanel *colorImageLayerPanel;
-
+
bool axisshown;
bool refLineShown;
-
+
//This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
//list of contours
interfToolsSpreadPanel* toolspread;
**/
wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
-
+
};
#endif
//wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8));
wxButton *spreadResetBtn = new wxButton(this,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
- wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add"),wxDefaultPosition, wxDefaultSize);
+ wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add key contour "),wxDefaultPosition, wxDefaultSize);
+ wxButton *spreadAddAllBtn = new wxButton(this,-1,_T("Add All to key contour"),wxDefaultPosition, wxDefaultSize);
wxString lstOptions[3];
lstOptions[0]=_T("A");
Connect( spreadResetBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadReset );
Connect( spreadAddBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAdd );
+ Connect( spreadAddAllBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAddAll );
Connect( spreadGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadGo );
wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
sizer -> Add( spreadResetBtn , 1, wxGROW );
sizer -> Add( spreadAddBtn , 1, wxGROW );
+ sizer -> Add( spreadAddAllBtn , 1, wxGROW );
sizer -> Add( _spreadMethodRadiobox , 1, wxGROW );
sizer -> Add( spreadGoBtn , 1, wxGROW );
sizer -> Add( _staticTextSpread , 1, wxGROW );
_wxtextctrlSpread->SetValue(wxString("",wxConvUTF8));
interfMainPanel::getInstance()->resetAppend();
}
+
void interfSpreadPanel::onSpreadAdd(wxCommandEvent& event){
interfMainPanel::getInstance()->onSpreadAdd();
}
-void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){
+void interfSpreadPanel::onSpreadAddAll(wxCommandEvent& event){
+ interfMainPanel::getInstance()->onSpreadAddAll();
+}
+void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){
setStringSpread(" ");
int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
printf("EED interfSpreadPanel::onSpreadGo %d\n",typeMethodFindCtrlPoints);
#include "mBarRange.h"
#include <wx/grid.h>
-class interfConfigurationPanel
+class interfConfigurationPanel
: public wxPanel
{
public:
- interfConfigurationPanel(wxWindow * parent);
+ interfConfigurationPanel(wxWindow * parent);
~interfConfigurationPanel();
-
+
private:
void OnInterpolation(wxCommandEvent& event);
-
+
wxSlider* _withOfContourLine;
wxSlider* _brithtnessWindowLevel;
wxSlider* _brithtnessColorLevel;
- wxCheckBox* _interpolationCheckBox;
-
+ wxCheckBox* _interpolationCheckBox;
+
};
class interfSpreadPanel
: public wxPanel
{
public:
- interfSpreadPanel(wxWindow * parent);
+ interfSpreadPanel(wxWindow * parent);
~interfSpreadPanel();
void appendStringSpread(std::string val);
void setStringSpread(std::string stringtemp);
private:
- wxRadioBox* _spreadMethodRadiobox;
- wxStaticText* _staticTextSpread;
- wxTextCtrl* _wxtextctrlSpread;
+ wxRadioBox *_spreadMethodRadiobox;
+ wxStaticText *_staticTextSpread;
+ wxTextCtrl *_wxtextctrlSpread;
void onSpreadReset(wxCommandEvent& event);
void onSpreadAdd(wxCommandEvent& event);
+ void onSpreadAddAll(wxCommandEvent& event);
void onSpreadGo(wxCommandEvent& event);
-
-
+
+
};
class interfInformationPanel
: public wxPanel
{
public:
- interfInformationPanel(wxWindow * parent);
+ interfInformationPanel(wxWindow * parent);
~interfInformationPanel();
void setStringInfoPanel(wxString tmpString);
wxRadioBox* _informationRadiobox;
wxRadioBox* _radiolstboxContourGroup;
wxStaticText* _staticTextInformation;
- wxCheckBox* _XYZValues;
- wxCheckBox* _contourImage;
- wxCheckBox* _statistics;
+ wxCheckBox* _XYZValues;
+ wxCheckBox* _contourImage;
+ wxCheckBox* _statistics;
void onInformationContourLabels(wxCommandEvent& event);
void onExtractInformation(wxCommandEvent& event);
void onRangeSliceInformation(wxCommandEvent& event);
-
-
+
+
};
//CMRU 29-08-09-----------------------------------------------------------------------------------------------
/**
* Initialized the panel
* @param parent Window who contains the panel
*/
- interfCalibrationPanel(wxWindow * parent);
+ interfCalibrationPanel(wxWindow * parent);
~interfCalibrationPanel();
};
//------------------------------------------------------------------------------------------------------------
#endif
-
-
+
+
//EED04
void wxContourMainFrame ::loadState(std::string filename){
-
+
deleteAllContours();
onLoadContours(filename,false);
-
+
/* EED Borrame
char tmp[255];
FILE *pFile=fopen(filename.c_str(),"r+");
openContours(pFile,pFileData,false);
openContours(pFile,pFileData,true); //Load StaticContours
}
-
+
if (version=="1.0.2")
{
//EED001
dial->ShowModal();
int _tmpReadFileTypeOfTransformation = -1;
- bool transform = false;
+//EED bool transform = false;
if (dial->GetReturnCode() == wxID_OK)
{
_instantPanel->setConceptValue( name, actual );
}
+
void wxContourMainFrame::resetAppend(){
kernelManager->resetAppend();
}
+
void wxContourMainFrame::onSpreadAdd(){
std::vector<double> vecX;
std::vector<double> vecY;
std::vector<double> vecZ;
_theViewPanel->GetPointsOfActualContour(&vecX , &vecY , &vecZ );
+ std::vector<int> tempVector;
+ _instantPanel->getInstant( tempVector );
+ std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
+ interfMainPanel::getInstance()->appendStringSpread(val);
+}
+
+
+void wxContourMainFrame::onSpreadAddAll(){
+ printf("EED wxContourMainFrame::onSpreadAddAll \n");
+//EED02
std::vector<int> tempVector;
_instantPanel->getInstant( tempVector );
- std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
+ int minZ,maxZ;
+ minZ = 0;
+ maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
- interfMainPanel::getInstance()->appendStringSpread(val);
+ int z;
+ int sizeLstContourThings;
+
+ for ( z=minZ ; z<=maxZ ; z++ )
+ {
+ tempVector[1]=z;
+ Instant instant(&tempVector);
+ std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
+ sizeLstContourThings = lstContourThings.size();
+
+ printf("EED wxContourMainFrame::onSpreadAddAll z=%d size=%d\n",z,sizeLstContourThings);
+
+ if (sizeLstContourThings>=1)
+ {
+
+ std::vector<double> vecX;
+ std::vector<double> vecY;
+ std::vector<double> vecZ;
+
+ ContourThing **contourthing = lstContourThings[0];
+ manualBaseModel *cModel = (*contourthing)->getModel();
+ int i,size = cModel->GetNumberOfPointsSpline();
+ double x,y,z;
+ for (i=0; i<size; i++)
+ {
+ cModel->GetSpline_i_Point(i, &x, &y, &z);
+ vecX.push_back(x);
+ vecY.push_back(y);
+ vecZ.push_back(z);
+ }
+
+ std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
+ interfMainPanel::getInstance()->appendStringSpread(val);
+
+ printf("EED wxContourMainFrame::onSpreadAddAll -> val=%s\n",val.c_str() );
+
+ }
+
+ }
}
-void wxContourMainFrame::onSpreadGo(int type){
+void wxContourMainFrame::onSpreadGo(int type){
//JCP 20-10-08 Undo redo implementation
saveState();
//JCP 20-10-08 Undo redo implementation
-
wxBusyCursor wait;
std::vector<double> vecCtrlPointX;
std::vector<double> vecCtrlPointY;
void onChangeInstant(std::string name,int actual);
void resetAppend();
void onSpreadAdd();
+ void onSpreadAddAll();
void onSpreadGo(int type);
void getInstantVector(std::vector<int>& tempVector);
std::vector<std::string> getOutlinesName(int slide);
void saveState();
void loadState(std::string filename);
-
+
// void loadContours( FILE *pFile, bool staticContour );
-
+
void saveFileWithContours( std::string filename );
void onLoadContours(std::string fileNameContourROI, bool interactiveInterface);
**
**/
inredo = 0;
- inundo = 0;
+ inundo = 0;
time_t seconds;
seconds = time (NULL);
**
**/
inredo = 0;
- inundo = 0;
+ inundo = 0;
time_t seconds;
seconds = time (NULL);
stundoredo = tmpdir+"/temp"+intToString(time);
_currentIndex = 0;
-
+
_contourPropagation = NULL;
#if(WIN32)
mkdir(tmpdir.c_str());
}
KernelManagerContour::~KernelManagerContour(){
-}
+}
std::vector<vtkImageData*> KernelManagerContour::getVectImages(){
return vectimages;
change->SetInputConnection(img->GetProducerPort());
change->SetOutputSpacing(1,1,1);
-
+
change->Update();
vectimg[i] = change->GetOutput();
std::map<std::string, ImageSourceThing *> * sourcesMap = new std::map<std::string, ImageSourceThing *>();
std::map<std::string, ImageSectionThing *>* sectionsMap = new std::map<std::string, ImageSectionThing *>();
std::map<std::string, AxeThing *>* axesMap = new std::map<std::string, AxeThing *>();
- std::map<std::string, ContourThing *>* outlinesMap = new std::map<std::string, ContourThing *>();
+ std::map<std::string, ContourThing *>* outlinesMap = new std::map<std::string, ContourThing *>();
for(int i = 0; i < (int)(vectimages.size()); i++){
vtkImageData* selectedimage = vectimages[i];
std::string imgstring = "Source Image "+intToString(i+1);
sourcesMap->insert(std::pair<std::string, ImageSourceThing *>( imgstring, thing));
}
-
+
OutlineModelBuilder * _builder = new OutlineModelBuilder( conceptsFN ,datadir);
_builder->buildImageSource_Envornment( imageSourcesFN, sourcesMap );
- _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap );
+ _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap );
_builder->buildAxe_Envornment(axeThingsFN, axesMap );
_builder->buildCountour_Envornment( imageSectionsFN, outlinesMap );
while (k > 0){
char temp = k % 10 + 48;
k = k / 10;
- result = temp + result;
+ result = temp + result;
}
}
return result;
{
return modelManager->createCopyContourOf(anExistingKName, instantNoTouchData);
}
-manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName){
+
+manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName)
+{
return modelManager->getOutlineByKeyName (cloneName )->getModel();
}
if(inredo > 0){
inredo--;
inundo++;
- std::string str = intToString(inundo);
- filename = stundoredo + str + ".roi";
- //loadState(temp);
+ std::string str = intToString(inundo);
+ filename = stundoredo + str + ".roi";
+ //loadState(temp);
return true;
}
return false;
}
bool KernelManagerContour::onUndo(std::string& filename){
- if(inundo>0){
+ if(inundo>0){
inredo++;
inundo--;
//itoa(inundo, str, 10);
std::string str = intToString(inundo);
-
+
filename = stundoredo + str + ".roi";
-
+
return true;//loadState(temp);
}
return false;
filename = stundoredo + str + ".roi";
return true;
- //saveFileWithContours(temp);
+ //saveFileWithContours(temp);
}
}
modelManager->ChangeContourOfList(keyName, instant);
}
-void KernelManagerContour ::resetAppend(){
- if(isInitContourPropagation()){
+void KernelManagerContour ::resetAppend()
+{
+ if (_contourPropagation!=NULL)
+ {
_contourPropagation->resetAppend();
- }
-}
-
-bool KernelManagerContour::isInitContourPropagation(){
- if(_contourPropagation == NULL){
- _contourPropagation = new ContourPropagation();
- }else{
- return true;
}
- return false;
-
}
-std::string KernelManagerContour::onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants){
- if(isInitContourPropagation()){
- if (vecX->size()!=0){
-
- int i,size=vecZ->size();
- int actualSlice = instants[1];
- for ( i=0 ; i<size ; i++ )
- {
- (*vecZ)[i] = actualSlice;
- } // for
- _contourPropagation->appendContour(vecX , vecY , vecZ);
- return intToString(actualSlice);
- }
- }
+std::string KernelManagerContour::onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants)
+{
+ if (_contourPropagation==NULL)
+ {
+ _contourPropagation = new ContourPropagation();
+ }
+
+ if (vecX->size()!=0){
+
+ int i,size=vecZ->size();
+ int actualSlice = instants[1];
+ for ( i=0 ; i<size ; i++ )
+ {
+ (*vecZ)[i] = actualSlice;
+ } // for
+
+ _contourPropagation->appendContour(vecX , vecY , vecZ);
+ return intToString(actualSlice);
+ }
return "";
}
-void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ){
- if(isInitContourPropagation()){
+
+void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ)
+{
+ if (_contourPropagation!=NULL)
+ {
_contourPropagation->getMaxMinZ(minZ, maxZ);
}
}
-void KernelManagerContour::CalculeSplinePropagation(){
+
+
+void KernelManagerContour::CalculeSplinePropagation()
+{
_contourPropagation->setInterpolationNumber(100);
_contourPropagation->CalculeSplinePropagation();
}
-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){
-
-
+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;
manualBaseModel* manModelContour=NULL;
int idTmp = _contourPropagation->FindIdWithZ(z);
if (type==0) // Initial Points
- {
+ {
_contourPropagation->GetInitialControlPoints( idTmp , vecCtrlPointX,vecCtrlPointY,vecCtrlPointZ);
- }
+ }
if (type==1) // Automatique Method
{
_contourPropagation->GetControlPoints( idTmp ,vecCtrlPointX,vecCtrlPointY,vecCtrlPointZ);
if(!addedModel){
manModelContour = NULL;
}
-
+
}// ifSliceKeyContourExist
return manModelContour;
}
manualBaseModel * KernelManagerContour::factoryManualContourModel(int typeContour)
-{
+{
manualBaseModel *manModelContour=NULL;
// Creating the model
{
manModelContour = new manualContourModelLine();
}
-
+
// points
if (typeContour==7)
{
ContourThing **contourthing = vectcont[i];
vectname.push_back((*contourthing)->getName());
}
- return vectname;
+ return vectname;
}
std::vector<ContourThing**> KernelManagerContour::getOutlinesAtInstant(Instant* instant ){
}
std::string KernelManagerContour::parseOsirixFile(std::string filename){
-
+
#ifdef ParserOsirix_BUILD
vtkImageData* sourceimage;
return p.getContoursFileName();
#else
return "";
-#endif
+#endif
}
*/
vtkImageData* getSourceImage();
-
+
void initializeEnvironment(std::string datadir);
/**
** This methods connect the event in the class interfNewContourMenu with the world of the appli
- **/
+ **/
std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
/////////////////////////////////
void setInstant(Instant* theInstant);
void setInstant(std::vector<int> vectInstant);
std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
-
+
Instant * getCurrentInstant();
manualBaseModel* getOutlineByKeyName(std::string cloneName);
std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
-
+
void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
vtkImageData* getImageAtInstant(std::vector<int> inst);
-
+
//------------------------------------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------------------------------------
std::string getCurrentFileName();
std::string parseOsirixFile(std::string filename);
-private:
+private:
//------------------------------------------------------------------------------------------------------------
// Attributes
//------------------------------------------------------------------------------------------------------------
ContourPropagation* _contourPropagation;
- bool isInitContourPropagation();
-
OutlineModelManager* getOutlineModelManager();
};
#endif
outlinesEnvironment = contourEnv;
workSpace = new ContourWorkspace(this);//implies a shared workSpace
- keyGenerator = * new PrefixMaxKeyGenerator();
+ keyGenerator = * new PrefixMaxKeyGenerator();
counterIdKey = 0;
actualInstantWrapping = new InstantMembersNameList();
- changeSourceImage = true;
+ changeSourceImage = true;
bool allOK = keyGenerator.addKeyThing("Axes", "Axe");
allOK &= keyGenerator.addKeyThing("Image Sources", "Image source");
clean();
delete actualInstant;
delete workSpace;
- delete actualInstantWrapping;
+ delete actualInstantWrapping;
}
//------------------------------------------------------------------------------------------------------------
-// Methods
+// Methods
//------------------------------------------------------------------------------------------------------------
/*
* Sets the workSpace object
- * @param aWorkSpace The workSpace to set
+ * @param aWorkSpace The workSpace to set
*/
void OutlineModelManager :: setWorkSpace( ContourWorkspace * aWorkSpace )
{
{
bool executedComs = executionQueue.size()>0 ? true : false;
while( executionQueue.size()>0 )
- {
+ {
CommandObject * aCmmand = executionQueue.front();
executedComs &= executeCommand(aCmmand, fromRegistration);
executionQueue.pop_front();
return executedComs;
}
-
+
/*
- * Sets the concepts of the environments and includes the concepts managed by the program
+ * Sets the concepts of the environments and includes the concepts managed by the program
* @conceptsScript Is the script for with the concepts descrition
* @return Returns true if successful insert of the given concepts, false otherwise
*/
int endSub;
std::string::size_type equalIndex = conceptsScript.find("=", 0);
std::string::size_type nextIndex = 0;
- while( equalIndex != std::string::npos && allOK)
- {
+ while( equalIndex != std::string::npos && allOK)
+ {
endSub = equalIndex;
- std::string concept = conceptsScript.substr( 0, endSub );
- conceptsScript.erase( 0, endSub+1 );
- std::cout << "C: " << concept <<std::endl;
+ std::string concept = conceptsScript.substr( 0, endSub );
+ conceptsScript.erase( 0, endSub+1 );
+ std::cout << "C: " << concept <<std::endl;
nextIndex = conceptsScript.find(";", 0);
std::string cSize;
if(nextIndex != std::string::npos)
{
endSub = nextIndex;
- cSize = conceptsScript.substr( 0, endSub );
- conceptsScript.erase( 0, endSub+1 );
+ cSize = conceptsScript.substr( 0, endSub );
+ conceptsScript.erase( 0, endSub+1 );
}
else
{
- endSub = conceptsScript.size();
- cSize = conceptsScript.substr( 0, endSub );
- conceptsScript.erase( 0, endSub );
- }
- int intReturn = atoi(cSize.c_str());
- std::cout << "SZ: "<<intReturn <<std::endl;
- equalIndex = conceptsScript.find("=", 0);
+ endSub = conceptsScript.size();
+ cSize = conceptsScript.substr( 0, endSub );
+ conceptsScript.erase( 0, endSub );
+ }
+ int intReturn = atoi(cSize.c_str());
+ std::cout << "SZ: "<<intReturn <<std::endl;
+ equalIndex = conceptsScript.find("=", 0);
if( intReturn>0 )
allOK &= addUserConcept(concept, intReturn);
else
allOK = false;
- }
+ }
return allOK;
}
/*
- * Add a concept to all the environments
+ * Add a concept to all the environments
* @param theConceptName Is the name of the new concept
- * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances
+ * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances
* @return Returns true if successful insert of concept, false otherwise
- */
+ */
bool OutlineModelManager :: addUserConcept(std::string theConceptName, int conceptSize)
- {
+ {
bool allOK = axesEnvironment->addConcept(theConceptName, conceptSize);
allOK &= imagesSectionEnvironment->addConcept(theConceptName, conceptSize);
allOK &= imageSourceEnvironment->addConcept(theConceptName, conceptSize);
this->outlinesEnvironment->removeThingFromInstant(keyName, instant);
} else {
ContourThing **contourthing = staticContourLst[ispartofstaticlist];
- this->outlinesEnvironment->addInstantToThing ( keyName , instant );
+ this->outlinesEnvironment->addInstantToThing ( keyName , instant );
staticContourLst.erase( staticContourLst.begin()+ispartofstaticlist );
}
}
std::vector<std::string> kNamesVector;
std::vector<ContourThing **> outlinesVector; //= new std::vector<ContourThing **>();
std::vector<Instant *> lstInstants = getOutlineInstants();
- int i,sizeLstInstants = lstInstants.size();
+ int i,sizeLstInstants = lstInstants.size();
Instant *instant;
for ( i=0 ; i<sizeLstInstants ; i++ )
{
* Gets the outlines at a specific form the outline's environment
* @param aGroupName The name of the group containing the outlines names to get
* @return The vector to the outlines at the given group
- */
+ */
std::vector<ContourThing*> OutlineModelManager :: getOutlinesFromGroup(std::string aGroupName)
{
std::vector<ContourThing *> outlinesVector;
std::map< std::string,OutlineGroup * >::iterator iterP = outlineGroups.find(aGroupName);
if ( iterP != outlineGroups.end() )
- {
- std::vector<std::string> kNamesVector = iterP->second->getGroupOutlinesNames();
+ {
+ std::vector<std::string> kNamesVector = iterP->second->getGroupOutlinesNames();
for(int i=0; i<kNamesVector.size();i++)
{
ContourThing * outlineI = getOutlineByKeyName(kNamesVector[i]);
outlinesVector.push_back(outlineI);
- }
+ }
}
return outlinesVector;
}
* Gets the outlines at a specific form the outline's environment
* @param aGroupName The name of the group containing the outlines names to get
* @return The vector to the outlineGroups at the given group
- */
+ */
bool OutlineModelManager :: addOutlinesGroup( std::string theOutlineName, OutlineGroup * theGroup )
{
- outlineGroups.insert(std::pair <std::string, OutlineGroup *> ( theOutlineName, theGroup ));
+ outlineGroups.insert(std::pair <std::string, OutlineGroup *> ( theOutlineName, theGroup ));
// std::map<std::string, OutlineGroup *> :: iterator iter = NULL;
std::map<std::string, OutlineGroup *> :: iterator iter;
iter = outlineGroups.find( theOutlineName );
std::string OutlineModelManager :: createOutline(manualBaseModel * model, std::vector<int> theInstantData, std::string aName)
{
ContourThing * theOutline = new ContourThing ( model );
- theOutline->setName(aName);
- return addOutline( theOutline, new Instant( &theInstantData ) );
+ theOutline->setName(aName);
+ return addOutline( theOutline, new Instant( &theInstantData ) );
}
/*
bool OutlineModelManager :: createAxe(std::string aDescription, Instant * theInstantData)
{
AxeThing * theAxe = new AxeThing ();
- theAxe->setDescription(aDescription);
- return addAxe(theAxe, theInstantData);
+ theAxe->setDescription(aDescription);
+ return addAxe(theAxe, theInstantData);
}
/*
//bool OutlineModelManager :: createImageSource(std::string aSource, ImageSourceThing * &imageSource)
bool OutlineModelManager :: createImageSource(std::string aSource, Instant * theInstantData)
{
-// imageSource = new ImageSourceThing(aSource);
- //return addImageSource(new ImageSourceThing(aSource), theInstantData);
+// imageSource = new ImageSourceThing(aSource);
+ //return addImageSource(new ImageSourceThing(aSource), theInstantData);
return NULL;//***********************************************************************************************
}
//bool OutlineModelManager :: createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection)
bool OutlineModelManager :: createImageSection(std::string aSecImageData, Instant * theInstantData)
{
- //imageSection = new ImageSectionThing(aSecImageData);
-// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData);
+ //imageSection = new ImageSectionThing(aSecImageData);
+// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData);
return NULL;
}
/*
- * Adds an outlineThing
+ * Adds an outlineThing
* @param theOutline The outline/contour (thing)
* @param theInstantData Is the instant for the outline to add
* @return Returns true if the addition of the outline was successful
*/
std::string OutlineModelManager :: addOutline( ContourThing * theOutline, Instant * theInstantData)
- {
+ {
std::string kName;
-// EED
+// EED
// bool added = keyGenerator.generateKeyOf("Outlines", outlinesEnvironment->getNumberOfThings(),kName);
counterIdKey++;
if( added )
return kName;
else
- return "";
+ return "";
}
/*
- * Remove an outlineThing
+ * Remove an outlineThing
* @param theOutline The outline/contour (thing)
*/
void OutlineModelManager :: removeOutline( std::string ss )
- {
+ {
outlinesEnvironment->removeThing( ss );
}
std::vector< ContourThing **> thingsVector;
outlinesEnvironment->getThingsOfEnvironment( &thingsVector );
int i,sizeThingVector = thingsVector.size();
- for(i=0;i<sizeThingVector;i++)
+ for(i=0;i<sizeThingVector;i++)
{
ContourThing ** contourthing = thingsVector[i];
removeOutline( (*contourthing)->getName() );
/*
- * Adds an axeThing
+ * Adds an axeThing
* @param thaAxe The axe (thing)
* @param theInstantData Is the instant for the axe to add
* @return Returns true if the addition of the axe was successful
bool OutlineModelManager :: addAxe( AxeThing * theAxe , Instant * theInstantData)
{
std::string kName;
- bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName);
+ bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName);
added &= axesEnvironment->addThingWithInstant(kName,theAxe, theInstantData);
return added;
}
/*
- * Adds an imageSourceThing
+ * Adds an imageSourceThing
* @param imgageSource The image source (thing)
* @param theInstantData Is the instant for the source to add
* @return Returns true if the addition of the imageSource was successful
* @return Returns true if the addition of the imageSection was successful
*/
bool OutlineModelManager :: addImageSection(ImageSectionThing * imageSection, Instant * theInstantData)
- {
+ {
std::string kName;
bool added = keyGenerator.generateKeyOf("Image Sections", imagesSectionEnvironment->getNumberOfThings(),kName);
added &= imagesSectionEnvironment->addThingWithInstant(kName, imageSection, theInstantData);
actualInstantWrapping -> addOutlineName( kNamesVector[i], anOutline->getName() );
}
}
-
+
/*
* Annotates the actual outline keyName-real name wrapping at the actual instant
* @param actualKeyOutline The key name to annotate
void OutlineModelManager :: annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR...
{
actualInstantWrapping -> setActualSectionImageNamesWrapp(actualKeyImage, theRealName);
- }
+ }
/*
* Annotate the annotateActualSource image keyName-real name wrapping at the actual instant
* @param actualKeyImage The key name to annotate
- * @param theRealName The real name asigned to the annotateActualSource
+ * @param theRealName The real name asigned to the annotateActualSource
*/
void OutlineModelManager :: annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR...
{
actualInstantWrapping -> setActualSourceImageNamesWrapp(actualKeyImage, theRealName);
- }
+ }
/*
/*
* Gets the instants of a specific outline
* @param thekName Is the name of the outline
- * @return The instants set
+ * @return The instants set
*/
std::vector<Instant *> OutlineModelManager :: getOutlineInstantsByName(std::string thekName)
- {
- return *outlinesEnvironment->getInstantsOfThing(thekName);
+ {
+ return *outlinesEnvironment->getInstantsOfThing(thekName);
}
/*
* Gets all instants outlines
- * @return The instants set
+ * @return The instants set
*/
std::vector<Instant *> OutlineModelManager :: getOutlineInstants()
- {
- return *outlinesEnvironment->getExistingInstants();
+ {
+ return *outlinesEnvironment->getExistingInstants();
}
{
return imageSourceEnvironment->addInstantToThing( imaKName,anInstantData );
}
-
+
/*
* Method that retorns the name of each concept and the size of it.
* @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts
{
//if (outlinesEnvironment->getNumberOfThings()>0)
outlinesEnvironment->getConceptsInformation(conceptNameVect, conceptSizeVect);
- }
+ }
}
/*
- * Gets the contourWorspace
+ * Gets the contourWorspace
* @return Returns the workspace
*/
ContourWorkspace * OutlineModelManager :: getContourWorkspace()
* Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model
*/
void OutlineModelManager :: updateToActualInstant()
- {
+ {
Instant * longInstant = actualInstant;
/*Instant * mediumInstant = new Instant();
- Instant * shortInstant = new Instant();
+ Instant * shortInstant = new Instant();
std::vector<int>* theInstant = longInstant->getInstant();
for(int i=1; i<theInstant->size(); i++)
{
shortInstant->addConcept( (*theInstant)[i] );
mediumInstant->addConcept( (*theInstant)[i] );
}
-
+
//getting the sourceAtInstant
std::vector<std::string> kSourceVector;
std::vector<ImageSourceThing **> imSourceVector;
imageSourceEnvironment->getThings(kSourceVector, imSourceVector, shortInstant);
annotateActualSourceImageWrap(kSourceVector[0], (**imSourceVector[0]).getSourceImage());
- //getting the aAxeAtInstant
+ //getting the aAxeAtInstant
std::vector<std::string> kAxeVector;
std::vector<AxeThing **> axesVector;
axesEnvironment->getThings(kAxeVector, axesVector, mediumInstant);
imagesSectionEnvironment->getThings(kSectionVector, imSectionVector, longInstant); if ( !kSectionVector.empty() )
//annotateActualSectionImageWrap(kSectionVector[0], (**imSectionVector[0]).getImageData());
*/
-
- //getting the outlines
+
+ //getting the outlines
std::vector<ContourThing ** > vect = getOutlinesAtInstant( longInstant );
}
-
+
/*
- * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments.
+ * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments.
* @return Returns true if successful insert of the automatic concepts, false otherwise
*/
bool OutlineModelManager :: setAutomaticConcepts()
bool allOK = axesEnvironment->addConcept(axeConcept, axeC_size);
allOK &= imagesSectionEnvironment->addConcept(axeConcept, axeC_size);
allOK &= outlinesEnvironment->addConcept(axeConcept, axeC_size);
-
+
allOK &= imagesSectionEnvironment->addConcept(axeDepthConcept, axeDepthC_size);
allOK &= outlinesEnvironment->addConcept(axeDepthConcept, axeDepthC_size);
/*
void OutlineModelManager::SaveThingName( FILE *pFile, FILE *pFileData, std::string nameThing )
{
std::vector< Instant * > *lstInstants;
-printf("EED OutlineModelManager::SaveThingName %s\n",nameThing.c_str() );
lstInstants = outlinesEnvironment->getInstantsOfThing( nameThing );
-printf("EED OutlineModelManager::SaveThingName %d\n", (*lstInstants).size() );
Instant *instant = (*lstInstants)[0];
std::vector<int> *vecInst =instant->getInstant();
int i,sizeVecInst = vecInst->size();