_performingOperation = new PerformingOperation();
if(images.size() > 0)
{
- this->setVectImages(images);
+ this->configure(images);
}
_contourextractdata = NULL;
}
-void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
+
+void wxContourMainFrame::changeImage(int id, vtkImageData *img)
+{
+ if ( id<_images.size() ) _images[id]=img;
+ kernelManager->changeImage(id,img);
+ _theViewPanel->changeImage(img);
+// updateInstantImageData();
+
+}
+
+void wxContourMainFrame::configure(std::vector<vtkImageData*> imgs)
{
_images = imgs;
#if defined(_WIN32)
}
- wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir )
+ wxContourMainFrame* wxContourMainFrame::getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir )
{
if(instance == NULL)
{
//
wxAuiNotebook * wxContourMainFrame::createNotebook()
{
- wxSize client_size = GetClientSize();
+ wxSize client_size = GetClientSize();
wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
- wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
+ wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
return noteBook;
}
{
std::vector<int> inst;
_instantPanel->getInstant(inst);
-
vtkImageData* img = kernelManager->getImageAtInstant(inst);
if(img!=NULL)
{
onLoadContours(filename,false);
}
-void wxContourMainFrame::onLoad()
+void wxContourMainFrame::onLoad(bool interactiveInterface) // interactiveInterface default true
{
std::string fileNameContourROI = GetFileLocation();
//CMRU 03-09-09-----------------------------------------------------------------------------------------------
fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
} // if dialog
} // if FileLocation
- onLoadContours(fileNameContourROI,true);
+ onLoadContours(fileNameContourROI, interactiveInterface );
}
void wxContourMainFrame::SetZForAllContours(int pz)
sizeLstNameThings = lstNameThings.size();
for (i=0 ; i<sizeLstNameThings ; i++)
{
-printf("EED wxContourMainFrame::SetZForAllContours contour=%d \n", i );
manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
sizeLstPoints = manualModel->GetSizeLstPoints();
for (ii=0 ; ii<sizeLstPoints ; ii++)
fprintf(pFileData,"--CreaContour--\n");
fprintf(pFileData,"Version %s\n", "1.0.3" );
fprintf(pFileData,"OnePixelSize %f\n", _onePixelSize);
-
//------------------------------------------------------------------------------------------------------------
-
vtkImageData *image = _images[0];
-
int dimRange[3];
image->GetDimensions(dimRange);
-
fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
-
double spaRange[3];
image->GetSpacing(spaRange);
-
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 );
-
//CMRU 03-09-09-----------------------------------------------------------------------------------------------
fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings );
//------------------------------------------------------------------------------------------------------------
-
-
// EED 2017-05-30
double spc[3];
spc[0]=1;
spc[1]=1;
- spc[2]=1;
-
+ spc[2]=1;
for (i=0 ; i<sizeLstNameThings ; i++)
{
//CMRU 03-09-09-----------------------------------------------------------------------------------------------
manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
-
// EED 2017-05-30
// double sizeInPixel = manualModel ->GetPathSize( );
double sizeInPixel = manualModel ->GetPathSize( spc );
-
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
-
//-- 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 );
-
//CMRU 03-09-09-----------------------------------------------------------------------------------------------
fprintf(pFileData,"NumberOfContoursStatic %d\n", sizeLstNameThings );
//------------------------------------------------------------------------------------------------------------
-
for (i=0 ; i<sizeLstNameThings ; i++)
{
kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
//AD:04-06-09
void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool staticContour )
{
-printf ("EED wxContourMainFrame::openContours Start \n");
char tmp[255];
vtkImageData *image = _images[0];
/* } */
-printf ("EED wxContourMainFrame::openContours END \n");
-
}
void wxContourMainFrame::RefreshInterface()
}
-void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int method){
+void wxContourMainFrame::onSegmentationOneSlice(double isovalue,int sampling,int method){
//JCP 20-10-08 Undo redo implementation
saveState();
int x = _theViewPanel->GetX();
int y = _theViewPanel->GetY();
int z = _theViewPanel->GetZ();
- SegmentationOneSlice( x,y,z,isovalue, sampling, method );
+ SegmentationOneSlice( x,y,z,isovalue, sampling, method , getImageData() );
RefreshInterface();
}
-void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
+void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, double isovalue, int sampling, int method , vtkImageData *imagedata)
{
-
-printf("EED wxContourMainFrame::SegmentationOneSlice Start=%d %d\n",sampling,method );
-printf("EED wxContourMainFrame::SegmentationOneSlice %d %d %d \n",x,y,z );
-
int typeofcontour = 1;
//--Extracting Contour
- vtkImageData *imagedata = getImageData();
+// 2024-01-09
+// vtkImageData *imagedata = getImageData();
vtkImageReslice *imageReslice = vtkImageReslice::New();
//EED
std::vector<double> vecCtrlPointY;
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) );
+//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) );
if (polyDataResult->GetNumberOfCells()>0)
{
double *p;
- printf("EED wxContourMainFrame::SegmentationOneSlice A \n");
vtkCell* vtkcell = polyDataResult->GetCell( 0 );
- printf("EED wxContourMainFrame::SegmentationOneSlice B \n");
// int ii,size=polyDataResult->GetNumberOfPoints();
int ii,size=vtkcell->GetNumberOfPoints();
- printf("EED wxContourMainFrame::SegmentationOneSlice C \n");
int id;
for (ii=0;ii<size;ii++)
{
// id = polyDataResult->GetLines()->GetData()->GetValue(ii);
// p = polyDataResult->GetPoint(id);
p = vtkcell->GetPoints()->GetPoint(ii);
-
- printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d px=%f py=%f\n",ii,id, p[0],p[1]);
+// 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] );
vecZ.push_back( -900 );
// vecZ.push_back( p[2] );
}
-
ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
//PROOFS
/*if (methodRadiobox->GetSelection()==0){
extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
} // if addedModel
} // if sizeCtrPt
} // if NumberOfCells > 0
-
-printf("EED wxContourMainFrame::SegmentationOneSlice End\n");
+//printf("EED wxContourMainFrame::SegmentationOneSlice End\n");
}
int wxContourMainFrame::GetImageDataSizeZ()
_theViewPanel->GetImageDataRange(range);
}
-void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
+// Used from wxContourMainFrame_tool bbtk box
+void wxContourMainFrame::onSegmentationAllSlices2(int step ,double isovalue,int sampling,int method,int minZ, int maxZ,vtkImageData* imagedata)
+{
+ //JCP 20-10-08 Undo redo implementation
+ saveState();
+ //JCP 20-10-08 Undo redo implementation
+ wxBusyCursor wait;
+// int x = _theViewPanel->GetX();
+// int y = _theViewPanel->GetY();
+ int z;
+// double porcent;
+// wxString tmpString;
+// double totalZ = maxZ-minZ+1;
+ int ext[6];
+ imagedata->GetExtent(ext);
+ int sizeZ = ext[5]-ext[4]+1;
+ if (minZ<0) { minZ=0; }
+ if (maxZ>=sizeZ) { maxZ=sizeZ-1; }
+ if (step>=1) {
+ int _minZ = minZ/step;
+ _minZ=_minZ*step;
+ for( z=_minZ ; z<=maxZ ; z=z+step )
+ {
+ // porcent = 100.0* (z-minZ)/totalZ;
+ // tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
+ // interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(tmpString);
+ //_staticTextSegmentation->SetLabel(tmpString);
+ SegmentationOneSlice( 100,100,z,isovalue, sampling,method , imagedata );
+ }
+ // interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" "));
+ RefreshInterface();
+ } // if step
+}
+
+void wxContourMainFrame::onSegmentationAllSlices(int minZ,int maxZ,double isovalue,int sampling,int method)
{
//JCP 20-10-08 Undo redo implementation
saveState();
tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(tmpString);
//_staticTextSegmentation->SetLabel(tmpString);
- SegmentationOneSlice( x,y,z,isovalue, sampling,method );
+ SegmentationOneSlice( x,y,z,isovalue, sampling,method , getImageData() );
}
interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" "));
RefreshInterface();
void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
{
_theViewPanel->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
-
RefreshInterface();
}
void wxContourMainFrame::saveFileWithContoursAutomatique()
{
-printf("EED wxContourMainFrame::saveFileWithContoursAutomatique \n");
std::string filename = kernelManager->getCurrentFileName();
if(filename.compare("")!=0){
saveFileWithContours(filename);
onSave();
}
}
+
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);