2 #ifndef wx_Reading_Priority_Panel_H
3 #define wx_Reading_Priority_Panel_H
11 // #include "wxImageViewerWidget.h"
12 #include "InterfaceVtkPanelWidgets.h"
14 #include "marGdcmDicom.h"
15 #include "pPlotter/mBarRange.h"//SIL//
17 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
22 #define PriorityLoadImage_MAX_P 5
27 virtual ~PriorityLoop();
28 void SetStartEndActualMax(int start,int end, int actual,int deltaImg, int maxImages);
34 void WaitUntil_i_isDone(int i);
35 void WaitUntil_segment_isDone(int start, int end,bool forceEndLoopRegion=true);
36 void ForceEndLoopRegion();
37 virtual void Action_i( int i );
38 virtual void RefreshForce() {};
58 int _i_forceReadReagion;
63 bool _dg[PriorityLoadImage_MAX_P]; // right - left
64 int _counterActual[PriorityLoadImage_MAX_P]; //
68 int Geti(int id,int step,int start,int actualg,int actuald,int end);
69 bool _Action_i( int i );
70 void Create_Empty_Vector();
71 void InitConfiguration();
72 bool _ForceEndLoopRegion();
76 // ----------------------------------------------------------------------------
77 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
80 class BarLoading :public wxPanel{
82 BarLoading(wxWindow *parent, int w, int h);
83 virtual ~BarLoading();
87 virtual void OnPaint( wxPaintEvent &WXUNUSED(event) );
88 void SetSizeData(int sizeData);
91 std::vector<int> lstInt;
98 DECLARE_CLASS(BarLoading)
99 // any class wishing to process wxWindows events must use this macro
100 DECLARE_EVENT_TABLE()
104 // ----------------------------------------------------------------------------
105 // ----------------------------------------------------------------------------
106 // ----------------------------------------------------------------------------
108 class BarRange :public wxPanel{
110 BarRange(wxWindow *parent, int w, int h);
112 void SetActual(int i);
113 void SetStart(int i);
116 void OnPaint( wxPaintEvent &WXUNUSED(event) );
128 DECLARE_CLASS(BarRange)
129 // any class wishing to process wxWindows events must use this macro
130 DECLARE_EVENT_TABLE()
135 // ----------------------------------------------------------------------------
136 // ----------------------------------------------------------------------------
137 // ----------------------------------------------------------------------------
139 class PriorityLoadImageBar : public PriorityLoop{
141 PriorityLoadImageBar(marFilesBase *marfilesbase, BarLoading *bar);
142 virtual ~PriorityLoadImageBar();
143 void Action_i(int i);
144 virtual void RefreshForce();
147 marFilesBase *_marfilesbase;
154 // ----------------------------------------------------------------------------
155 // ----------------------------------------------------------------------------
156 // ----------------------------------------------------------------------------
159 class PriorityBar : public PriorityLoop{
161 PriorityBar(BarLoading *bar);
163 void Action_i(int i);
164 virtual void RefreshForce();
170 // ----------------------------------------------------------------------------
171 // ----------------------------------------------------------------------------
172 // ----------------------------------------------------------------------------
174 WX_DEFINE_ARRAY(wxThread *, wxArrayThread);
176 class AdminThreadEED{
181 wxCriticalSection m_critsect;
182 // all the threads currently alive - as soon as the thread terminates, it's
183 // removed from the array
184 wxArrayThread m_threads;
185 // the last exiting thread should signal m_condAllDone if this is true
186 // (protected by the same m_critsect)
187 bool m_waitingUntilAllDone;
188 wxCondition m_condAllDone;
189 // the (mutex, condition) pair used to wait for the threads to exit, see
191 wxMutex m_mutexAllDone;
196 // ----------------------------------------------------------------------------
197 // ----------------------------------------------------------------------------
198 // ----------------------------------------------------------------------------
200 class MyThread : public wxThread{
202 MyThread(PriorityLoop *priorityLoop, AdminThreadEED *adminThreadEED);
203 virtual void* Entry();
204 virtual void OnExit();
206 PriorityLoop *_priorityLoop;
207 AdminThreadEED *_adminThreadEED;
211 // ----------------------------------------------------------------------------
212 // ----------------------------------------------------------------------------
213 // ----------------------------------------------------------------------------
215 class LoadRangeImage : public wxPanel, InterfaceVtkPanelWidgets{
217 LoadRangeImage(wxWindow *parent,marFilesBase *marfilesbase/*,wxImageViewerWidget *imageViewerWidget*/);
218 virtual ~LoadRangeImage();
220 // void OnSliceStart(wxScrollEvent& event);
221 // void OnSliceEnd(wxScrollEvent& event);
222 void OnSliceActual(wxScrollEvent& event);
223 void OnBtnStart(wxCommandEvent& event);
224 void OnBtnEnd(wxCommandEvent& event);
225 // void OnBtnResetRoi(wxCommandEvent& event);
229 void SetActualSlice(int actual);
230 int GetActualSlice();
231 void ResetActualSlice();
233 virtual void CallBackOnMouseWheel( wxMouseEvent& event );
235 void ForceToFinisReadActiveImages();
236 void GetROI( int extent[6] );
237 void SetStartEnd( int start, int end );
240 // --------------------------------------
241 // Events captured form the barrange used configuring the ROI
242 // --------------------------------------
243 void OnBarrange(wxCommandEvent& event);
244 void OnActualChange_BarRange(wxCommandEvent& event);
245 void OnStartChange_BarRange(wxCommandEvent& event);
246 void OnEndChange_BarRange(wxCommandEvent& event);
247 void OnBarMoved_BarRange(wxCommandEvent& event);
248 void OnSelectionEnd_BarRange(wxCommandEvent& event);
250 void OnTimer(wxTimerEvent& event);
255 bool reseteableActual;
258 marFilesBase *_marfilesbase;
260 // wxSlider *_sldStart;
261 // wxSlider *_sldEnd;
264 // wxSlider *_sldActual;
268 // BarRange *_barRange;
271 mBarRange *_sl_barRange_ROI;
272 PriorityLoadImageBar *_priorityLoadImageBar;
273 AdminThreadEED *_adminThreadEED;
276 wxFlexGridSizer *_sizer1a;
279 wxStaticText *_textActual;
281 // wxImageViewerWidget *_imageViewerWidget;
283 void ResetLoadRegion();
287 void SetStartSlice(int value);
288 void SetEndSlice(int value);
299 #endif // wx_Reading_Priority_Panel_H