00001 #ifndef __wxContourMainFrame_h_INCLUDED_H__
00002 #define __wxContourMainFrame_h_INCLUDED_H__
00003
00004
00005
00006
00007
00008
00009
00010 #include <wx/wxprec.h>
00011 #ifdef __BORLANDC__
00012 #pragma hdrstop
00013 #endif
00014 #ifndef WX_PRECOMP
00015 #include <wx/wx.h>
00016 #endif
00017
00018
00019
00020
00021
00022 #include "wx/aui/aui.h"
00023
00024 #include "interfMainPanel.h"
00025 #include "KernelManagerContour.h"
00026
00027
00028 #include "wxInstantChooserPanel.h"
00029 #include "wxContourViewPanel.h"
00030
00031
00032 #include "ContourExtractData.h"
00033 #include "PerformingOperation.h"
00034
00035 #include "manualLineControler.h"
00036 #include "manualContourModelLine.h"
00037 #include "manualViewLine.h"
00038
00039 #include "ThresholdImageView.h"
00040 #include "ThresholdImageViewPanel.h"
00041 #include "ColorLayerImageView.h"
00042 #include "ColorLayerImageViewPanel.h"
00043
00044
00045
00046 #include "itkImage.h"
00047 #include "itkGeodesicActiveContourLevelSetImageFilter.h"
00048
00049 #include "itkCurvatureAnisotropicDiffusionImageFilter.h"
00050 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
00051 #include "itkSigmoidImageFilter.h"
00052 #include "itkFastMarchingImageFilter.h"
00053 #include "itkRescaleIntensityImageFilter.h"
00054 #include "itkBinaryThresholdImageFilter.h"
00055 #include "itkZeroCrossingImageFilter.h"
00056 #include "itkCastImageFilter.h"
00057
00058
00059
00060 #include "itkImageToVTKImageFilter.h"
00061 #include "itkVTKImageToImageFilter.h"
00062
00063
00064 #include <vtkImageSeedConnectivity.h>
00065 #include <vtkImageMarchingCubes.h>
00066 #include "vtkContourFilter.h"
00067 #include "vtkMarchingContourFilter.h"
00068 #include "vtkPolyDataConnectivityFilter.h"
00069 #include "vtkCleanPolyData.h"
00070 #include "vtkImageReslice.h"
00071 #include "vtkMetaImageWriter.h"
00072 #include "vtkImageData.h"
00073 #include "vtkTransform.h"
00074
00075 #include "vtkCamera.h"
00076 #include "vtkImageActor.h"
00077 #include <vtkImageMapToColors.h>
00078 #include <vtkLookupTable.h>
00079 #include <vtkCommand.h>
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00093
00094
00095
00096 class interfMainPanel;
00097 class wxContourMainFrame : public wxPanel {
00098
00099 public:
00100
00101
00102
00103
00104
00105
00106 wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);
00107 wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,std::string datadir="C:/Creatis/creaContoursBin/RelWithDebInfo/");
00108
00109 ~wxContourMainFrame();
00110
00111
00112
00113
00114
00115 void setVectImages(std::vector<vtkImageData*> imgs);
00116
00117 bool configurePanels( );
00118
00119 bool addNewPanel(wxPanel* panel);
00120
00121 wxAuiNotebook * createNotebook();
00122
00123 void createInstantChooserPanel(wxAuiNotebook * parent);
00124
00125 void createViewPanel(wxAuiNotebook * parent);
00126
00127 void createInstantChooserPanel(wxWindow * parent);
00128
00129 void createViewPanel(wxWindow * parent);
00130
00131 void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
00132
00133 void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ);
00134
00135 void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
00136
00137 void ShowToolsPanel(bool show);
00138
00139
00143
00144
00148
00149
00150
00151
00152
00153 static wxContourMainFrame* getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, std::string datadir="C:/Creatis/creaContoursBin/RelWithDebInfo/");
00154 static wxContourMainFrame* getInstance();
00155 static void resetInstance();
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 std::vector<vtkImageData*> getVectImages();
00166
00170 void onCreateContourSpline( );
00171 void onCreateContourRectangle( );
00172 void onCreateContourCircle( );
00173 void onCreateContourLine( );
00174 void onCreateContourPoints( );
00175 void onCreateContourPolygon( );
00176 void onCreateContourBullEye(wxPanel* pan);
00178 void onDeleteContour();
00179 void deleteContours( std::vector<std::string> keyNamesVector );
00180 void deleteContour( std::string theKeyName );
00181 void onDeleteContoursActSlice();
00182 void onDeleteAllContours();
00183 void deleteAllContours();
00184 void setConceptValue( std::string name, int value );
00185 ConceptDataWrap* getLastConceptData();
00186 bool getIfConceptCheckedAt( std::string name, int pos );
00187
00188 void changeInstant();
00189
00190 int getNamesWrappingSize();
00191
00192 std::string getNameWrapping(int i);
00193
00194 void updateInstantOutlines();
00195 void updateInstantImageData();
00196 void updateInstantAxes();
00197
00198 void onChangeDeep(int val);
00199
00201 void onCopy();
00202 void onPaste();
00203 void onUndo();
00204 void onRedo();
00205 void createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
00206 void createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
00208 void onLoad();
00209 void onSave();
00210 void onImport();
00211 void onTest();
00212 void openContours( FILE *pFile, FILE *pFileData, bool staticContour );
00213
00214 void RefreshInterface();
00215
00216 vtkImageData* getImageData();
00217
00218 void onSegmentationOneSlice(int isovalue,int sampling,int method);
00219 void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
00220 void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method );
00221 void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
00222 void Mirror( int x, int y, int z, int isovalue, int sampling, int method );
00223 int GetImageDataSizeZ();
00224 void GetImageDataRange(double *range);
00225 void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
00226
00227
00228 void referenceLine();
00229 void refLineHide();
00230 void refLineShow();
00231 void refLineChangeWidth(int width);
00232
00233
00234 void onMirror();
00235
00236
00237
00238
00239 void showAxis(bool show);
00240 void onRigidPressed();
00241 void onWidthOfContour(double width);
00242 int getColorWindow();
00243 int getWindowLevel();
00244 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
00245 void onInterpolation(bool interpolate);
00246 void onChangeInstant(std::string name,int actual);
00247 void resetAppend();
00248 void onSpreadAdd();
00249 void onSpreadAddAll();
00250 void onSpreadGo(int type);
00251 void getInstantVector(std::vector<int>& tempVector);
00252 std::vector<std::string> getOutlinesName(int slide);
00253
00254
00255
00256
00257
00258 void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax);
00259 void onSaveResults(std::string directory,std::string namefile, std::string filename,
00260 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
00261 void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
00262 void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
00263 void onSnakePressed();
00264 void saveFileWithContoursAutomatique();
00265 void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ );
00266 wxPanel *getMaskImageViewPanel(wxWindow *parent);
00267 void SetContourGroup(int contourGroup);
00268 wxPanel *getThresholdImageViewPanel(wxWindow *parent);
00269 wxPanel *getColorLayerImageViewPanel(wxWindow *parent);
00270
00271
00272
00273
00279 void onPrintLabel (wxString label, manualBaseModel* manualModel);
00280
00285 void onInsertCalculation(manualBaseModel* manualModel);
00286
00291 double onePixelSize(double value);
00292
00296 int getType();
00297
00301 double getContourSizeInPixels();
00302
00306 manualBaseModel* getContour();
00307
00311 std::string GetFileLocation();
00312
00317 void SetFileLocation(std::string newFileLocation);
00318
00319
00320 void SetScalarRange(int grayRangeMin, int grayRangeMax);
00321
00322
00323
00324 private:
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 int _contourGroup;
00335 static wxContourMainFrame *instance;
00336 KernelManagerContour *kernelManager;
00337 interfMainPanel *_pannew;
00338 PerformingOperation *_performingOperation;
00339 std::string _datadir;
00340 wxContourViewPanel *_theViewPanel;
00341 wxInstantChooserPanel *_instantPanel;
00342
00343
00344 manualLineControler *_refLineControl;
00345 manualContourModelLine *_refLineModel;
00346 manualViewLine *_refLineView;
00347
00348 wxAuiManager m_mgr;
00349 wxAuiNotebook *notebook;
00350 long m_notebook_style;
00351 long m_notebook_theme;
00352 int _numberOfVariablesStatistics;
00353
00354
00355 ThresholdImageView *_viewMaskImage;
00356 ThresholdImageViewPanel *_viewMaskImagePanel;
00357
00358
00359 ThresholdImageView *_viewThresholdImage;
00360 ThresholdImageViewPanel *_viewThresholdImagePanel;
00361
00362
00363 ColorLayerImageView *_viewColorLayerImage;
00364 ColorLayerImageViewPanel *_viewColorLayerImagePanel;
00365 std::vector<vtkImageData*> _images;
00366 bool _actorPresent;
00367
00368
00369 int _tmpReadFileImageDim[3];
00370 double _tmpReadFileImageSpac[3];
00371 int _tmpReadFileTypeOfTransformation;
00372 void readDimSpc(FILE *pFile, bool interactiveOption);
00373
00374
00375
00376
00377
00378 bool _creatingContoursActive;
00380 void createContour( int typeContour );
00381
00382 manualBaseModel * factoryManualContourModel(wxPanel* panel);
00383 ContourExtractData *_contourextractdata;
00384
00385 void saveState();
00386 void loadState(std::string filename);
00387
00388
00389
00390 void saveFileWithContours( std::string filename );
00391 void onLoadContours(std::string fileNameContourROI, bool interactiveInterface);
00392
00393 int inredo;
00394 int inundo;
00395 std::string stundoredo;
00396 static char COPY;
00397
00398
00399 wxWindow *infoWin2;
00400 wxPanel *calibrationPanel;
00401 wxPanel *calibrationPanelError;
00402 double _onePixelSize;
00403 std::string _imageLocation;
00404 std::string _fileLocation;
00405
00406
00407 };
00408
00409 #endif