Changeset 490 in Sophya for trunk/SophyaLib/NTools/cimage.cc
- Timestamp:
- Oct 21, 1999, 5:25:53 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/cimage.cc
r270 r490 5 5 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 6 6 7 // $Id: cimage.cc,v 1. 4 1999-04-27 15:03:01ansari Exp $7 // $Id: cimage.cc,v 1.5 1999-10-21 15:25:42 ansari Exp $ 8 8 9 9 … … 1069 1069 if(deb>0) cout<<"MoySigmaIter mean="<<mean<<" sigma="<<sigma 1070 1070 <<" npix="<<rc<<" entre "<<xmin<<","<<xmax<<endl; 1071 if( rc <= 0 ) return rc;1071 if( rc <= 0 || sigma<=0. ) return rc; 1072 1072 if( it>=1 && fabs((double)(sigma-sigmaold))/sigma < perdiff ) break; 1073 1073 xmin = mean - scut*sigma; if(testl && xmin<lowbad ) xmin = lowbad; … … 1213 1213 { 1214 1214 int i,j; 1215 int x,y; 1215 // int x,y; $CHECK$ Reza 21/06/99 changement de methode de calcul des bornes 1216 1216 const T1* pt_pim; 1217 1217 T2* pt_copie; … … 1221 1221 int step_pim_x; 1222 1222 int pim_siz_x, pim_siz_y; 1223 int copie_siz_x, copie_siz_y; 1223 // int copie_siz_x, copie_siz_y; $CHECK$ Reza 21/06/99 changement de methode de calcul des bornes 1224 1224 int switch_copie; 1225 1225 … … 1227 1227 pim_siz_y=pim.YSize(); 1228 1228 if((org_pim_x < 0) || (org_pim_x > pim_siz_x)) 1229 { cout<< "CopieImage_erreure : org_pim_x: " <<org_pim_x<<" < 0 ou > a "<<pim_siz_x<< "\n\n";1229 { cout<< "CopieImage_erreure : org_pim_x: " <<org_pim_x<<" < 0 ou > a "<<pim_siz_x<<endl; 1230 1230 THROW(rangeCheckErr);} 1231 1231 if((org_pim_y < 0) || (org_pim_y > pim_siz_y)) 1232 { cout<< "CopieImage_erreure : org_pim_y: " <<org_pim_y<<" < 0 ou > a "<<pim_siz_y<< "\n\n";1232 { cout<< "CopieImage_erreure : org_pim_y: " <<org_pim_y<<" < 0 ou > a "<<pim_siz_y<<endl; 1233 1233 THROW(rangeCheckErr);} 1234 1234 1235 copie_siz_x=copie.XSize(); 1236 copie_siz_y=copie.YSize(); 1237 if((org_copie_x < 0) || (org_copie_x > copie_siz_x)) 1238 { cout<< "CopieImage_erreure : org_copie_x: " <<org_copie_x<<" < 0 ou > a "<<copie_siz_x<<"\n\n"; 1235 if( (org_copie_x < 0) || (org_copie_x > copie.XSize()) ) 1236 { cout<< "CopieImage_erreure : org_copie_x: " <<org_copie_x<<" < 0 ou > a "<< copie.XSize() << endl; 1239 1237 THROW(rangeCheckErr);} 1240 if( (org_copie_y < 0) || (org_copie_y > copie_siz_y))1241 { cout<< "CopieImage_erreure : org_copie_y: " <<org_copie_y<<" < 0 ou > a "<< copie_siz_y<<"\n\n";1238 if( (org_copie_y < 0) || (org_copie_y > copie.YSize()) ) 1239 { cout<< "CopieImage_erreure : org_copie_y: " <<org_copie_y<<" < 0 ou > a "<< copie.YSize() << endl; 1242 1240 THROW(rangeCheckErr);} 1241 1242 /* $CHECK$ Reza 21/06/99 Changement de methode de calcul ------ 1243 $CHECK$ Reza 21/06/99 , je change la taille a copier en fonction de l'origine de copie 1244 copie_siz_x=copie.XSize()-org_copie_x; 1245 copie_siz_y=copie.YSize()-org_copie_y; 1243 1246 1244 1247 x=pim_lpav_x; … … 1268 1271 } 1269 1272 else 1270 { 1273 { 1271 1274 step_copie_x=copie_siz_x-l_copie_x; 1272 1275 } … … 1285 1288 } 1286 1289 1287 pt_pim = pim.ImagePtr()+org_pim_y*pim_siz_x+org_pim_x; 1288 pt_copie=copie.ImagePtr()+org_copie_y*copie_siz_x+org_copie_x; 1290 */ 1291 1292 l_copie_x = copie.XSize()-org_copie_x; 1293 l_copie_y = copie.YSize()-org_copie_y; 1294 if ( pim_lpav_x > (pim.XSize()-org_pim_x) ) pim_lpav_x = pim.XSize()-org_pim_x; 1295 if ( pim_lpav_y > (pim.YSize()-org_pim_y) ) pim_lpav_y = pim.YSize()-org_pim_y; 1296 if ( (pim_lpav_x > 0) && (l_copie_x > pim_lpav_x) ) l_copie_x = pim_lpav_x; 1297 if ( (pim_lpav_y > 0) && (l_copie_y > pim_lpav_y) ) l_copie_y = pim_lpav_y; 1298 step_pim_x = pim.XSize()-l_copie_x; 1299 step_copie_x = copie.XSize()-l_copie_x; 1300 1301 pt_pim = pim.ImagePtr() + org_pim_y*pim.XSize() + org_pim_x; 1302 pt_copie=copie.ImagePtr() + org_copie_y*copie.XSize() + org_copie_x; 1289 1303 1290 1304 switch((int)ConvType(*pt_pim,*pt_copie)) { … … 1361 1375 if (!pim.ImagePtr()) THROW(nullPtrErr); 1362 1376 if (!copie.ImagePtr()) THROW(nullPtrErr); 1363 copie.SetOrg(org_pim_x,org_pim_y); 1364 1365 /* $CHECK$ Reza 28/04/95 : Je protege pour le moment contre les pave en 1377 copie.SetOrg( pim.XOrg()+org_pim_x-org_copie_x, pim.YOrg()+org_pim_y-org_copie_y); 1378 // copie.SetOrg(org_pim_x,org_pim_y); 1379 1380 /* Reza 28/04/95 : Je protege pour le moment contre les pave en 1366 1381 dehors de l'image, mais je veux pouvoir copier des paves decale par 1367 rapport aux bornes de l'image source Re- $CHECK$ CMV+Reza 30/09/96 */ 1382 rapport aux bornes de l'image source Re- CMV+Reza 30/09/96 */ 1383 /* $CHECK$ Reza 21/06/99 - Ca devrait etre OK */ 1368 1384 if ( (org_pim_x < 0) || (org_pim_y < 0) || 1369 1385 (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() ) || 1370 1386 ((org_pim_x+copie.XSize()) > pim.XSize()) || 1371 ((org_pim_y+copie.YSize()) > pim.YSize()) ) copie.Zero(); 1372 if ( (org_pim_x < 0) || (org_pim_y < 0) || 1373 (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() )) return; 1387 ((org_pim_y+copie.YSize()) > pim.YSize()) ) copie.Zero(); 1388 1389 if ( (org_pim_x >= pim.XSize()) || (org_pim_y >= pim.YSize()) ) { 1390 copie.SetOrg( pim.XOrg()+org_pim_x-org_copie_x, pim.YOrg()+org_pim_y-org_copie_y); 1391 return; 1392 } 1393 // if ( (org_pim_x < 0) || (org_pim_y < 0) || 1394 // (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() )) return; 1395 1396 int oox = org_pim_x; 1397 int ooy = org_pim_y; 1398 int ocx = org_copie_x; 1399 int ocy = org_copie_y; 1400 if (oox < 0) { ocx -= oox; oox = 0; } 1401 if (ooy < 0) { ocy -= ooy; ooy = 0; } 1374 1402 /* Fin de $CHECK$ */ 1403 1404 // void CopieImageF(Image<T2>& copie, Image<T1> const& pim, 1405 // int org_pim_x, int org_pim_y, /* origine pave a copier */ 1406 // int pim_lpav_x, int pim_lpav_y, /* largeur pave a copier */ 1407 // int org_copie_x, int org_copie_y, /* origine copie */ 1408 // double cutmin, double cutmax) /* coupure pour max range*/ 1375 1409 1376 1410 if((pim_lpav_x <= 0) || (pim_lpav_x > pim.XSize())) pim_lpav_x=pim.XSize(); 1377 1411 if((pim_lpav_y <= 0) || (pim_lpav_y > pim.YSize())) pim_lpav_y=pim.YSize(); 1378 TRY{1379 CopieImageF(copie, pim, org_pim_x,org_pim_y,1412 try { 1413 CopieImageF(copie, pim, oox, ooy, 1380 1414 pim_lpav_x, pim_lpav_y, 1381 o rg_copie_x,org_copie_y,cutmin,cutmax);1415 ocx, ocy, cutmin,cutmax); 1382 1416 } catch(RangeCheckError) { 1383 // if (merr != rangeCheckErr) THROW(merr);Re- $CHECK$ CMV+Reza 30/09/961417 // $PLANCKCHECK$ if (merr != rangeCheckErr) THROW(merr); // Re- $CHECK$ CMV+Reza 30/09/96 1384 1418 } ENDTRY 1419 1420 copie.SetOrg( pim.XOrg()+org_pim_x-org_copie_x, pim.YOrg()+org_pim_y-org_copie_y); 1385 1421 } 1386 1422
Note:
See TracChangeset
for help on using the changeset viewer.