Changeset 1503 in Sophya
- Timestamp:
- May 21, 2001, 3:09:26 PM (24 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/lut.cc
r1129 r1503 25 25 if (bornes == NULL) return; 26 26 type = typ; nLevel = nlev; 27 table = NULL; 28 tablenbin = 0; 27 29 SetLut(min, max, typ); 28 table = NULL;29 ComputeTable(ntable);30 30 return; 31 31 } … … 40 40 41 41 /* --Methode-- */ 42 void LUT::SetLut(double min, double max, int typ )42 void LUT::SetLut(double min, double max, int typ, int ntable) 43 43 { 44 44 … … 83 83 } 84 84 else bornes[0] = 0.5*(min+max); 85 ComputeTable((ntable > nLevel) ? ntable : tablenbin); 85 86 return; 86 87 } … … 110 111 void LUT::ComputeTable(int nt) 111 112 { 112 if (nt < 0) nt = 16*(nLevel+2);113 if (nt <= 0) nt = 16*(nLevel+2); 113 114 else if (nt < (nLevel+2)) nt = (nLevel+2); 115 tablenbin = nt; 114 116 table = new unsigned short [nt-2]; 115 117 tablebinwidth = (Max()-Min())/(nt-2); -
trunk/SophyaPI/PI/lut.h
r1129 r1503 19 19 public: 20 20 21 LUT(double min, double max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable= -1);21 LUT(double min, double max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable=0); 22 22 ~LUT(); 23 void SetLut(double min, double max, int typ= 0);23 void SetLut(double min, double max, int typ=kLutType_Lin, int ntable=0); 24 24 void Print(); 25 25 unsigned short Apply(double x); … … 43 43 int nLevel; 44 44 double * bornes; 45 int tablenbin; 45 46 unsigned short * table; 46 47 double tablebinwidth; -
trunk/SophyaPI/PI/picmap.cc
r1132 r1503 76 76 if ( (num < 0) || (num >= MXMAPIDS) ) num = 0; 77 77 return (MapNoms[num]) ; 78 } 79 80 int PIColorMap::ColorMapId2Num(PIColorMap const & cmap) 81 { 82 for(int k=0; k<MXMAPIDS; k++) 83 if (cmap.Type() == MapIds[k]) return(k); 84 return(-1); 78 85 } 79 86 … … 182 189 183 190 PIColorMap::PIColorMap(PIColorMap& cm) 191 : PIColorMapNative() 184 192 { 193 ReverseColorIndex(cm.IsColorIndexReversed()); 185 194 CopyFrom(&cm); 186 195 mCTId = cm.mCTId; -
trunk/SophyaPI/PI/picmap.h
r1129 r1503 53 53 static CMapId GetStandardColorMapId(int num); 54 54 static string GetStandardColorMapName(int num); 55 static int ColorMapId2Num(PIColorMap const & cmap); 55 56 56 57 protected: -
trunk/SophyaPI/PI/picmapgen.cc
r440 r1503 13 13 mNCol = 0; 14 14 mType = -1; 15 ReverseColorIndex(false); 15 16 } 16 17 PIColorMapGen::PIColorMapGen(int id, int nc, string const& nom) … … 19 20 mNCol = nc; 20 21 mType = id; 22 ReverseColorIndex(false); 21 23 } 22 24 -
trunk/SophyaPI/PI/picmapgen.h
r440 r1503 24 24 25 25 virtual PIColor GetColor(int n)=0; 26 inline void ReverseColorIndex(bool fg=false) 27 { mFlagReversedIndex = fg; } 28 inline bool IsColorIndexReversed() const 29 { return(mFlagReversedIndex); } 26 30 virtual bool AllocColor(PIColor const& col, int index)=0; 27 31 virtual void FreeColors()=0; // Desalloue les couleurs 28 32 29 virtual long TotNbColors()=0;// Donne le nombre total de couleurs disponibles33 virtual long TotNbColors()=0; // Donne le nombre total de couleurs disponibles 30 34 virtual int NbAllocColors()=0; // Nb de couleurs deja allouees 31 35 protected: … … 37 41 int mType; 38 42 string mNom; 39 43 bool mFlagReversedIndex; 40 44 }; 41 45 -
trunk/SophyaPI/PI/picmapview.cc
r1125 r1503 76 76 return; 77 77 } 78 if ( cmap && (cmp->Type() == cmap->Type()) && (cmp->Type() != CMAP_OTHER) 79 && ( (vmin-min) < 1.e-69) && ((vmin-min) > -1.e-69) &&80 ((vmax-max) < 1.e-69) && ((vmax-max) > -1.e-69) ) return;78 if ( cmap && (cmp->Type() == cmap->Type()) && (cmp->Type() != CMAP_OTHER) 79 && (cmp->IsColorIndexReversed() == cmap->IsColorIndexReversed()) 80 && (fabs(vmin-min) < 1.e-69) && (fabs(vmax-max) > -1.e-69) ) return; 81 81 if (cmap) delete cmap; 82 82 cmap = new PIColorMap(*cmp); … … 87 87 88 88 /* --Methode-- */ 89 void PICMapView::SetColMapId(CMapId cmapid, double min, double max, bool refr)89 void PICMapView::SetColMapId(CMapId cmapid, bool revidx, double min, double max, bool refr) 90 90 { 91 if ( cmap && (cmapid == cmap->Type()) && (cmapid != CMAP_OTHER) 92 && ((vmin-min) < 1.e-69) && ((vmin-min) > -1.e-69) && 91 if ( cmap && (cmapid == cmap->Type()) && (cmapid != CMAP_OTHER) && 92 (cmap->IsColorIndexReversed() == revidx) && 93 ((vmin-min) < 1.e-69) && ((vmin-min) > -1.e-69) && 93 94 ((vmax-max) < 1.e-69) && ((vmax-max) > -1.e-69) ) return; 94 95 if (cmap) delete cmap; 95 96 cmap = new PIColorMap(cmapid); 97 cmap->ReverseColorIndex(revidx); 96 98 vmin = min; vmax = max; 97 99 if (refr) Refresh(); -
trunk/SophyaPI/PI/picmapview.h
r557 r1503 24 24 25 25 void SetColMap(PIColorMap* cmp=NULL, double min=1., double max=-1., bool refr=true); 26 void SetColMapId(CMapId cmapid, double min=1., double max=-1., bool refr=true); 26 void SetColMapId(CMapId cmapid, bool revidx, double min, double max, bool refr); 27 inline void SetColMapId(CMapId cmapid, double min=1., double max=-1., bool refr=true) 28 { SetColMapId(cmapid, false, min, max, refr); } 27 29 28 30 // Traitement des evenements -
trunk/SophyaPI/PI/picmapx.cc
r194 r1503 53 53 return(picr); 54 54 } 55 return(mColRGB[n]); 55 if (mFlagReversedIndex) return(mColRGB[NCol()-n-1]); 56 else return(mColRGB[n]); 56 57 } 57 58 -
trunk/SophyaPI/PI/picmapx.h
r112 r1503 13 13 virtual ~PIColorMapX(); 14 14 15 // Fonction Color() est definie afin de permettre l'optimisation - affichage d'image, etc... 15 16 inline PIXColor Color(int index) 16 { return ((index < mNCol) ? mColors[index] : 0); } ; 17 { return (((index < mNCol)&&(index>=0)) ? 18 mColors[(mFlagReversedIndex)?mNCol-index-1:index] : 0); } ; 17 19 18 20 virtual PIColor GetColor(int n); -
trunk/SophyaPI/PI/piimage.cc
r1125 r1503 484 484 485 485 /* --Methode-- */ 486 float PIImage::GetZoomF() 486 float PIImage::GetZoomF() const 487 487 { 488 488 if (zoom >= 1) return((float)zoom); … … 548 548 549 549 /* --Methode-- */ 550 void PIImage::SetColMapId(CMapId cmapid, bool re fr)550 void PIImage::SetColMapId(CMapId cmapid, bool revidx, bool refr) 551 551 { 552 552 if ( (cmapid == CMAP_GREY32) || (cmapid == CMAP_GREYINV32) || 553 553 (cmapid == CMAP_GREY128) || (cmapid == CMAP_GREYINV128)) mdrw->SetColAtt(PI_Red); 554 554 else mdrw->SetColAtt(PI_Turquoise); 555 PIPixmap::SetColMapId(cmapid, re fr);556 if (zow) zow->SetColMapId(cmapid, re fr);557 if (gvw) gvw->SetColMapId(cmapid, re fr);558 if (cmvw) cmvw->SetColMapId(cmapid, Lut()->Min(), Lut()->Max(), refr);555 PIPixmap::SetColMapId(cmapid, revidx, refr); 556 if (zow) zow->SetColMapId(cmapid, revidx, refr); 557 if (gvw) gvw->SetColMapId(cmapid, revidx, refr); 558 if (cmvw) cmvw->SetColMapId(cmapid, revidx, Lut()->Min(), Lut()->Max(), refr); 559 559 return; 560 560 } -
trunk/SophyaPI/PI/piimage.h
r389 r1503 58 58 void SetZoom(int zm, bool refr=true); 59 59 void SetZoomF(float fzm, bool refr=true); 60 float GetZoomF(); 60 float GetZoomF() const ; 61 inline int GetZoom() const { return (zoom); } 61 62 62 63 // Changement de table de couleur 63 64 virtual void SetColMap(PIColorMap* cmp, bool refr=true); 64 virtual void SetColMapId(CMapId cmapid, bool refr=true); 65 virtual void SetColMapId(CMapId cmapid, bool revidx, bool refr); 66 inline void SetColMapId(CMapId cmapid, bool refr=true) 67 { SetColMapId(cmapid, false, refr); } 65 68 66 69 // Positionnement image - pave -
trunk/SophyaPI/PI/piimgtools.cc
r1317 r1503 174 174 for(kcc=nsct3; kcc<PIColorMap::NumberStandardColorMaps(); kcc++) 175 175 mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc); 176 177 mOptzc[0]->SetValue(203); 176 // On ajoute un CheckItem pour inverser les index de table de couleur 177 mOptzc[0]->Menu()->AppendCheckItem("Reverse CMap", 299); 178 179 mOptzc[0]->SetValue(203); mLastCol = 203; 178 180 mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 179 181 … … 297 299 PIWindow::Show(); 298 300 mpii = PIImage::CurrentPIImage(); 299 if (mpii == NULL) return; 301 if (mpii == NULL) { 302 mOptzc[0]->Menu()->SetStateMsg(299, false); 303 mOptzc[0]->SetValue(203); mLastCol = 203; 304 mOptzc[1]->SetValue(101); 305 mOptCut->SetValue(303); 306 return; 307 } 300 308 min_lut = mpii->Lut()->Min(); 301 309 max_lut = mpii->Lut()->Max(); … … 313 321 mSc[0]->SetValue(0); 314 322 mSc[1]->SetValue(0); 315 mOptzc[0]->SetValue(203); 316 mOptzc[1]->SetValue(101); 323 324 // Pour mettre a jour le menu de la table de couleur 325 mOptzc[0]->Menu()->SetStateMsg(299, mpii->GetColMap()->IsColorIndexReversed()); 326 int cmnum = PIColorMap::ColorMapId2Num(mpii->GetColMapId()); 327 mLastCol = (cmnum < 0) ? 203 : 201+cmnum; 328 mOptzc[0]->SetValue(mLastCol); 329 330 // Pour le facteur de zoom 331 mOptzc[1]->SetValue(mpii->GetZoom()+100); 332 317 333 mOptCut->SetValue(303); 318 334 return; … … 453 469 if ((msg <= 110) && (msg >= 90)) // Zoom 454 470 PIImage::CurrentPIImage()->SetZoom((int)(msg-100), true); 455 else if ((msg > 200) && (msg < 299)) // Changement de couleur 456 PIImage::CurrentPIImage()->SetColMapId(PIColorMap::GetStandardColorMapId(msg-201), true); 471 else if (msg == 299) { // Revert CMap index 472 mOptzc[0]->SetValue(mLastCol); 473 } 474 else if ((msg > 200) && (msg < 299)) { // Changement de couleur 475 // bool irev = PIImage::CurrentPIImage()->GetColMap()->IsColorIndexReversed(); 476 bool revidx = mOptzc[0]->Menu()->GetStateMsg(299); 477 // cout << " DBG PIImgTools::Process() revidx= " ; 478 // if (revidx) cout << " TRUE " ; 479 // else cout << " FALSE " ; 480 // if (irev) cout << " Img::RevIdx= TRUE " << endl; 481 // else cout << " Img::RevIdx= FALSE " << endl; 482 PIImage::CurrentPIImage()->SetColMapId(PIColorMap::GetStandardColorMapId(msg-201), revidx, true); 483 mLastCol = msg; 484 } 457 485 458 486 // Cuts -
trunk/SophyaPI/PI/piimgtools.h
r1124 r1503 39 39 PIOptMenu* mOptzc[2]; 40 40 PIMenu* mCasc[5]; 41 PIMessage mLastCol; 42 41 43 // Pour expand et compress 42 44 PIButton* mButsz[5]; -
trunk/SophyaPI/PI/pipixmapgen.cc
r329 r1503 121 121 { 122 122 if (!cmp) return; 123 if ( (cmp->Type() == cmap->Type()) && (cmp->Type() != CMAP_OTHER) ) return; 123 if ( (cmp->Type() == cmap->Type()) && (cmp->Type() != CMAP_OTHER) 124 && (cmp->IsColorIndexReversed() == cmap->IsColorIndexReversed()) ) return; 124 125 if (cmap) delete cmap; 125 126 cmap = new PIColorMap(*cmp); … … 128 129 129 130 /* --Methode-- */ 130 void PIPixmapGen::SetColMapId(CMapId cmapid, bool re fr)131 void PIPixmapGen::SetColMapId(CMapId cmapid, bool revidx, bool refr) 131 132 { 132 if (!cmap || (cmap->Type() != cmapid) || (cmapid == CMAP_OTHER) ) { 133 if (!cmap || (cmap->Type() != cmapid) || (cmapid == CMAP_OTHER) 134 || (cmap->IsColorIndexReversed() != revidx) ) { 133 135 if (cmap) delete cmap; 134 136 cmap = new PIColorMap(cmapid); 137 cmap->ReverseColorIndex(revidx); 135 138 } 136 139 if (refr) Refresh(); -
trunk/SophyaPI/PI/pipixmapgen.h
r440 r1503 26 26 27 27 virtual void SetColMap(PIColorMap* cmp, bool refr=true); 28 virtual void SetColMapId(CMapId cmapid, bool refr=true); 28 virtual void SetColMapId(CMapId cmapid, bool revidx, bool refr); 29 inline void SetColMapId(CMapId cmapid, bool refr=true) 30 { SetColMapId(cmapid, false, refr); } 29 31 30 32 inline PIColorMap* GetColMap() { return cmap; } -
trunk/SophyaPI/PI/piversion.h
r1421 r1503 2 2 #define PIVERSION_H_SEEN 3 3 4 #define PI_VERSIONNUMBER 2.8 04 #define PI_VERSIONNUMBER 2.85 5 5 6 6 #endif
Note:
See TracChangeset
for help on using the changeset viewer.