#include <wxReadingPriorityPanel.h>
Public Member Functions | |
PriorityLoop () | |
virtual | ~PriorityLoop () |
void | SetStartEndActualMax (int start, int end, int actual, int deltaImg, int maxImages) |
void | Iteration () |
void | InitLoop () |
void | StopLoop () |
bool | IsLoop () |
void | WaitUntil_i_isDone (int i) |
void | WaitUntil_segment_isDone (int start, int end, bool forceEndLoopRegion=true) |
void | ForceEndLoopRegion () |
virtual void | Action_i (int i) |
virtual void | RefreshForce () |
Private Member Functions | |
int | Get_i_image () |
int | Geti (int id, int step, int start, int actualg, int actuald, int end) |
bool | _Action_i (int i) |
void | Create_Empty_Vector () |
void | InitConfiguration () |
bool | _ForceEndLoopRegion () |
void | NeedToChange () |
Private Attributes | |
int | _start |
int | _end |
int | _actual |
int | _deltaImg |
int | _maxImages |
int | _tstart |
int | _tend |
int | _tactual |
int | _tdeltaImg |
int | _tmaxImages |
int | _counterReading |
int | _max_p |
bool | _loadingSerie |
int | _forceReadRegion |
int | _i_forceReadReagion |
bool | _needToChange |
int | _priority |
int | _priorityType |
bool | _dg [5] |
int | _counterActual [5] |
bool * | _vecIdImage |
Definition at line 24 of file wxReadingPriorityPanel.h.
PriorityLoop::PriorityLoop | ( | ) |
Definition at line 29 of file wxReadingPriorityPanel.cpp.
References _deltaImg, _forceReadRegion, _i_forceReadReagion, _loadingSerie, _needToChange, and _vecIdImage.
00029 { 00030 _vecIdImage = NULL; 00031 _loadingSerie = false; 00032 _forceReadRegion = false; 00033 _i_forceReadReagion = -1; 00034 _needToChange = false; 00035 _deltaImg = 0; 00036 }
PriorityLoop::~PriorityLoop | ( | ) | [virtual] |
Definition at line 38 of file wxReadingPriorityPanel.cpp.
References _vecIdImage.
00038 { 00039 if (_vecIdImage!=NULL) { 00040 free(_vecIdImage); 00041 } 00042 }
bool PriorityLoop::_Action_i | ( | int | i | ) | [private] |
Definition at line 148 of file wxReadingPriorityPanel.cpp.
References _maxImages, _vecIdImage, and Action_i().
Referenced by _ForceEndLoopRegion(), and Iteration().
00148 { 00149 bool ok=false; 00150 if (i!=-1) { 00151 if ((i>=0) && (i<_maxImages)){ 00152 if (_vecIdImage[i]==false ) { 00153 Action_i(i); 00154 _vecIdImage[i]=true; 00155 ok=true; 00156 } 00157 } 00158 } 00159 return ok; 00160 }
bool PriorityLoop::_ForceEndLoopRegion | ( | ) | [private] |
Definition at line 88 of file wxReadingPriorityPanel.cpp.
References _Action_i(), _end, _i_forceReadReagion, and _start.
Referenced by Iteration().
00088 { 00089 bool ok=true; 00090 if (_i_forceReadReagion==-1){ 00091 _i_forceReadReagion=_start; 00092 } 00093 _Action_i( _i_forceReadReagion ); 00094 _i_forceReadReagion++; 00095 if (_i_forceReadReagion>_end){ 00096 ok=false; 00097 } 00098 return ok; 00099 }
void PriorityLoop::Action_i | ( | int | i | ) | [virtual] |
Reimplemented in PriorityLoadImageBar.
Definition at line 163 of file wxReadingPriorityPanel.cpp.
Referenced by _Action_i().
void PriorityLoop::Create_Empty_Vector | ( | ) | [private] |
Definition at line 101 of file wxReadingPriorityPanel.cpp.
References _maxImages, and _vecIdImage.
Referenced by InitLoop().
00101 { 00102 if (_vecIdImage!=NULL) { 00103 free(_vecIdImage); 00104 } 00105 _vecIdImage = (bool*)malloc(sizeof(bool)*(_maxImages+1) ); 00106 int i; 00107 for (i=0; i<=_maxImages;i++){ 00108 _vecIdImage[i]=false; 00109 } 00110 00111 }
void PriorityLoop::ForceEndLoopRegion | ( | ) |
Definition at line 52 of file wxReadingPriorityPanel.cpp.
References _forceReadRegion.
Referenced by WaitUntil_segment_isDone().
00052 { 00053 _forceReadRegion=true; 00054 }
int PriorityLoop::Get_i_image | ( | ) | [private] |
Definition at line 167 of file wxReadingPriorityPanel.cpp.
References _actual, _end, _maxImages, _priority, _priorityType, _start, and Geti().
Referenced by Iteration().
00167 { 00168 int p=4; 00169 00170 int i=-1; 00171 while ((i==-1) || (p==4) ){ 00172 if (_priorityType==0){ 00173 if ((_priority<=9) && (_priority>=5)) { p=0; } 00174 if ((_priority<=4) && (_priority>=2)) { p=1; } 00175 if ((_priority<=1) && (_priority>=0)) { p=2; } 00176 } 00177 if (_priorityType==1){ 00178 if ((_priority<=9) && (_priority>=4)) { p=1; } 00179 if ((_priority<=3) && (_priority>=2)) { p=2; } 00180 if ((_priority<=1) && (_priority>=0)) { p=3; } 00181 } 00182 if (_priorityType==2){ 00183 if ((_priority<=9) && (_priority>=3)) { p=2; } 00184 if ((_priority<=2) && (_priority>=0)) { p=3; } 00185 } 00186 if (_priorityType==3){ 00187 if ((_priority<=9) && (_priority>=0)) { p=3; } 00188 } 00189 if (_priorityType==4){ 00190 p=4; 00191 } 00192 _priority--; 00193 if (_priority==-1) {_priority=9;} 00194 00195 if (p==0) { i=Geti(p,5,_start,_actual ,_actual ,_end); } 00196 if (p==1) { i=Geti(p,1,_start,_actual ,_actual ,_end); } 00197 if (p==2) { i=Geti(p,5,0 ,_start ,_end ,_maxImages); } 00198 if (p==3) { i=Geti(p,1,0 ,_start ,_end ,_maxImages); } 00199 if (p==4) { i=Geti(p,1,0 ,_maxImages ,_maxImages ,_maxImages); } 00200 00201 if ((_priorityType==0) && (p==0) && (i==-1)) { _priorityType++; _priority=9; } 00202 if ((_priorityType==1) && (p==1) && (i==-1)) { _priorityType++; _priority=9; } 00203 if ((_priorityType==2) && (p==2) && (i==-1)) { _priorityType++; _priority=9; } 00204 if ((_priorityType==3) && (p==3) && (i==-1)) { _priorityType++; _priority=9; } 00205 } 00206 return i; 00207 }
int PriorityLoop::Geti | ( | int | id, | |
int | step, | |||
int | start, | |||
int | actualg, | |||
int | actuald, | |||
int | end | |||
) | [private] |
Definition at line 211 of file wxReadingPriorityPanel.cpp.
References _counterActual, _dg, and _vecIdImage.
Referenced by Get_i_image().
00211 { 00212 int tempig=0; 00213 int tempid=0; 00214 int i=-2; 00215 while (i==-2){ 00216 if (_dg[id]==true) { _counterActual[id] = _counterActual[id]+step; } 00217 tempig=actualg - _counterActual[id]; 00218 tempid=actuald + _counterActual[id]; 00219 if (_dg[id]==true){ 00220 if (tempig>=start) { 00221 if (_vecIdImage[tempig]==false ) { 00222 i=tempig; 00223 } 00224 } 00225 } 00226 if (_dg[id]==false){ 00227 if (tempid<=end) { 00228 if (_vecIdImage[tempid]==false ) { 00229 i=tempid; 00230 } 00231 } 00232 } 00233 if ((tempig<start) && (tempid>end)){ 00234 i=-1; 00235 } 00236 _dg[id]=!_dg[id]; 00237 } 00238 return i; 00239 }
void PriorityLoop::InitConfiguration | ( | ) | [private] |
Definition at line 136 of file wxReadingPriorityPanel.cpp.
References _counterActual, _dg, _forceReadRegion, _priority, _priorityType, and PriorityLoadImage_MAX_P.
Referenced by InitLoop(), and NeedToChange().
00136 { 00137 _forceReadRegion=false; 00138 int i; 00139 for (i=0;i<PriorityLoadImage_MAX_P;i++){ 00140 _dg[i]=false; 00141 _counterActual[i]=0; 00142 } 00143 _priorityType=0; 00144 _priority=9; 00145 }
void PriorityLoop::InitLoop | ( | ) |
Definition at line 57 of file wxReadingPriorityPanel.cpp.
References _counterReading, _loadingSerie, Create_Empty_Vector(), InitConfiguration(), and NeedToChange().
Referenced by MyThread::Entry().
00057 { 00058 _loadingSerie = true; 00059 NeedToChange(); 00060 Create_Empty_Vector(); 00061 InitConfiguration(); 00062 _counterReading = 0; 00063 }
bool PriorityLoop::IsLoop | ( | ) |
Definition at line 48 of file wxReadingPriorityPanel.cpp.
References _loadingSerie.
Referenced by MyThread::Entry().
00048 { 00049 return _loadingSerie; 00050 }
void PriorityLoop::Iteration | ( | ) |
Definition at line 66 of file wxReadingPriorityPanel.cpp.
References _Action_i(), _counterReading, _deltaImg, _ForceEndLoopRegion(), _forceReadRegion, _loadingSerie, _maxImages, Get_i_image(), and NeedToChange().
Referenced by MyThread::Entry().
00066 { 00067 00068 NeedToChange(); 00069 00070 if (_forceReadRegion==false){ 00071 int ii,i=Get_i_image(); 00072 for (ii=i-_deltaImg;ii<=i+_deltaImg;ii++){ 00073 if (_Action_i( ii )==true){ 00074 _counterReading++; 00075 } 00076 } 00077 } else { 00078 _loadingSerie=_ForceEndLoopRegion(); 00079 } 00080 00081 if (_counterReading==_maxImages){ 00082 _loadingSerie=false; 00083 } 00084 00085 }
void PriorityLoop::NeedToChange | ( | ) | [private] |
Definition at line 123 of file wxReadingPriorityPanel.cpp.
References _actual, _deltaImg, _end, _maxImages, _needToChange, _start, _tactual, _tdeltaImg, _tend, _tmaxImages, _tstart, and InitConfiguration().
Referenced by InitLoop(), and Iteration().
00123 { 00124 if (_needToChange==true){ 00125 _needToChange = false; 00126 _start = _tstart; 00127 _end = _tend; 00128 _actual = _tactual; 00129 _deltaImg = _tdeltaImg; 00130 _maxImages = _tmaxImages; 00131 InitConfiguration(); 00132 } 00133 }
virtual void PriorityLoop::RefreshForce | ( | ) | [inline, virtual] |
Reimplemented in PriorityLoadImageBar.
Definition at line 38 of file wxReadingPriorityPanel.h.
Referenced by WaitUntil_segment_isDone().
void PriorityLoop::SetStartEndActualMax | ( | int | start, | |
int | end, | |||
int | actual, | |||
int | deltaImg, | |||
int | maxImages | |||
) |
Definition at line 114 of file wxReadingPriorityPanel.cpp.
References _needToChange, _tactual, _tdeltaImg, _tend, _tmaxImages, and _tstart.
Referenced by LoadRangeImage::ResetLoadRegion().
00114 { 00115 _tstart = start; 00116 _tend = end; 00117 _tactual = actual; 00118 _tdeltaImg = deltaImg; 00119 _tmaxImages = maxImages; 00120 _needToChange = true; 00121 }
void PriorityLoop::StopLoop | ( | ) |
Definition at line 44 of file wxReadingPriorityPanel.cpp.
References _loadingSerie.
Referenced by MyThread::OnExit().
00044 { 00045 _loadingSerie = false; 00046 }
void PriorityLoop::WaitUntil_i_isDone | ( | int | i | ) |
Definition at line 241 of file wxReadingPriorityPanel.cpp.
References _deltaImg, and WaitUntil_segment_isDone().
Referenced by LoadRangeImage::RefreshSlice().
00241 { 00242 WaitUntil_segment_isDone(i-_deltaImg,i+_deltaImg,false); 00243 }
void PriorityLoop::WaitUntil_segment_isDone | ( | int | start, | |
int | end, | |||
bool | forceEndLoopRegion = true | |||
) |
Definition at line 245 of file wxReadingPriorityPanel.cpp.
References _loadingSerie, _maxImages, _vecIdImage, ForceEndLoopRegion(), and RefreshForce().
Referenced by LoadRangeImage::ForceToFinisReadActiveImages(), and WaitUntil_i_isDone().
00245 { 00246 if (forceEndLoopRegion==true) { ForceEndLoopRegion(); } 00247 if (_loadingSerie==true){ 00248 int s=start,e=end; 00249 if (s<0){ 00250 s=0; 00251 } 00252 if (e>_maxImages-1){ 00253 e=_maxImages-1; 00254 } 00255 bool ok=false; 00256 while (ok==false){ 00257 int i; 00258 ok=true; 00259 for (i=s;i<=e;i++){ 00260 ok = ok && _vecIdImage[i]; 00261 } 00262 if (ok==false) { 00263 RefreshForce(); 00264 wxThread::Sleep(100); 00265 } 00266 } 00267 } 00268 }
int PriorityLoop::_actual [private] |
Definition at line 45 of file wxReadingPriorityPanel.h.
Referenced by Get_i_image(), and NeedToChange().
int PriorityLoop::_counterActual[5] [private] |
Definition at line 64 of file wxReadingPriorityPanel.h.
Referenced by Geti(), and InitConfiguration().
int PriorityLoop::_counterReading [private] |
Definition at line 54 of file wxReadingPriorityPanel.h.
Referenced by InitLoop(), and Iteration().
int PriorityLoop::_deltaImg [private] |
Definition at line 46 of file wxReadingPriorityPanel.h.
Referenced by Iteration(), NeedToChange(), PriorityLoop(), and WaitUntil_i_isDone().
bool PriorityLoop::_dg[5] [private] |
Definition at line 63 of file wxReadingPriorityPanel.h.
Referenced by Geti(), and InitConfiguration().
int PriorityLoop::_end [private] |
Definition at line 44 of file wxReadingPriorityPanel.h.
Referenced by _ForceEndLoopRegion(), Get_i_image(), and NeedToChange().
int PriorityLoop::_forceReadRegion [private] |
Definition at line 57 of file wxReadingPriorityPanel.h.
Referenced by ForceEndLoopRegion(), InitConfiguration(), Iteration(), and PriorityLoop().
int PriorityLoop::_i_forceReadReagion [private] |
Definition at line 58 of file wxReadingPriorityPanel.h.
Referenced by _ForceEndLoopRegion(), and PriorityLoop().
bool PriorityLoop::_loadingSerie [private] |
Definition at line 56 of file wxReadingPriorityPanel.h.
Referenced by InitLoop(), IsLoop(), Iteration(), PriorityLoop(), StopLoop(), and WaitUntil_segment_isDone().
int PriorityLoop::_max_p [private] |
Definition at line 55 of file wxReadingPriorityPanel.h.
int PriorityLoop::_maxImages [private] |
Definition at line 47 of file wxReadingPriorityPanel.h.
Referenced by _Action_i(), Create_Empty_Vector(), Get_i_image(), Iteration(), NeedToChange(), and WaitUntil_segment_isDone().
bool PriorityLoop::_needToChange [private] |
Definition at line 59 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), PriorityLoop(), and SetStartEndActualMax().
int PriorityLoop::_priority [private] |
Definition at line 61 of file wxReadingPriorityPanel.h.
Referenced by Get_i_image(), and InitConfiguration().
int PriorityLoop::_priorityType [private] |
Definition at line 62 of file wxReadingPriorityPanel.h.
Referenced by Get_i_image(), and InitConfiguration().
int PriorityLoop::_start [private] |
Definition at line 38 of file wxReadingPriorityPanel.h.
Referenced by _ForceEndLoopRegion(), Get_i_image(), and NeedToChange().
int PriorityLoop::_tactual [private] |
Definition at line 50 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), and SetStartEndActualMax().
int PriorityLoop::_tdeltaImg [private] |
Definition at line 51 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), and SetStartEndActualMax().
int PriorityLoop::_tend [private] |
Definition at line 49 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), and SetStartEndActualMax().
int PriorityLoop::_tmaxImages [private] |
Definition at line 52 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), and SetStartEndActualMax().
int PriorityLoop::_tstart [private] |
Definition at line 48 of file wxReadingPriorityPanel.h.
Referenced by NeedToChange(), and SetStartEndActualMax().
bool* PriorityLoop::_vecIdImage [private] |
Definition at line 65 of file wxReadingPriorityPanel.h.
Referenced by _Action_i(), Create_Empty_Vector(), Geti(), PriorityLoop(), WaitUntil_segment_isDone(), and ~PriorityLoop().