Changeset 3527 in Sophya for trunk/SophyaPI
- Timestamp:
- Oct 12, 2008, 6:57:14 PM (17 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/lut.cc
r3519 r3527 23 23 if (bornes == NULL) return; 24 24 type = typ; nLevel = nlev; 25 int qqq = 1; 26 quantum = 1; 27 for(quantum=2; quantum<=42; quantum++) { 28 qqq = quantum*quantum*quantum; 29 if (qqq > NCol()) break; 30 } 31 quantum--; 32 25 33 table = NULL; 26 34 tablenbin = 0; … … 47 55 bornes = new double[nlev+1]; 48 56 nLevel = nlev; 57 int qqq = 1; 58 quantum = 1; 59 for(quantum=2; quantum<=42; quantum++) { 60 qqq = quantum*quantum*quantum; 61 if (qqq > NCol()) break; 62 } 63 quantum--; 64 // printf("*DBG*LUT* quantum= %d \n", (int)quantum); 49 65 SetLut(min, max, Type()); 50 66 } … … 59 75 type = typ; 60 76 if (max <= min) max = min+1.; 77 mMin = min; mMax = max; 78 mMinI = (int)(min+0.1); mMaxI = (int)(max+0.1); 61 79 if (nLevel > 0) 62 80 { … … 125 143 { 126 144 long lv = x+0.3; 127 doubler = (lv%256);145 int r = (lv%256); 128 146 lv /= 256; 129 doubleg = (lv%256);147 int g = (lv%256); 130 148 lv /= 256; 131 double b = (lv%256); 132 int qqq = 1; 133 int quantum = 1; 134 for(quantum=2; quantum<=42; quantum++) { 135 qqq = quantum*quantum*quantum; 136 if (qqq > NCol()) break; 137 } 138 quantum--; 139 int ir = AppFast(r)*quantum/(NCol()); 140 int ig = AppFast(g)*quantum/(NCol()); 141 int ib = AppFast(b)*quantum/(NCol()); 142 return ((unsigned short)((ib*quantum+ig)*quantum+ir)); 149 int b = (lv%256); 150 return (unsigned short)((Contraste(b)*quantum+Contraste(g))*quantum+Contraste(r)); 143 151 } 144 152 -
trunk/SophyaPI/PI/lut.h
r3519 r3527 49 49 return(table[k]); 50 50 } 51 51 inline int Contraste(int ii) /* for ApplyRGB */ 52 { 53 if (ii >= mMaxI) return quantum-1; 54 if (ii <= mMinI) return 0; 55 else return ((ii-mMinI)*(quantum-1)/mMaxI); 56 } 52 57 int type; 53 58 int nLevel; 59 int quantum; 54 60 double * bornes; 61 double mMin, mMax; 62 int mMinI, mMaxI; 55 63 int tablenbin; 56 64 unsigned short * table; -
trunk/SophyaPI/PI/parradapter.cc
r3519 r3527 562 562 if (zm == 1) { // Pas de zoom 563 563 for(j=ofy; j<ofy+npy; j++) 564 for(i=ofx; i<ofx+npx; i++) 565 { *pp = (unsigned char) lut->ApplyFast( 566 this->Value(j*sgnX+offX, i*sgnY+offY)); 567 pp++; } 564 for(i=ofx; i<ofx+npx; i++) { 565 *pp = lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY)); pp++; 566 } 568 567 } 569 568 else if (zm < -1) { // Compression … … 578 577 for(j=ofy; j<ofy+npy; j++) 579 578 for(i=ofx; i<ofx+npx; i++) { 580 ucp = (unsigned char)lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY));579 ucp = lut->ApplyFast(this->Value(j*sgnX+offX, i*sgnY+offY)); 581 580 for(l=0; l<zm; l++) { 582 581 pp = pixc.ShortPointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm); … … 589 588 if (zm == 1) { // Pas de zoom 590 589 for(j=ofy; j<ofy+npy; j++) 591 for(i=ofx; i<ofx+npx; i++) 592 { *pp = (unsigned char) lut->ApplyFast( 593 this->Value(i*sgnX+offX, j*sgnY+offY)); 594 pp++; } 590 for(i=ofx; i<ofx+npx; i++) { 591 *pp = lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY)); pp++; 592 } 595 593 } 596 594 else if (zm < -1) { // Compression … … 605 603 for(j=ofy; j<ofy+npy; j++) 606 604 for(i=ofx; i<ofx+npx; i++) { 607 ucp = (unsigned char)lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY));605 ucp = lut->ApplyFast(this->Value(i*sgnX+offX, j*sgnY+offY)); 608 606 for(l=0; l<zm; l++) { 609 607 pp = pixc.ShortPointer()+((j-ofy)*zm+l)*nppx+((i-ofx)*zm); -
trunk/SophyaPI/PI/picmap.cc
r3519 r3527 597 597 int drgb = 65535/(nlev-1); 598 598 i = 0; 599 for(int kb=0; kb< 8; kb++) {599 for(int kb=0; kb<nlev; kb++) { 600 600 mycol.blue = (unsigned short)(kb*drgb); 601 for(int jg=0; jg< 8; jg++) {601 for(int jg=0; jg<nlev; jg++) { 602 602 mycol.green = (unsigned short)(jg*drgb); 603 for(int ir=0; ir< 8; ir++) {603 for(int ir=0; ir<nlev; ir++) { 604 604 mycol.red = (unsigned short)(ir*drgb); 605 605 AllocColor(mycol, i); i++; -
trunk/SophyaPI/PI/piimage.cc
r3519 r3527 625 625 double min = Lut()->Min(); 626 626 double max = Lut()->Max(); 627 size_t q = opts.find(',');628 if (q < opts.length()-1)629 sscanf(opts.substr(q+1).c_str(),"%lg,%lg",&min, &max);630 627 int typlut=kLutType_Lin; ; 631 628 if (opts.substr(4,3) == "lin") typlut=kLutType_Lin; … … 633 630 else if (opts.substr(4,4) == "sqrt") typlut=kLutType_Sqrt; 634 631 else if (opts.substr(4,6) == "square") typlut=kLutType_Square; 635 else if (opts.substr(4,6) == "rgb") typlut=kLutType_RGB; 632 else if (opts.substr(4,3) == "rgb") { 633 typlut=kLutType_RGB; 634 min = 0; max = 255; 635 } 636 size_t q = opts.find(','); 637 if (q < opts.length()-1) 638 sscanf(opts.substr(q+1).c_str(),"%lg,%lg",&min, &max); 639 636 640 SetLut(AutoLut_No, min, max, typlut, 0, false); 637 641 continue; -
trunk/SophyaPI/PI/piimgtools.cc
r3519 r3527 448 448 if ((lauto < 0) || (lauto > 12)) lauto = 12; 449 449 typ = mOpt[0]->GetValue() - 1100; 450 if ( (typ < 0) || (typ > 3) ) typ = 0;450 if ( (typ < 0) || (typ > 4) ) typ = 0; 451 451 (PIImage::CurrentPIImage())->SetLut(alts[lauto], min, max, typlut[typ], nsas[lauto]); 452 452 if (msg == 2500) {
Note:
See TracChangeset
for help on using the changeset viewer.