Changeset 490 in Sophya for trunk/SophyaLib/NTools/cimage.cc


Ignore:
Timestamp:
Oct 21, 1999, 5:25:53 PM (26 years ago)
Author:
ansari
Message:

Merge avec PEIDA++ (~V 3.8) et nettoyage pour nouveau PPersist Reza+cmv 21/10/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/cimage.cc

    r270 r490  
    55// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    66
    7 // $Id: cimage.cc,v 1.4 1999-04-27 15:03:01 ansari Exp $       
     7// $Id: cimage.cc,v 1.5 1999-10-21 15:25:42 ansari Exp $       
    88
    99
     
    10691069  if(deb>0) cout<<"MoySigmaIter mean="<<mean<<" sigma="<<sigma
    10701070                <<" npix="<<rc<<" entre "<<xmin<<","<<xmax<<endl;
    1071   if( rc <= 0 ) return rc;
     1071  if( rc <= 0 || sigma<=0. ) return rc;
    10721072  if( it>=1 && fabs((double)(sigma-sigmaold))/sigma < perdiff ) break;
    10731073  xmin = mean - scut*sigma; if(testl && xmin<lowbad ) xmin = lowbad;
     
    12131213{
    12141214int i,j;
    1215 int x,y;
     1215// int x,y;  $CHECK$ Reza 21/06/99 changement de methode de calcul des bornes
    12161216const T1* pt_pim;
    12171217T2* pt_copie;
     
    12211221int step_pim_x;
    12221222int 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
    12241224int switch_copie;
    12251225
     
    12271227pim_siz_y=pim.YSize();
    12281228if((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;
    12301230    THROW(rangeCheckErr);}
    12311231if((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;
    12331233    THROW(rangeCheckErr);}
    12341234
    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";
     1235if( (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;
    12391237    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";
     1238if( (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;
    12421240    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
     1244copie_siz_x=copie.XSize()-org_copie_x;
     1245copie_siz_y=copie.YSize()-org_copie_y;
    12431246
    12441247x=pim_lpav_x;
     
    12681271    }
    12691272  else
    1270     {
     1273    { 
    12711274     step_copie_x=copie_siz_x-l_copie_x;
    12721275    }
     
    12851288   }
    12861289
    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
     1292l_copie_x = copie.XSize()-org_copie_x;
     1293l_copie_y = copie.YSize()-org_copie_y;
     1294if ( pim_lpav_x > (pim.XSize()-org_pim_x) )  pim_lpav_x = pim.XSize()-org_pim_x;
     1295if ( pim_lpav_y > (pim.YSize()-org_pim_y) )  pim_lpav_y = pim.YSize()-org_pim_y;
     1296if ( (pim_lpav_x > 0) && (l_copie_x > pim_lpav_x) )  l_copie_x = pim_lpav_x;
     1297if ( (pim_lpav_y > 0) && (l_copie_y > pim_lpav_y) )  l_copie_y = pim_lpav_y;
     1298step_pim_x = pim.XSize()-l_copie_x;
     1299step_copie_x = copie.XSize()-l_copie_x;
     1300
     1301pt_pim  = pim.ImagePtr() + org_pim_y*pim.XSize() + org_pim_x;
     1302pt_copie=copie.ImagePtr() + org_copie_y*copie.XSize() + org_copie_x;
    12891303
    12901304switch((int)ConvType(*pt_pim,*pt_copie)) {
     
    13611375if (!pim.ImagePtr())   THROW(nullPtrErr);
    13621376if (!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
     1377copie.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
    13661381dehors 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 */
     1382rapport aux bornes de l'image source  Re- CMV+Reza 30/09/96 */
     1383/* $CHECK$ Reza 21/06/99 - Ca devrait etre OK  */
    13681384if ( (org_pim_x < 0) || (org_pim_y < 0) ||
    13691385     (org_pim_x >= pim.XSize() ) || (org_pim_y >= pim.YSize() ) ||
    13701386     ((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
     1389if ( (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
     1396int oox = org_pim_x;
     1397int ooy = org_pim_y;
     1398int ocx = org_copie_x;
     1399int ocy = org_copie_y;
     1400if (oox < 0)  { ocx -= oox;  oox = 0; }
     1401if (ooy < 0)  { ocy -= ooy;  ooy = 0; }
    13741402/*  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*/
    13751409
    13761410if((pim_lpav_x <= 0) || (pim_lpav_x > pim.XSize())) pim_lpav_x=pim.XSize();
    13771411if((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,
     1412try {
     1413  CopieImageF(copie, pim, oox, ooy,
    13801414              pim_lpav_x, pim_lpav_y,
    1381               org_copie_x,org_copie_y,cutmin,cutmax);
     1415              ocx, ocy, cutmin,cutmax);
    13821416  }  catch(RangeCheckError) {
    1383       // if (merr != rangeCheckErr) THROW(merr);  Re- $CHECK$ CMV+Reza 30/09/96
     1417// $PLANCKCHECK$   if (merr != rangeCheckErr) THROW(merr);  // Re- $CHECK$ CMV+Reza 30/09/96
    13841418  } ENDTRY
     1419
     1420copie.SetOrg( pim.XOrg()+org_pim_x-org_copie_x, pim.YOrg()+org_pim_y-org_copie_y);
    13851421}
    13861422
Note: See TracChangeset for help on using the changeset viewer.