wxReadingPriorityPanel.h

Go to the documentation of this file.
00001 
00002 #ifndef wx_Reading_Priority_Panel_H
00003 #define wx_Reading_Priority_Panel_H
00004 
00005 #include <wx/wx.h>
00006 #include <wx/slider.h>
00007 #include <wx/panel.h>
00008 
00009 
00010 //EED 15Avril2008 
00011 //  #include "wxImageViewerWidget.h"
00012 #include "InterfaceVtkPanelWidgets.h"
00013 
00014 #include "marGdcmDicom.h"
00015 #include "pPlotter/mBarRange.h"//SIL//
00016 
00017 // ----------------------------------------------------------------------------
00018 // ----------------------------------------------------------------------------
00019 // ----------------------------------------------------------------------------
00020 
00021 
00022 #define PriorityLoadImage_MAX_P 5
00023 
00024 class PriorityLoop  {
00025         public:
00026                 PriorityLoop();
00027                 virtual ~PriorityLoop();
00028                                 void    SetStartEndActualMax(int start,int end, int actual,int deltaImg, int maxImages);
00029                                 void    Iteration();
00030                                 void    InitLoop();
00031 
00032                                 void    StopLoop();
00033                                 bool    IsLoop();
00034                                 void    WaitUntil_i_isDone(int i);
00035                                 void    WaitUntil_segment_isDone(int start, int end,bool forceEndLoopRegion=true);
00036                                 void    ForceEndLoopRegion();
00037                 virtual void    Action_i( int i );
00038                 virtual void    RefreshForce() {}; 
00039 
00040         private:
00041 
00042 
00043                 int             _start;
00044                 int             _end;
00045                 int             _actual;
00046                 int             _deltaImg;
00047                 int             _maxImages;
00048                 int             _tstart;
00049                 int             _tend;
00050                 int             _tactual;
00051                 int             _tdeltaImg;
00052                 int             _tmaxImages;
00053 
00054                 int             _counterReading;
00055                 int             _max_p;
00056                 bool    _loadingSerie;
00057                 int     _forceReadRegion;
00058                 int             _i_forceReadReagion;
00059                 bool    _needToChange;
00060 
00061                 int             _priority;
00062                 int             _priorityType;
00063                 bool    _dg[PriorityLoadImage_MAX_P];                 // right - left
00064                 int             _counterActual[PriorityLoadImage_MAX_P];      // 
00065                 bool    *_vecIdImage;
00066 
00067                 int             Get_i_image();
00068                 int             Geti(int id,int step,int start,int actualg,int actuald,int end);
00069                 bool    _Action_i( int i );
00070                 void    Create_Empty_Vector();
00071                 void    InitConfiguration();
00072                 bool    _ForceEndLoopRegion();
00073                 void    NeedToChange();
00074 };
00075 
00076 // ----------------------------------------------------------------------------
00077 // ----------------------------------------------------------------------------
00078 // ----------------------------------------------------------------------------
00079 
00080 class BarLoading :public  wxPanel{
00081 public:
00082         BarLoading(wxWindow *parent, int w, int h);
00083         virtual ~BarLoading();
00084         void SetI(int i);
00085         void Reset();
00086         void Paint();
00087         virtual void OnPaint( wxPaintEvent &WXUNUSED(event) );
00088         void SetSizeData(int sizeData);
00089         void RefreshForce();
00090 private:
00091         std::vector<int>    lstInt;
00092         int                     _w;
00093         int                     _h;
00094         int                     _sizeData;
00095         wxBitmap        *_bitmap;
00096         bool            _flag_bitmap;
00097         bool            _flag2_bitmap;
00098         DECLARE_CLASS(BarLoading)
00099     // any class wishing to process wxWindows events must use this macro
00100     DECLARE_EVENT_TABLE()
00101 };
00102 
00103 
00104 // ----------------------------------------------------------------------------
00105 // ----------------------------------------------------------------------------
00106 // ----------------------------------------------------------------------------
00107 /*  EED Borrame
00108 class BarRange :public  wxPanel{
00109 public:
00110         BarRange(wxWindow *parent, int w, int h);
00111         ~BarRange();
00112         void SetActual(int i);
00113         void SetStart(int i);
00114         void SetEnd(int i);
00115         void SetMax(int i);
00116         void OnPaint( wxPaintEvent &WXUNUSED(event) );
00117         void RefreshView();
00118         void RefreshForce();
00119 
00120 private:
00121         int                     _w;
00122         int                     _h;
00123         int                     _actual;
00124         int                     _start;
00125         int                     _end;
00126         int                     _max;
00127         wxBitmap        *_bitmap;
00128         DECLARE_CLASS(BarRange)
00129     // any class wishing to process wxWindows events must use this macro
00130     DECLARE_EVENT_TABLE()
00131 };
00132 */
00133 
00134 
00135 // ----------------------------------------------------------------------------
00136 // ----------------------------------------------------------------------------
00137 // ----------------------------------------------------------------------------
00138 
00139 class PriorityLoadImageBar : public PriorityLoop{
00140 public:
00141         PriorityLoadImageBar(marFilesBase *marfilesbase, BarLoading *bar);
00142         virtual ~PriorityLoadImageBar();
00143         void Action_i(int i);
00144         virtual void RefreshForce();
00145 
00146 private:
00147         marFilesBase    *_marfilesbase;
00148         BarLoading              *_bar;
00149 };
00150 
00151 
00152 
00153 
00154 // ----------------------------------------------------------------------------
00155 // ----------------------------------------------------------------------------
00156 // ----------------------------------------------------------------------------
00157 /*
00158 
00159 class PriorityBar : public PriorityLoop{
00160 public:
00161         PriorityBar(BarLoading *bar);
00162         ~PriorityBar();
00163         void Action_i(int i);
00164         virtual void RefreshForce();
00165 
00166 private:
00167         BarLoading *_bar;
00168 };
00169 */
00170 // ----------------------------------------------------------------------------
00171 // ----------------------------------------------------------------------------
00172 // ----------------------------------------------------------------------------
00173 
00174 WX_DEFINE_ARRAY(wxThread *, wxArrayThread);
00175 
00176 class AdminThreadEED{
00177 public:
00178         AdminThreadEED();
00179         ~AdminThreadEED();
00180 
00181         wxCriticalSection m_critsect;
00182     // all the threads currently alive - as soon as the thread terminates, it's
00183     // removed from the array
00184     wxArrayThread m_threads;
00185     // the last exiting thread should signal m_condAllDone if this is true
00186     // (protected by the same m_critsect)
00187     bool m_waitingUntilAllDone;
00188     wxCondition m_condAllDone;
00189     // the (mutex, condition) pair used to wait for the threads to exit, see
00190     // MyFrame::OnQuit()
00191     wxMutex m_mutexAllDone;
00192 
00193 private:
00194 };
00195 
00196 // ----------------------------------------------------------------------------
00197 // ----------------------------------------------------------------------------
00198 // ----------------------------------------------------------------------------
00199 
00200 class MyThread : public wxThread{
00201 public:
00202         MyThread(PriorityLoop *priorityLoop, AdminThreadEED *adminThreadEED);
00203     virtual void* Entry();
00204         virtual void  OnExit();
00205 private:
00206         PriorityLoop *_priorityLoop;
00207         AdminThreadEED *_adminThreadEED;
00208 };
00209 
00210 
00211 // ----------------------------------------------------------------------------
00212 // ----------------------------------------------------------------------------
00213 // ----------------------------------------------------------------------------
00214 
00215 class LoadRangeImage : public wxPanel, InterfaceVtkPanelWidgets{
00216 public:
00217         LoadRangeImage(wxWindow *parent,marFilesBase *marfilesbase/*,wxImageViewerWidget *imageViewerWidget*/);
00218         virtual ~LoadRangeImage();
00219 // EED Borrame
00220 //      void OnSliceStart(wxScrollEvent& event);
00221 //      void OnSliceEnd(wxScrollEvent& event);
00222         void OnSliceActual(wxScrollEvent& event);
00223         void OnBtnStart(wxCommandEvent& event);
00224         void OnBtnEnd(wxCommandEvent& event);
00225 //      void OnBtnResetRoi(wxCommandEvent& event);
00226         void Reset();
00227 
00228         void RefreshSlice();
00229         void SetActualSlice(int actual);
00230         int  GetActualSlice();
00231         void ResetActualSlice();
00232 
00233         virtual void CallBackOnMouseWheel( wxMouseEvent& event );
00234         void Start();
00235         void ForceToFinisReadActiveImages();
00236         void GetROI( int extent[6] );
00237         void SetStartEnd( int start, int end );
00238 
00239         //SIL//
00240         // --------------------------------------
00241         // Events captured form the barrange used configuring the ROI
00242         // --------------------------------------
00243         void  OnBarrange(wxCommandEvent& event);
00244         void  OnActualChange_BarRange(wxCommandEvent& event);
00245         void  OnStartChange_BarRange(wxCommandEvent& event);
00246         void  OnEndChange_BarRange(wxCommandEvent& event);
00247         void  OnBarMoved_BarRange(wxCommandEvent& event);
00248         void  OnSelectionEnd_BarRange(wxCommandEvent& event);
00249 
00250         void OnTimer(wxTimerEvent& event);
00251 
00252 private:
00253 
00254         wxTimer                         *_timer;
00255         bool                            reseteableActual;
00256         int                             _toShowSlice;
00257         int                             _maxZ;
00258         marFilesBase                    *_marfilesbase;
00259 // EED Borrame
00260 //      wxSlider                                *_sldStart;
00261 //      wxSlider                                *_sldEnd;
00262         int                                             _startSlice;
00263         int                                             _endSlice;
00264 //      wxSlider                                *_sldActual;
00265         BarLoading                              *_bar;
00266 
00267 // EED Borrame
00268 //      BarRange                                *_barRange;
00269 
00270         //SIL//
00271         mBarRange                               *_sl_barRange_ROI;
00272         PriorityLoadImageBar    *_priorityLoadImageBar;
00273         AdminThreadEED                  *_adminThreadEED;
00274         MyThread                                *_mythread;
00275 
00276         wxFlexGridSizer                 *_sizer1a;
00277         wxButton                                *_btnStart;
00278         wxButton                                *_btnEnd;
00279         wxStaticText                    *_textActual; 
00280 
00281 //      wxImageViewerWidget             *_imageViewerWidget;
00282 
00283         void    ResetLoadRegion();
00284         void    _Start();
00285         void    _Stop();
00286 
00287         void    SetStartSlice(int value);
00288         void    SetEndSlice(int value);
00289 
00290 
00291 };
00292 
00293 
00294 
00295 
00296 
00297 
00298 
00299 #endif // wx_Reading_Priority_Panel_H

Generated on Wed Jul 29 16:35:28 2009 for creaMaracasVisu_lib by  doxygen 1.5.3