Changeset 389 in Sophya
- Timestamp:
- Aug 13, 1999, 4:00:53 PM (26 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piimage.cc
r343 r389 104 104 showinfo = false; 105 105 106 // Fenetre et ScDrawWdg pour les coupes 106 // Fenetre et ScDrawWdg pour les coupes 107 selcuts = 3; 107 108 cutwin = NULL; 108 109 cutscw = NULL; … … 317 318 cutarrx = new PIImg1DArrAdapter(); 318 319 cutarry = new PIImg1DArrAdapter(); 320 cutarrd = new PIImg1DArrAdapter(); 321 cutarra = new PIImg1DArrAdapter(); 319 322 PIYfXDrawer * drw; 323 string dum = ""; 320 324 drw = new PIYfXDrawer(cutarrx, NULL, true); 321 drw->SetColAtt(PI_Red); 322 drw->SetMarkerAtt(5, PI_CrossMarker); 323 drw->SetLineAtt(PI_ThinLine); 324 cutscw->AddScDrawer(drw, true); 325 drw->SetColAtt(PI_Red); 326 drw->SetMarkerAtt(5, PI_CrossMarker); 327 drw->SetLineAtt(PI_ThinLine); 328 cutscw->AddScDrawer(drw, true); 329 dum += "Red: X, "; 325 330 drw = new PIYfXDrawer(cutarry, NULL, true); 326 drw->SetColAtt(PI_Blue); 327 drw->SetMarkerAtt(5, PI_TriangleMarker); 328 drw->SetLineAtt(PI_ThinLine); 329 cutscw->AddScDrawer(drw, true); 330 cutscw->SetTitles("Red: X , Blue: Y"); 331 drw->SetColAtt(PI_Blue); 332 drw->SetMarkerAtt(5, PI_TriangleMarker); 333 drw->SetLineAtt(PI_ThinLine); 334 cutscw->AddScDrawer(drw, true); 335 dum += "Blue: Y, "; 336 drw = new PIYfXDrawer(cutarrd, NULL, true); 337 drw->SetColAtt(PI_Green); 338 drw->SetMarkerAtt(5, PI_PlusMarker); 339 drw->SetLineAtt(PI_ThinLine); 340 cutscw->AddScDrawer(drw, true); 341 dum += "Green: XY, "; 342 drw = new PIYfXDrawer(cutarra, NULL, true); 343 drw->SetColAtt(PI_Orange); 344 drw->SetMarkerAtt(5, PI_BoxMarker); 345 drw->SetLineAtt(PI_ThinLine); 346 cutscw->AddScDrawer(drw, true); 347 dum += "Orange: -XY"; 348 cutscw->SetTitles(dum.c_str()); 331 349 UpdateCuts(); 332 350 cutwin->Show(); … … 337 355 delete cutwin; 338 356 cutwin = NULL; 339 cutscw = NULL; 340 } 357 cutscw = NULL; 358 } 359 } 360 361 /* --Methode-- */ 362 void PIImage::SelectCuts(unsigned xyda) 363 // choix des cuts pour le display: 364 // 1=axe des (X), 2=axe des (Y), 4=diag (X,Y), 8=anti-diag (X,-Y) 365 { 366 selcuts = xyda; 367 if(!(selcuts&15)) selcuts = 3; 368 UpdateCuts(); 341 369 } 342 370 … … 959 987 if (!cutwin || !img) return; 960 988 961 int hsx, hsy; 989 int hsx, hsy, hsmin; 990 P2DArrayAdapter * img0=NULL; 962 991 hsx = XSzPave()/2; 963 992 hsy = YSzPave()/2; 964 cutarrx->SetData(img, false, 2*hsx+1, XPave(), YPave()); 965 cutarry->SetData(img, true, 2*hsy+1, XPave(), YPave()); 993 hsmin = (hsx<hsy)? hsx: hsy; 994 if(selcuts&1) img0=img; else img0=NULL; 995 cutarrx->SetData(img0, 1, 2*hsx+1, XPave(), YPave()); 996 if(selcuts&2) img0=img; else img0=NULL; 997 cutarry->SetData(img0, 2, 2*hsy+1, XPave(), YPave()); 998 if(selcuts&4) img0=img; else img0=NULL; 999 cutarrd->SetData(img0, 4, 2*hsmin+1, XPave(), YPave()); 1000 if(selcuts&8) img0=img; else img0=NULL; 1001 cutarra->SetData(img0, 8, 2*hsmin+1, XPave(), YPave()); 1002 966 1003 double x1,y1,x2,y2; 967 double xmin, xmax, ymin, ymax;968 1004 img->Coord(XPave()-hsx, YPave()-hsy, x1, y1); 969 1005 img->Coord(XPave()+hsx, YPave()+hsy, x2, y2); 970 if (x1 < x2) cutarrx->DefineXCoordinate(-cutarrx->Size()/2, 1.); 971 else cutarrx->DefineXCoordinate(cutarrx->Size()/2, -1.); 972 if (y1 < y2) cutarry->DefineXCoordinate(-cutarry->Size()/2, 1.); 973 else cutarry->DefineXCoordinate(cutarry->Size()/2, -1.); 1006 if(x1<x2) cutarrx->DefineXCoordinate(-cutarrx->Size()/2, 1.); 1007 else cutarrx->DefineXCoordinate( cutarrx->Size()/2, -1.); 1008 if(y1<y2) cutarry->DefineXCoordinate(-cutarry->Size()/2, 1.); 1009 else cutarry->DefineXCoordinate( cutarry->Size()/2, -1.); 1010 img->Coord(XPave()-hsmin, YPave()-hsmin, x1, y1); 1011 img->Coord(XPave()+hsmin, YPave()+hsmin, x2, y2); 1012 if(x1<x2) cutarrd->DefineXCoordinate(-cutarrd->Size()/2, 1.); 1013 else cutarrd->DefineXCoordinate( cutarrd->Size()/2, -1.); 1014 if(x1<x2) cutarra->DefineXCoordinate(-cutarra->Size()/2, 1.); 1015 else cutarra->DefineXCoordinate( cutarra->Size()/2, -1.); 974 1016 975 1017 // On calcule les limites : 976 if (cutarrx->Size() > cutarry->Size() ) { 977 xmax = cutarrx->Size()/2. + 1.; 978 xmin = -xmax; 979 } 980 else { 981 xmax = cutarry->Size()/2. + 1.; 982 xmin = -xmax; 983 } 984 985 int i; 986 double cv; 987 ymax = ymin = cutarrx->Value(0); 988 for(i=1; i<cutarrx->Size(); i++) { 989 cv = cutarrx->Value(i); 990 if (cv < ymin) ymin = cv; 991 if (cv > ymax) ymax = cv; 992 } 993 for(i=0; i<cutarry->Size(); i++) { 994 cv = cutarry->Value(i); 995 if (cv < ymin) ymin = cv; 996 if (cv > ymax) ymax = cv; 1018 double xmin=0., xmax=0., ymin=0., ymax=0.; bool vue=false; 1019 if(cutarrx->Size()) { 1020 if(!vue) vue=true; 1021 xmax=cutarrx->Size()/2.+1.; xmin=-xmax; 1022 } 1023 if(cutarry->Size()) { 1024 if(!vue) 1025 {vue=true; xmax=cutarry->Size()/2.+1.; xmin=-xmax;} 1026 else if(cutarry->Size()>xmax) 1027 {xmax=cutarry->Size()/2.+1.; xmin=-xmax;} 1028 } 1029 if(cutarrd->Size()) { 1030 if(!vue) 1031 {vue=true; xmax=cutarrd->Size()/2.+1.; xmin=-xmax;} 1032 else if(cutarrd->Size()>xmax) 1033 {xmax=cutarrd->Size()/2.+1.; xmin=-xmax;} 1034 } 1035 if(cutarra->Size()) { 1036 if(!vue) 1037 {vue=true; xmax=cutarra->Size()/2.+1.; xmin=-xmax;} 1038 else if(cutarra->Size()>xmax) 1039 {xmax=cutarra->Size()/2.+1.; xmin=-xmax;} 1040 } 1041 1042 int i; double cv; vue = false; 1043 if(cutarrx->Size()) { 1044 vue=true; ymax=ymin=cutarrx->Value(0); 1045 for(i=0; i<cutarrx->Size(); i++) { 1046 cv = cutarrx->Value(i); 1047 if (cv < ymin) ymin = cv; 1048 if (cv > ymax) ymax = cv; 1049 } 1050 } 1051 if(cutarry->Size()) { 1052 if(!vue) {vue=true; ymax=ymin=cutarry->Value(0);} 1053 for(i=0; i<cutarry->Size(); i++) { 1054 cv = cutarry->Value(i); 1055 if (cv < ymin) ymin = cv; 1056 if (cv > ymax) ymax = cv; 1057 } 1058 } 1059 if(cutarrd->Size()) { 1060 if(!vue) {vue=true; ymax=ymin=cutarrd->Value(0);} 1061 for(i=0; i<cutarrd->Size(); i++) { 1062 cv = cutarrd->Value(i); 1063 if (cv < ymin) ymin = cv; 1064 if (cv > ymax) ymax = cv; 1065 } 1066 } 1067 if(cutarra->Size()) { 1068 if(!vue) {vue=true; ymax=ymin=cutarra->Value(0);} 1069 for(i=0; i<cutarra->Size(); i++) { 1070 cv = cutarra->Value(i); 1071 if (cv < ymin) ymin = cv; 1072 if (cv > ymax) ymax = cv; 1073 } 997 1074 } 998 1075 ymin -= 0.05*(ymax-ymin); … … 1236 1313 { 1237 1314 data = NULL; 1238 fga y = false;1315 fgaxyda = 1; 1239 1316 off1 = off2 = 0; 1240 1317 } 1241 1318 1242 1319 /* --Methode-- */ 1243 void PIImage::PIImg1DArrAdapter::SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2) 1244 { 1245 data = d; 1246 fgay = ax; 1320 void PIImage::PIImg1DArrAdapter::SetData(P2DArrayAdapter* d, unsigned short axyda 1321 ,int sz,int o1,int o2) 1322 // axyda&1 axe (X), axyda&2 axe (Y), axyda&4 diag (X,Y), axyda&8 anti-diag (X,-Y) 1323 { 1324 data = d; mSize = 0; 1325 fgaxyda = axyda; 1326 if(!data) return; 1247 1327 if (o1 < 0) o1 = 0; 1248 1328 if (o2 < 0) o2 = 0; … … 1260 1340 { 1261 1341 if (!data) return(0.); 1262 int k; 1263 if (fgay) { 1342 int j,k; 1343 if (fgaxyda&1) { // Axe X 1344 j = off1-mSize/2+i; 1345 if (j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1; 1346 return((*data)(j,off2)); 1347 } 1348 else if (fgaxyda&2) { // Axe Y 1264 1349 k = off2-mSize/2+i; 1265 if (k < 0) k = 0; 1266 if (k >= data->YSize()) k = data->YSize()-1; 1267 return((*data)(off1, k)); 1268 } 1269 else { 1270 k = off1-mSize/2+i; 1271 if (k < 0) k = 0; 1272 if (k >= data->XSize()) k = data->XSize()-1; 1273 return((*data)(k, off2)); 1274 } 1275 } 1350 if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1; 1351 return((*data)(off1,k)); 1352 } 1353 else if (fgaxyda&4) { // Axe XY 1354 j = off1-mSize/2+i; 1355 k = off2-mSize/2+i; 1356 if(j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1; 1357 if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1; 1358 return((*data)(j,k)); 1359 } 1360 else if (fgaxyda&8) { // Axe -XY 1361 j = off1-mSize/2+i; 1362 k = off2+mSize/2-i; 1363 if(j<0) j=0; if(j>=data->XSize()) j=data->XSize()-1; 1364 if(k<0) k=0; if(k>=data->YSize()) k=data->YSize()-1; 1365 return((*data)(j,k)); 1366 } 1367 return(0.); 1368 } -
trunk/SophyaPI/PI/piimage.h
r329 r389 49 49 50 50 void ShowCuts(bool cuts=true); 51 void SelectCuts(unsigned xyda=3); 51 52 52 53 // Gestion du choix de LUT, facteur d agrandissement, table de couleur … … 110 111 PIImg1DArrAdapter(); 111 112 virtual double Value(int i); 112 virtual void SetData(P2DArrayAdapter* d, bool ax, int sz, int o1, int o2);113 virtual void SetData(P2DArrayAdapter* d, unsigned short axyda, int sz, int o1, int o2); 113 114 protected : 114 115 P2DArrayAdapter* data; 115 bool fgay;116 unsigned short fgaxyda; 116 117 int off1, off2; 117 118 }; … … 176 177 PIColors cucol; // Attribut de couleur du curseur 177 178 int xszpav, yszpav; 178 // Pour gerer une fenetre pour les coupes en X,Y 179 bool hascuts;179 // Pour gerer une fenetre pour les coupes en X,Y 180 unsigned short selcuts; 180 181 PIWindow * cutwin; 181 182 PIScDrawWdg * cutscw; 182 183 PIImg1DArrAdapter * cutarrx; 183 184 PIImg1DArrAdapter * cutarry; 185 PIImg1DArrAdapter * cutarrd; 186 PIImg1DArrAdapter * cutarra; 184 187 185 188 // buffer pour copier-coller -
trunk/SophyaPI/PI/piimgtools.cc
r316 r389 83 83 cpy += 2*spy+bsy; 84 84 cpx = 3*spx; 85 mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.75, bsy, cpx, cpy); 86 cpx += bsx*1.75+2*spx; 87 mBut[1] = new PIButton(this, "Dismiss", 2600, bsx*1.75, bsy, cpx, cpy); 85 mBut[0] = new PIButton(this, "Apply", 2500, bsx, bsy, cpx, cpy); 88 86 mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 87 cpx += bsx+2*spx; 88 mBut[1] = new PIButton(this, "Dismiss", 2600, bsx, bsy, cpx, cpy); 89 89 mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 90 cpx += bsx+2*spx; 91 mOptCut = new PIOptMenu(this, "Cut", bsx, bsy, cpx, cpy); 92 mOptCut->AppendItem("Cut X",301); 93 mOptCut->AppendItem("Cut Y",302); 94 mOptCut->AppendItem("CutXY",303); 95 mOptCut->AppendItem("Cut D",304); 96 mOptCut->AppendItem("Cut A",308); 97 mOptCut->AppendItem("CutDA",312); 98 mOptCut->AppendItem("CutAll",315); 99 mOptCut->SetValue(303); 100 mOptCut->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 90 101 91 102 int offy = cpy+bsy+spy*2; … … 217 228 for(i=0; i<3; i++) delete mButcax[i]; 218 229 for(i=0; i<5; i++) delete mButoa[i]; 219 230 delete mOptCut; 220 231 } 221 232 … … 243 254 mOptzc[0]->SetValue(203); 244 255 mOptzc[1]->SetValue(101); 256 mOptCut->SetValue(303); 245 257 return; 246 258 } … … 383 395 PIImage::CurrentPIImage()->SetColMapId(cmap[msg-201], true); 384 396 397 // Cuts 398 if(301<=msg && msg<=315) { 399 PIImage::CurrentPIImage()->SelectCuts((unsigned short) (msg-300)); 400 } 401 385 402 return; 386 403 } -
trunk/SophyaPI/PI/piimgtools.h
r119 r389 43 43 // Options show/hide 44 44 PIButton* mButoa[5]; 45 // Options Cuts 46 PIOptMenu* mOptCut; 45 47 }; 46 48
Note:
See TracChangeset
for help on using the changeset viewer.