#include "wxContourGUIExample.h"
#include "wxContourMainFrame.h"
-//#include "OutlineModelManager.h"
-//#include "wxContourEventHandler.h"
-//#include <creaImageIOWxGimmickDialog.h>
-//#include <creaImageIOWxGimmickReaderDialog.h>
#include <creaImageIOWxSimpleDlg.h>
#include <creaImageIOSystem.h>
#include <creaVtkBasicSlicer.h>
-//#include "wxContourMainPanel.h"
#include "vtkMetaImageReader.h"
#include <map>
#include "vtkImageData.h"
BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
void nDimensions::Process()
{
+printf("EED nDimensions::Process Start \n" );
double **vectx = 0, **vecty = 0, **vectz = 0;
std::vector< void * > vectortemp;
wxContourMainFrame::getInstance()->ShowToolsPanel(true);
currentimg=img;
selectedimages.push_back(img);
+printf("EED nDimensions::Process 1 \n" );
wxContourMainFrame::getInstance()->setVectImages(selectedimages);
+printf("EED nDimensions::Process 2 \n" );
}
- if(currentimg != NULL){
+ if(currentimg != NULL)
+ {
int contourtype = bbGetInputContourType();
//wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
//wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
}
- bbSetOutputX(vectx);
- bbSetOutputY(vecty);
- bbSetOutputZ(vectz);
- bbSetOutputSizeContour(size);
- bbSetOutputMask(*mask);
- bbSetOutputValue(*value);
+ wxContourMainFrame::getInstance()->RefreshInterface();
+
+
+printf("EED nDimensions::Process 3.1 \n" );
+// bbSetOutputX(vectx);
+printf("EED nDimensions::Process 3.2 \n" );
+// bbSetOutputY(vecty);
+printf("EED nDimensions::Process 3.3 \n" );
+// bbSetOutputZ(vectz);
+printf("EED nDimensions::Process 3.4 \n" );
+// bbSetOutputSizeContour(size);
+printf("EED nDimensions::Process 3.5 \n" );
+// bbSetOutputMask(*mask);
+printf("EED nDimensions::Process 3.6 \n" );
+// bbSetOutputValue(*value);
+printf("EED nDimensions::Process End \n" );
}
//-----------------------------------------------------------------
#endif // MACOSX
- printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
+printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
- wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
+ wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
+printf("EED nDimensions::CreateWidget 1 \n" );
wxContourMainFrame::getInstance()->ShowToolsPanel(false);
-//EED bbSetOutputWidget( panel );
- bbSetOutputWidget( new wxPanel(parent,-1) );
+printf("EED nDimensions::CreateWidget 2 \n" );
+
+// bbSetOutputWidget( new wxPanel(parent,-1) );
+ bbSetOutputWidget( wxcontourmainframe );
+
+printf("EED nDimensions::CreateWidget 3 \n" );
}
//-----------------------------------------------------------------
BBTK_CATEGORY("contours");
BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
-BBTK_INPUT(nDimensions,ContourType,"Contour type to be exported: ",int,"");
+BBTK_INPUT(nDimensions,ContourType,"(default 0) Contour type to be exported: ",int,"");
BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
{
+printf("EED wxContourMainFrame::SegmentationOneSlice Start\n");
int typeofcontour = 1;
//--Extracting Contour
//vtkImageData *imagedata = _theViewPanel->getSceneManager()->GetImageData();
cpd2->UpdateInformation();
vtkStripper* vtkstripper = vtkStripper::New( );
+ vtkstripper->SetMaximumLength(20000);
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
vtkstripper->SetInput( cpd2->GetOutput() );
std::vector<double> vecCtrlPointZ;
+printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() );
+
+int numberOfPointsInCell;
+int numberOfcells=polyDataResult->GetNumberOfCells();
+for (int jj=0; jj<numberOfcells ; jj++)
+{
+ vtkCell* vtkcell = polyDataResult->GetCell( jj );
+ numberOfPointsInCell=vtkcell->GetNumberOfPoints();
+ printf("EED wxContourMainFrame::SegmentationOneSlice cell=%d points=%d \n",jj,numberOfPointsInCell );
+}// for jj
+
+printf("EED wxContourMainFrame::SegmentationOneSlice PrintSelf \n");
+
+polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
+
+
+
double *p;
int ii,size=polyDataResult->GetNumberOfPoints();
int id;
{
id = polyDataResult->GetLines()->GetData()->GetValue(ii);
p = polyDataResult->GetPoint(id);
+printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d px=%f py=%f\n",ii,id, p[0],p[1]);
// double x=p[0];
// double y=p[1];
vecX.push_back( p[0] );
extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
}*/
- if (method==0){
+ if (method==0)
+ {
extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==1){
+ } else if (method==1){
extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==2){
+ } else if (method==2){
extractcontrolpoints2d->SetSamplingControlPoints( sampling );
extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
}
//--Adding contour to the system
-
std::vector<int> actualInstantVector;
_instantPanel->getInstant( actualInstantVector );
actualInstantVector[1]=z;
int j,sizeCtrPt = vecCtrlPointX.size();
manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
- manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
- if (sizeCtrPt>=3){
+printf("EED wxContourMainFrame::SegmentationOneSlice sizeCtrPt=%d %d %d\n" , sizeCtrPt
+ , ((sizeCtrPt/100)+1)*100 *2
+ , manModelContour->GetNumberOfPointsSpline()
+ );
+ manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
+ if (sizeCtrPt>=3)
+ {
for (j=0 ; j<sizeCtrPt ; j++)
{
manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j] );
//_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
} // if addedModel
} // if sizeCtrPt
+printf("EED wxContourMainFrame::SegmentationOneSlice End\n");
}
-int wxContourMainFrame::GetImageDataSizeZ(){
+
+int wxContourMainFrame::GetImageDataSizeZ()
+{
return _theViewPanel->GetImageDataSizeZ();
}
-void wxContourMainFrame::GetImageDataRange(double *range){
+void wxContourMainFrame::GetImageDataRange(double *range)
+{
_theViewPanel->GetImageDataRange(range);
}
-void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method){
+void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
+{
//JCP 20-10-08 Undo redo implementation
saveState();
//JCP 20-10-08 Undo redo implementation