X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkScalarsToColors.cxx;fp=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkScalarsToColors.cxx;h=91569f7df16fbb057d67f2492eb585aa9c1bdfc3;hb=d4d007ec0086a1145c20e922e87e0fee1b2f12d8;hp=e4524c6514a703f050415dbd438abc87b7e151f4;hpb=15673d41b054dd2543c80b842b3ebde8cea76eb6;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx index e4524c6..91569f7 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx @@ -30,45 +30,99 @@ void ScalarsToColors::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <Build(); - double rgba1[4]; - double rgba2[4]; - for (int iLookTable = 0; iLookTable<128; iLookTable++) - { + if (bbGetInputRange().size()==2) + { + _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]); +// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]); + } else { + _colorLookupTable->SetRange(0,255); + } + _colorLookupTable->SetNumberOfTableValues(1000); + _colorLookupTable->Build(); + double rgba1[4]; + double rgba2[4]; + int iLookTable; + for (iLookTable = 0; iLookTable<500; iLookTable++) + { _colorLookupTable->GetTableValue( iLookTable, rgba1); - _colorLookupTable->GetTableValue(256-1-iLookTable, rgba2); - - _colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); + _colorLookupTable->GetTableValue(1000-1-iLookTable, rgba2); + _colorLookupTable->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); _colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]); } // for iLookTable - } // if - } // firsttime - - if (bbGetInputRange().size()==2) - { - _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]); - } else { - _colorLookupTable->SetTableRange( 0,1 ); - } - - double rgb[3]; - _colorLookupTable->GetColor( bbGetInputScalarValue() , rgb ); - std::vectorcolorRGB; - colorRGB.push_back( rgb[0] ); - colorRGB.push_back( rgb[1] ); - colorRGB.push_back( rgb[2] ); - - bbSetOutputColor( colorRGB ); - bbSetOutputLookupTable(_colorLookupTable); - + double rgba[4]; + _colorLookupTable->GetTableValue(0,rgba); + rgba[3]=0; + _colorLookupTable->SetTableValue(0,rgba); + + int i,iMax=200; + for (i=0;iGetTableValue(500+100+i, rgba); + rgba[3]=(double)i/(double)iMax; + _colorLookupTable->SetTableValue(500+100+i,rgba); + _colorLookupTable->GetTableValue(500-100-i, rgba); + rgba[3]=(double)i/(double)iMax; + _colorLookupTable->SetTableValue(500-100-i,rgba); + } // for + + iMax=100; + for (i=0;iGetTableValue(500+i, rgba); + rgba[3]=0; + _colorLookupTable->SetTableValue(500+i,rgba); + _colorLookupTable->GetTableValue(500-i, rgba); + rgba[3]=0; + _colorLookupTable->SetTableValue(500-i,rgba); + } // for + + } // if Type 0 + +//EED 2018-06-8 ***********************ARDS Projet*********************************************** + if (bbGetInputType()==1) + { + _colorLookupTable = vtkLookupTable::New(); + if (bbGetInputRange().size()==2) + { + _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]); +// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]); + } else { + _colorLookupTable->SetRange(0,255); + } + _colorLookupTable->SetValueRange(0.0, 1.0); // from black to white + _colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation + _colorLookupTable->SetRampToLinear(); + _colorLookupTable->Build(); + double rgba[4]; + _colorLookupTable->GetTableValue(0,rgba); + rgba[3]=0; + _colorLookupTable->SetTableValue(0,rgba); + } // IF + + + + + } // firsttime + + double rgb[3]; + std::vectorcolorRGB; + _colorLookupTable->GetColor( bbGetInputScalarValue() , rgb ); + colorRGB.push_back( rgb[0] ); + colorRGB.push_back( rgb[1] ); + colorRGB.push_back( rgb[2] ); + bbSetOutputColor( colorRGB ); + bbSetOutputLookupTable(_colorLookupTable); + +printf("EED ScalarsToColors::Process End\n"); + } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)