interfMirrorPanel::interfMirrorPanel(wxWindow* parent)
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
{
- wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show Axis"), wxDefaultPosition, wxSize(200,35) );
- wxButton *axisHideBtn = new wxButton(this,wxID_ANY,_T("Hide Axis"), wxDefaultPosition, wxSize(200,35) );
+ _axisStatus = true;
+
+ wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Axis"), wxDefaultPosition, wxSize(200,35) );
wxButton *mirrorGoBtn = new wxButton(this,wxID_ANY,_T("Mirror Contour"), wxDefaultPosition, wxSize(200,35) );
_thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
Connect( axisShowBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisShow );
- Connect( axisHideBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisHide );
Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo );
wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
sizer -> Add( axisShowBtn, 1, wxGROW );
- sizer -> Add( axisHideBtn, 1, wxGROW );
sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW );
sizer -> Add( _thickness, 1, wxGROW );
void interfMirrorPanel::onAxisShow(wxCommandEvent& event)
{
- interfMainPanel::getInstance()->onMirrorAxisShow();
-}
-
-void interfMirrorPanel::onAxisHide(wxCommandEvent& event)
-{
- interfMainPanel::getInstance()->onMirrorAxisHide();
+
+ if (!_axisStatus)
+ {
+ interfMainPanel::getInstance()->onMirrorAxisShow();
+ _axisStatus=true;
+ }
+ else
+ {
+ interfMainPanel::getInstance()->onMirrorAxisHide();
+ _axisStatus=false;
+ }
}
void interfMirrorPanel::onMirrorGo(wxCommandEvent& event)
{
- interfMainPanel::getInstance()->onMirror();
+ if (_axisStatus)
+ {
+ interfMainPanel::getInstance()->onMirror();
+ }
}
void interfMirrorPanel::onChangeWidth(wxScrollEvent& event)
if(images.size() > 0)
{
-
this->setVectImages(images);
}
{
_images = imgs;
+
#if defined(__GNUC__)
std::string str_home(getenv("HOME"));
#elif defined(_WIN32)
fscanf(pFile,"%s",tmp); // Version
fscanf(pFile,"%s",tmp); // 1.0.2 || 1.0.1 || 1.0.0
- std::string version(tmp);
deleteAllContours();
- //AD:02-06-09
- if (version=="1.0.2")
- {
- loadContours(pFile);
- }
-
- //AD:02-06-09
- else if (version=="1.0.1")
- {
- loadContours(pFile);
- }
-
- //AD:02-06-09
- else if (version=="1.0.0")
- {
- loadContours(pFile);
- }
+ loadContours(pFile, false);
+ loadContours(pFile, true);
fclose(pFile);
}
-void wxContourMainFrame ::loadContours( FILE *pFile )
+void wxContourMainFrame ::loadContours( FILE *pFile, bool staticContour )
{
char tmp[255];
- fscanf(pFile,"%s",tmp); // NumberOfContours
- fscanf(pFile,"%s",tmp); // ##
- int numberOfContours = atoi(tmp);
- std::vector<int> instantVector;
- int typeContourModel;
- manualContourModel *manModelContour;
- int typeView;
-
+ if (staticContour==false)
+ {
fscanf(pFile,"%s",tmp); // ImageDimensions
fscanf(pFile,"%s",tmp); // X
fscanf(pFile,"%s",tmp); // Y
fscanf(pFile,"%s",tmp); // X
fscanf(pFile,"%s",tmp); // Y
fscanf(pFile,"%s",tmp); // Z
+ }
+
+ fscanf(pFile,"%s",tmp); // NumberOfContours
+ fscanf(pFile,"%s",tmp); // ##
+ int numberOfContours = atoi(tmp);
+
+ std::vector<int> instantVector;
+ int typeContourModel;
+ manualContourModel *manModelContour;
+ int typeView;
int i;
for (i=0;i<numberOfContours;i++)
//_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
}
+
+ if (staticContour==true)
+ {
+ Instant instant(&instantVector);
+ kernelManager->changeContourOfManager( theName , &instant );
+ }
}// for numberOfContours
}
//AD:02-06-09
if (version=="1.0.2")
{
- openContours(pFile,2);
+ openContours(pFile,2,false);
+ openContours(pFile,2,true); //Load StaticContours
}
//AD:02-06-09
else if (version=="1.0.1")
{
- openContours(pFile,1);
+ openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
+ openContours(pFile,1,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
}
//AD:02-06-09
else if (version=="1.0.0")
{
- openContours(pFile,0);
+ openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing
}
fclose(pFile);
fprintf(pFile,"--CreaContour--\n");
fprintf(pFile,"Version %s\n", "1.0.2" );
-
- // Normal Contours
- lstNameThings = kernelManager->GetLstNameThings();
- sizeLstNameThings = lstNameThings.size();
- fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
-
+
vtkImageData *image = _images[0];
int dimRange[3];
fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
+ // Normal Contours
+
+ lstNameThings = kernelManager->GetLstNameThings();
+ sizeLstNameThings = lstNameThings.size();
+ fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
+
for (i=0 ; i<sizeLstNameThings ; i++)
{
kernelManager->SaveThingName( pFile, lstNameThings[i] );
_theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
}// for i
- //-- Contours Statics
+ //-- Static Contours
+
+ fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
+
+ fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
+
lstNameThings = kernelManager->GetLstNameThingsStatic();
sizeLstNameThings = lstNameThings.size();
fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
}
//AD:04-06-09
-void wxContourMainFrame::openContours( FILE *pFile, int version )
+void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticContour )
{
char tmp[255];
- fscanf(pFile,"%s",tmp); // NumberOfContours
- fscanf(pFile,"%s",tmp); // ##
- int numberOfContours = atoi(tmp);
-
- std::vector<int> instantVector;
- int typeContourModel;
- manualContourModel *manModelContour;
- int typeView;
-
+
vtkImageData *image = _images[0];
int imageDim[3];
double imageSpac[3];
fscanf(pFile,"%s",tmp); // Z
tempSpac[2] = atof(tmp);
- //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 3
+ //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 2
if (imageDim[0]!=tempDim[0] || imageDim[1]!=tempDim[1] || imageSpac[0]!=tempSpac[0] || imageSpac[1]!=tempSpac[1])
{
compatible = false;
}
}
+
+ fscanf(pFile,"%s",tmp); // NumberOfContours
+ fscanf(pFile,"%s",tmp); // ##
+ int numberOfContours = atoi(tmp);
+
+ std::vector<int> instantVector;
+ int typeContourModel;
+ manualContourModel *manModelContour;
+ int typeView;
if (compatible==true)
{
_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
}
- if (version==0) //StaticContours (will appear in all slices)
+ if (staticContour) //StaticContours (will appear in all slices)
{
Instant instant(&instantVector);
kernelManager->changeContourOfManager( theName , &instant );
_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
}
- if (version==0) //StaticContours (will appear in all slices)
+ if (staticContour) //StaticContours (will appear in all slices)
{
Instant instant(&instantVector);
kernelManager->changeContourOfManager( theName , &instant );