+void wxContourMainFrame::ShowToolsPanel(bool show){
+ _pannew->Show(show);
+}
+
+
+
+void wxContourMainFrame::SetContourGroup(int contourGroup)
+{
+ _contourGroup = contourGroup;
+}
+
+
+wxPanel *wxContourMainFrame::getMaskImageViewPanel(wxWindow *parent)
+{
+
+ if (_viewMaskImagePanel==NULL)
+ {
+ _contourextractdata = new ContourExtractData(true);
+ _contourextractdata->SetImage( _theViewPanel->getImageData() );
+// double range[2];
+// _theViewPanel->getImageData()->GetScalarRange(range);
+ //int min = (int)floor (range[0]);
+ //int max = (int)ceil (range[1]);
+
+//EED 2017-12-17
+ int min = 254;
+ int max = 256;
+
+ _viewMaskImagePanel = new ThresholdImageViewPanel( parent, -1, -1 , -1,-1, 0);
+ _viewMaskImage = new ThresholdImageView();
+ _viewMaskImage->SetImage( _contourextractdata->GetVtkImageMaskResult() );
+ _viewMaskImage->SetminMaxValue( min, max);
+ _viewMaskImage->SetBaseColor( 0,0,1 );
+
+
+ std::vector<int> colorbarposition;
+ colorbarposition.push_back( -999 );
+ colorbarposition.push_back( -999 );
+ _viewMaskImage->SetColorBarPosition( colorbarposition );
+ double spc[3];
+ _viewMaskImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
+ _viewMaskImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
+
+ _viewMaskImagePanel->SetThresholdImageView( _viewMaskImage );
+ _viewMaskImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
+ _viewMaskImage->onThresholdChangeOpacity( 25 );
+ }
+ return _viewMaskImagePanel;
+}
+
+
+wxPanel *wxContourMainFrame::getColorLayerImageViewPanel(wxWindow *parent)
+{
+ if (_viewColorLayerImagePanel==NULL)
+ {
+ double range[2];
+ _theViewPanel->getImageData()->GetScalarRange(range);
+ int min = (int)floor (range[0]);
+ int max = (int)ceil (range[1]);
+ _viewColorLayerImagePanel = new ColorLayerImageViewPanel( parent, min, max, 100, 1);
+ _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , _theViewPanel->getWxVtkBaseView() );
+ // std::vector<double> range = bbGetInputlstRangeForColorBar();
+ // clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
+ std::vector<int> colorbarposition;
+ colorbarposition.push_back( 50 );
+ colorbarposition.push_back( 105 );
+ _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
+ // std::vector<double> base_color;
+ // _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseColors( base_color );
+ // std::vector<double> grey_level_boundaries;
+ // clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
+ std::vector<double> transparence_level_boundaries;
+ transparence_level_boundaries.push_back(0);
+ _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
+ _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetPlainOrGradientColor( false );
+// _viewColorLayerImagePanel->SetFittingMode( 3 );
+ }
+ return _viewColorLayerImagePanel;
+}
+
+
+wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
+{
+ if (_viewThresholdImagePanel==NULL)
+ {
+ double range[2];
+ _theViewPanel->getImageData()->GetScalarRange(range);
+ int min = (int)floor (range[0]);
+ int max = (int)ceil (range[1]);
+ int start= (max+min)/2 - (max-min)*0.25;
+ int end= (max+min)/2 + (max-min)*0.25;
+ _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
+ _viewThresholdImage = new ThresholdImageView();
+ _viewThresholdImage->SetminMaxValue(start,end);
+ _viewThresholdImage->SetImage( _theViewPanel->getImageData() );
+ std::vector<int> colorbarposition;
+ colorbarposition.push_back( 10 );
+ colorbarposition.push_back( 105 );
+ _viewThresholdImage->SetColorBarPosition( colorbarposition );
+ double spc[3];
+ _viewThresholdImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
+ _viewThresholdImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
+
+ _viewThresholdImage->SetBaseColor( 1,0,0 );
+ _viewThresholdImagePanel->SetThresholdImageView( _viewThresholdImage );
+ _viewThresholdImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
+ _viewThresholdImage->onThresholdChangeOpacity( 25 );
+ RefreshInterface();
+ }
+ 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();
+
+// EED 2017-05-30
+// contourSize = manualModel->GetPathSize();
+ double spc[3];
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+ contourSize = manualModel->GetPathSize( spc );
+ }
+ 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)
+{
+// EED 2017-05-30
+// double sizeInPixel = manualModel ->GetPathSize( );
+ double spc[3];
+ spc[0]=1; // ????
+ spc[1]=1; // ????
+ spc[2]=1; // ????
+ double sizeInPixel = manualModel ->GetPathSize( spc );
+
+ 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;
+}
+//------------------------------------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+void wxContourMainFrame::FlipSelectedContours(int flipDirection)
+{
+ FlipLstOfContours(
+ (std::vector<std::string>)_theViewPanel->getSceneManager()->getSelectedObjects() ,
+ flipDirection
+ );
+
+}
+
+void wxContourMainFrame::FlipActualSliceContours(int flipDirection)
+{
+ FlipLstOfContours(
+ (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() ,
+ flipDirection
+ );
+}
+
+void wxContourMainFrame::FlipAllContours(int flipDirection)
+{
+ FlipLstOfContours(
+ kernelManager->GetLstNameThings() ,
+ flipDirection
+ );
+}
+
+void wxContourMainFrame::FlipLstOfContours(std::vector<std::string> lstNameThings, int flipDirection)
+{
+ int ext[6];
+ getImageData()->GetExtent(ext);
+ int sizeX = ext[1]-ext[0];
+ int sizeY = ext[3]-ext[2];
+
+
+ int i,sizeLstNameThings;
+ int ii,sizeLstPoints;
+
+ sizeLstNameThings = lstNameThings.size();
+ for (i=0 ; i<sizeLstNameThings ; i++)
+ {
+ printf("EED wxContourMainFrame::FlipAllContours contour=%d \n", i );
+ manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
+ if (flipDirection==0)
+ {
+ manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
+ } else {
+ manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
+ }
+ }// for i list of Things
+
+ //-- Static Contours
+
+ lstNameThings = kernelManager->GetLstNameThingsStatic();
+ sizeLstNameThings = lstNameThings.size();
+ for (i=0 ; i<sizeLstNameThings ; i++)
+ {
+ manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
+ if (flipDirection==0)
+ {
+ manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
+ } else {
+ manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
+ }
+ }// for i list of static things
+}
+
+void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
+{
+ printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection );
+
+ saveState();
+
+ if (typeContourFlip==0) //
+ {
+ FlipSelectedContours(flipDirection);
+ }
+
+ if (typeContourFlip==1) //
+ {
+ FlipActualSliceContours(flipDirection);
+ }
+
+ if (typeContourFlip==2) //
+ {
+ FlipAllContours(flipDirection);
+ }
+ RefreshInterface();
+}
+
+
+void wxContourMainFrame::SetXY(int x, int y)
+{
+ _theViewPanel->SetXY(x,y);
+}
+
+
+