# define PATH_MAX 2048
#endif
-
+#include <direct.h>
+#include <stdlib.h>
wxContourMainFrame* wxTheApplication::frame = 0;
bool wxTheApplication :: OnInit()
{
+
+
+
+
wxInitAllImageHandlers();
int image_type = GIMMICK_3D_IMAGE_SELECTION;
{
double **vectx, **vecty, **vectz;
+
+ std::vector< void * > vectortemp;
std::vector<int> size;
vtkImageData *mask, *value;
currentimg=img;
selectedimages.push_back(img);
- frame->setVectImages(selectedimages);
+ wxContourMainFrame::getInstance()->setVectImages(selectedimages);
}
- if(bbGetInputGet()==1){
- bbSetInputGet(0);
- //eventHandler->checkInformationPanel();
- //eventHandler->getValuesXYZ(vectx, vecty, vectz, &size);
- //eventHandler->getMaskValue(mask, value);
+ if(currentimg != NULL){
+ int contourtype = bbGetInputContourType();
+ //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
+ wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
}
bbSetOutputX(vectx);
//new wxContourMainFrame( frame1, wxID_ANY, _T(""), wxPoint(50,50), wxSize(800, 600),selectedimages );
//frame1->CreateStatusBar();
//bbSetOutputWidget( frame1 );
- frame = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages );
- bbSetOutputWidget( frame );
+
+ char currentPath[_MAX_PATH];
+ HMODULE hand = GetModuleHandle("bbcreaContours");
+ GetModuleFileName(hand, currentPath, _MAX_PATH);
+
+ std::string path = currentPath;
+
+ path = path.substr(0,path.find_last_of("\\"));
+
+ wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,path );
+ bbSetOutputWidget( panel );
void nDimensions::bbUserConstructor()
{
- bbSetInputGet(0);
+ bbSetInputContourType(0);
bbSetInputIn(NULL);
}
//==================================================================
BBTK_DECLARE_INPUT(WorkDir,std::string);
BBTK_DECLARE_INPUT(In,vtkImageData*);
- BBTK_DECLARE_INPUT(Get,int);
+ BBTK_DECLARE_INPUT(ContourType,int);
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_DECLARE_OUTPUT(SizeContour,std::vector <int>);
private:
- wxContourMainFrame* frame;
+ //wxContourMainFrame* frame;
vtkImageData* currentimg;
//wxContourEventHandler * eventHandler;
BBTK_CATEGORY("__CategoryBlackBox__");
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,Get,"Set to 1 when data ready to be exported",int,"");
+BBTK_INPUT(nDimensions,ContourType,"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 interfMainPanel::setStringInfoPanel(wxString tmpString){
- ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
+ if(informationPanel!=NULL){
+ ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString);
+ }
}
void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString){
void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){
SaveValuesXYZ( directory , namefile, typeContourGroup );
- SaveImageResult( directory , namefile, typeContourGroup);
+
+ vtkImageData* mask, *value;
+ this->getMaskValue(mask, value, typeContourGroup);
+ this->SaveImageResult( directory , namefile, mask, value);
FILE *pFile=fopen(filename.c_str(),"w+");
delete contourextractdata;
}
-void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, int typeContourGroup)
-{
+void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup){
wxBusyCursor wait;
ContourExtractData *contourextractdata = new ContourExtractData( true );
//int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
}
contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-// for (ii=0 ; ii<sizeLstContourThings ; ii++)
-// {
-// ContourThing **contourthing = lstContourThings[ii];
-// lstManConMod.push_back( (*contourthing)->getModel() );
-// }
-// contourextractdata->SetLstManualContourModel( lstManConMod );
-
contourextractdata->CalculateImageResult(); // with actual Z
} // for iContourGroup
} // for z
+ value = contourextractdata->GetVtkImageValueResult();
+ mask = contourextractdata->GetVtkImageMaskResult();
+ delete contourextractdata;
+}
+
+void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
+{
+
std::string temp = directory + "/" + namefile + "-Value.mhd";
wxString filename = crea::std2wx(temp);
// Image Value
vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
- writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
+ writerValueImage->SetInput( value );
writerValueImage->SetFileName( (const char *)filename.mb_str() );
writerValueImage->SetFileDimensionality( 3 );
writerValueImage->Write( );
filename.append(_T("-Mask.mhd"));*/
vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
- writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
+ writerMaskImage->SetInput( mask );
writerMaskImage->SetFileName( (const char *)filename.mb_str() );
writerMaskImage->SetFileDimensionality( 3 );
writerMaskImage->Write( );
interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
- delete contourextractdata;
+
}
+
+
void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow){
if( name.compare( _theViewPanel->getVerticalConceptName() ) == 0){
_theViewPanel->setActualVertical( value);
void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
+ void getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup);
+
+ void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
+
// void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
// void setGrid( wxContour_Grid * theGridPanel );
void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
- void SaveImageResult(std::string directory,std::string namefile, int typeContourGroup);
+
void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);