+
+ vtkStandardNewMacro(vtkLookupTableEED);
+
+ // Construct with range=(0,1); and hsv ranges set up for rainbow color table
+ // (from red to blue).
+ vtkLookupTableEED::vtkLookupTableEED(int sze, int ext)
+ {
+ this->TableRange[0] = 0.0;
+ this->TableRange[1] = 1.0;
+ }
+
+ //----------------------------------------------------------------------------
+ vtkLookupTableEED::~vtkLookupTableEED()
+ {
+ }
+
+
+
+ unsigned char *vtkLookupTableEED::MapValue(double v)
+ {
+
+ //int idx = this->GetIndex(v);
+ //return (this->Table->GetPointer(0) + 4*idx);
+
+ return 0;
+ }
+
+ void vtkLookupTableEED::GetColor(double v, double rgb[3])
+ {
+ // unsigned char *rgb8 = this->MapValue(v);
+ // rgb[0] = rgb8[0]/255.0;
+ // rgb[1] = rgb8[1]/255.0;
+ // rgb[2] = rgb8[2]/255.0;
+
+ rgb[0] = 1;
+ rgb[1] = 1;
+ rgb[2] = 0;
+ }
+
+
+ void vtkLookupTableEED::SetTableRange(double r[2])
+ {
+ this->SetTableRange(r[0],r[1]);
+ }
+
+ //----------------------------------------------------------------------------
+ // Set the minimum/maximum scalar values for scalar mapping. Scalar values
+ // less than minimum range value are clamped to minimum range value.
+ // Scalar values greater than maximum range value are clamped to maximum
+ // range value.
+ void vtkLookupTableEED::SetTableRange(double rmin, double rmax)
+ {
+ if (rmax < rmin)
+ {
+ vtkErrorMacro("Bad table range: ["<<rmin<<", "<<rmax<<"]");
+ return;
+ }
+
+ if (this->TableRange[0] == rmin && this->TableRange[1] == rmax)
+ {
+ return;
+ }
+
+ this->TableRange[0] = rmin;
+ this->TableRange[1] = rmax;
+
+ this->Modified();
+ }
+
+
+
+ //----------------------------------------------------------------------------
+ // Although this is a relatively expensive calculation,
+ // it is only done on the first render. Colors are cached
+ // for subsequent renders.
+ template<class T>
+ void vtkLookupTableMapDirVectorEED(vtkLookupTableEED *self, T *input,
+ unsigned char *output, int length,
+ int inIncr, int outFormat)
+ {
+ double tmp,sum;
+ // double *mag;
+ int i, j;
+ double dirx,diry,dirz;
+
+
+ printf("EED length %d %p\n", length,input);
+ // mag = new double[length];
+ for (i = 0; i < length; ++i)
+ {
+ dirx = 0;
+ diry = 0;
+ dirz = 0;
+ sum = 0;
+ for (j = 0; j < inIncr; ++j)
+ {
+ if (j==0) dirx= static_cast<double>(*input);
+ if (j==1) diry= static_cast<double>(*input);
+ if (j==2) dirz= static_cast<double>(*input);
+ tmp = static_cast<double>(*input);
+ sum += (tmp * tmp);
+ ++input;
+ }
+ sum=sqrt(sum);
+ *output++ = (unsigned char) abs( (255*dirx/sum) );
+ *output++ = (unsigned char) abs( (255*diry/sum) );
+ *output++ = (unsigned char) abs( (255*dirz/sum) );
+ *output++ = 255;
+ // printf("%d %d %d ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
+ }
+
+ // vtkLookupTableMapData(self, mag, output, length, 1, outFormat);
+
+ // delete [] mag;
+ }
+
+
+
+ //----------------------------------------------------------------------------
+ void vtkLookupTableEED::MapScalarsThroughTable2(void *input,
+ unsigned char *output,
+ int inputDataType,
+ int numberOfValues,
+ int inputIncrement,
+ int outputFormat)
+ {
+
+ printf("vtkLookupTableEED::MapScalarsThroughTable2 inputIncrement=%d inputDataType=%d\n",inputIncrement,inputDataType);
+
+
+ // if (this->UseMagnitude && inputIncrement > 1)
+ // {
+ switch (inputDataType)
+ {
+ vtkTemplateMacro(
+ vtkLookupTableMapDirVectorEED(this,static_cast<VTK_TT*>(input),output,
+ numberOfValues,inputIncrement,outputFormat);
+ return
+ );
+ case VTK_BIT:
+ vtkErrorMacro("Cannot comput magnitude of bit array.");
+ break;
+ default:
+ vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
+ }
+ // }
+
+ }
+
+
+ //----------------------------------------------------------------------------
+ void vtkLookupTableEED::PrintSelf(ostream& os, vtkIndent indent)
+ {
+ this->Superclass::PrintSelf(os,indent);
+ }
+
+
+
+
+ //----------------------------------
+ //----------------------------------
+ //----------------------------------
+ //----------------------------------
+ //----------------------------------
+
+
+