{
printf("EED vtkImageDataStrucPoints::joinComponents Start \n");
- int ext[6];
- imageY->Modified();
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- imageY->Update();
- imageY->GetWholeExtent(ext);
-#else
- imageY->GetExtent(ext);
-#endif
- int dim[3];
- double spc[3];
- dim[0]=ext[1]-ext[0]+1;
- dim[1]=ext[3]-ext[2]+1;
- dim[2]=ext[5]-ext[4]+1;
- imageY->GetSpacing(spc);
- double *ptrX=NULL, *ptrY=NULL, *ptrZ=NULL;
- double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL;
-
- if (imageX!=NULL) ptrX = (double *)imageX->GetScalarPointer();
- if (imageY!=NULL) ptrY = (double *)imageY->GetScalarPointer();
- if (imageZ!=NULL) ptrZ = (double *)imageZ->GetScalarPointer();
- if (Data1 !=NULL) ptrD1 = (double *)Data1->GetScalarPointer();
- if (Data2 !=NULL) ptrD2 = (double *)Data2->GetScalarPointer();
- if (Data3 !=NULL) ptrD3 = (double *)Data3->GetScalarPointer();
- if (Data4 !=NULL) ptrD4 = (double *)Data4->GetScalarPointer();
- if (Data5 !=NULL) ptrD5 = (double *)Data5->GetScalarPointer();
- if (Data6 !=NULL) ptrD6 = (double *)Data6->GetScalarPointer();
-
- long int sizeimage = dim[0]*dim[1]*dim[2];
- int components=3;
-// if ((Data1!=NULL) && (Data2==NULL) && (Data3==NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) ) { components=4; }
-// if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) ) { components=6; }
-// if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4!=NULL) && (Data5!=NULL) && (Data6!=NULL) ) { components=9; }
- vtkDoubleArray *array = vtkDoubleArray::New();
- array->SetNumberOfTuples(sizeimage);
- array->SetNumberOfComponents(components);
- array->Allocate(sizeimage*components, 100 ); // ???
- array->SetName("velocity");
-
- vtkDoubleArray *array2 = vtkDoubleArray::New();
- array2->SetNumberOfTuples(sizeimage);
- array2->SetNumberOfComponents(1);
- array2->Allocate(sizeimage*1, 100 ); // ???
- array2->SetName("angle");
-
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
-
- double vx,vy,vz,d1=0,d2=0,d3=0,d4=0,d5=0,d6=0;
- int i;
- for( i = 0 ; i < sizeimage ; i++ )
- {
- if (ptrX !=NULL) { vx = *ptrX; ptrX++; } else { vx=0; }
- if (ptrY !=NULL) { vy = *ptrY; ptrY++; } else { vy=0; }
- if (ptrZ !=NULL) { vz = *ptrZ; ptrZ++; } else { vz=0; }
- if (ptrD1!=NULL) { d1 = *ptrD1; ptrD1++;}
- if (ptrD2!=NULL) { d2 = *ptrD2; ptrD2++;}
- if (ptrD3!=NULL) { d3 = *ptrD3; ptrD3++;}
- if (ptrD4!=NULL) { d4 = *ptrD4; ptrD4++;}
-
- if (components==3) { array->SetTuple3(i,vx,vy,vz); }
- if (components==3) { array2->SetTuple1(i,d1); }
-// if (components==4) { array->SetTuple4(i,vx,vy,vz,d1); }
-// if (components==6) { array->SetTuple6(i,vx,vy,vz,d1,d2,d3); }
-// if (components==9) { array->SetTuple9(i,vx,vy,vz,d1,d2,d3,d4,d5,d6); }
- } // for i
-
- _structuredPoints = vtkStructuredPoints::New();
- _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]);
- _structuredPoints->SetSpacing(spc);
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- _structuredPoints->SetScalarTypeToDouble();
- _structuredPoints->SetNumberOfScalarComponents(3);
-#else
- vtkInformation* info=_structuredPoints->GetInformation();
- vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_DOUBLE, 3);
-
-#endif
-
- _structuredPoints->GetPointData()->SetVectors(array);
- _structuredPoints->GetPointData()->AddArray(array2);
- _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage);
- _structuredPoints->Modified();
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- _structuredPoints->Update();
-#else
- //...
-#endif
+ if ((imageX!=NULL) && (imageY!=NULL) && (imageZ!=NULL) )
+ {
+ int ext[6];
+ imageY->Modified();
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ imageY->Update();
+ imageY->GetWholeExtent(ext);
+ #else
+ imageY->GetExtent(ext);
+ #endif
+ int dim[3];
+ double spc[3];
+ dim[0]=ext[1]-ext[0]+1;
+ dim[1]=ext[3]-ext[2]+1;
+ dim[2]=ext[5]-ext[4]+1;
+ imageY->GetSpacing(spc);
+ double *ptrX=NULL, *ptrY=NULL, *ptrZ=NULL;
+ double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL;
+
+ if (imageX!=NULL) ptrX = (double *)imageX->GetScalarPointer();
+ if (imageY!=NULL) ptrY = (double *)imageY->GetScalarPointer();
+ if (imageZ!=NULL) ptrZ = (double *)imageZ->GetScalarPointer();
+ if (Data1 !=NULL) ptrD1 = (double *)Data1->GetScalarPointer();
+ if (Data2 !=NULL) ptrD2 = (double *)Data2->GetScalarPointer();
+ if (Data3 !=NULL) ptrD3 = (double *)Data3->GetScalarPointer();
+ if (Data4 !=NULL) ptrD4 = (double *)Data4->GetScalarPointer();
+ if (Data5 !=NULL) ptrD5 = (double *)Data5->GetScalarPointer();
+ if (Data6 !=NULL) ptrD6 = (double *)Data6->GetScalarPointer();
+
+ long int sizeimage = dim[0]*dim[1]*dim[2];
+ int components=3;
+ // if ((Data1!=NULL) && (Data2==NULL) && (Data3==NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) ) { components=4; }
+ // if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) ) { components=6; }
+ // if ((Data1!=NULL) && (Data2!=NULL) && (Data3!=NULL) && (Data4!=NULL) && (Data5!=NULL) && (Data6!=NULL) ) { components=9; }
+ vtkDoubleArray *array = vtkDoubleArray::New();
+ array->SetNumberOfTuples(sizeimage);
+ array->SetNumberOfComponents(components);
+ array->Allocate(sizeimage*components, 100 ); // ???
+ array->SetName("velocity");
+
+ vtkDoubleArray *array2 = vtkDoubleArray::New();
+ array2->SetNumberOfTuples(sizeimage);
+ array2->SetNumberOfComponents(1);
+ array2->Allocate(sizeimage*1, 100 ); // ???
+ array2->SetName("angle");
+
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+ printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n");
+
+ double vx,vy,vz,d1=0,d2=0,d3=0,d4=0,d5=0,d6=0;
+ int i;
+ for( i = 0 ; i < sizeimage ; i++ )
+ {
+ if (ptrX !=NULL) { vx = *ptrX; ptrX++; } else { vx=0; }
+ if (ptrY !=NULL) { vy = *ptrY; ptrY++; } else { vy=0; }
+ if (ptrZ !=NULL) { vz = *ptrZ; ptrZ++; } else { vz=0; }
+ if (ptrD1!=NULL) { d1 = *ptrD1; ptrD1++;}
+ if (ptrD2!=NULL) { d2 = *ptrD2; ptrD2++;}
+ if (ptrD3!=NULL) { d3 = *ptrD3; ptrD3++;}
+ if (ptrD4!=NULL) { d4 = *ptrD4; ptrD4++;}
+
+ if (components==3) { array->SetTuple3(i,vx,vy,vz); }
+ if (components==3) { array2->SetTuple1(i,d1); }
+ // if (components==4) { array->SetTuple4(i,vx,vy,vz,d1); }
+ // if (components==6) { array->SetTuple6(i,vx,vy,vz,d1,d2,d3); }
+ // if (components==9) { array->SetTuple9(i,vx,vy,vz,d1,d2,d3,d4,d5,d6); }
+ } // for i
+
+ _structuredPoints = vtkStructuredPoints::New();
+ _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]);
+ _structuredPoints->SetSpacing(spc);
+
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ _structuredPoints->SetScalarTypeToDouble();
+ _structuredPoints->SetNumberOfScalarComponents(3);
+ #else
+ vtkInformation* info=_structuredPoints->GetInformation();
+ vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_DOUBLE, 3);
+
+ #endif
+
+ _structuredPoints->GetPointData()->SetVectors(array);
+ _structuredPoints->GetPointData()->AddArray(array2);
+ _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage);
+ _structuredPoints->Modified();
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ _structuredPoints->Update();
+ #else
+ //...
+ #endif
+
+ /*
+ _structuredPoints->Print(cout);
+ vtkStructuredPointsWriter *writer2 = vtkStructuredPointsWriter::New();
+ writer2->SetFileName("/home/davila/tmp/VectorfromCal_EED_ups.vtk");
+ //writer->SetFileTypeToBinary();
+ writer2->SetFileTypeToASCII();
+ writer2->SetTensorsName("VectorfromCal");
+ writer2->SetFieldDataName("GlyphVector");
+ writer2->SetScalarsName("Scalar");
+ writer2->SetInput(_structuredPoints);
+ writer2->Write();
+ */
+
+ } else {
+ printf("EED Warnning! vtkImageDataStrucPoints::joinComponents imageX or image Y or image Z is EMPTY\n");
+ } // imageX imageY imageZ
-/*
- _structuredPoints->Print(cout);
- vtkStructuredPointsWriter *writer2 = vtkStructuredPointsWriter::New();
- writer2->SetFileName("/home/davila/tmp/VectorfromCal_EED_ups.vtk");
- //writer->SetFileTypeToBinary();
- writer2->SetFileTypeToASCII();
- writer2->SetTensorsName("VectorfromCal");
- writer2->SetFieldDataName("GlyphVector");
- writer2->SetScalarsName("Scalar");
- writer2->SetInput(_structuredPoints);
- writer2->Write();
-*/
printf("EED vtkImageDataStrucPoints::joinComponents End\n");
int inIncr, int outFormat)
{
double tmp,sum;
-// double *mag;
int i, j;
double dirx,diry,dirz;
double angle;
-
- printf("EED vtkLookupTableMapDirVectorEED inIncr=%d \n", inIncr);
-
-
-// mag = new double[length];
for (i = 0; i < length; ++i)
{
-
-
- if (1==1){
dirx = static_cast<T>(input[0]);
diry = static_cast<T>(input[1]);
dirz = static_cast<T>(input[2]);
input = input+inIncr;
sum = sqrt( dirx*dirx + diry*diry + dirz*dirz );
-
- /*
- dirx = 0;
- diry = 0;
- dirz = 0;
- sum = 0;
- for (j = 0; j < inIncr; ++j)
- {
- if (j==0) dirx= static_cast<T>(*input);
- if (j==1) diry= static_cast<T>(*input);
- if (j==2) dirz= static_cast<T>(*input);
- tmp = static_cast<T>(*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) );
// printf("%d %d %d ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
// printf(" C %d %f %f %f \n",inIncr,dirx,diry,dirz);
- } // type 1 color vector by direction
-
-
- if (2==0){
- angle = static_cast<T>(input[0]);
- input = input+inIncr;
-
- *output++ = (unsigned char) abs( 255*angle/90 );
- *output++ = (unsigned char) abs( 0 );
- *output++ = (unsigned char) abs( 0 );
- *output++ = 255;
- // printf("%d %d %d ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
- // printf(" C %d %f %f %f \n",inIncr,dirx,diry,dirz);
-
- }// type 2 color vector by scalar
-
-
} // for
-
-// vtkLookupTableMapData(self, mag, output, length, 1, outFormat);
-
-// delete [] mag;
-
-
}
int inputIncrement,
int outputFormat)
{
- printf("vtkLookupTableEED::MapScalarsThroughTable2 \n");
// if (this->UseMagnitude && inputIncrement > 1)
// {
switch (inputDataType)
//------------------------------------------------------------------------------
void vtkVectorsTensorsVisuBase::SetExternalLut(vtkScalarsToColors* lut)
{
-printf("EED vtkVectorsTensorsVisuBase::SetExternalLut C ptrlut %p this:%p\n",lut, this);
_externalLut=lut;
-printf("EED vtkVectorsTensorsVisuBase::SetExternalLut D ptrlut %p \n",_externalLut);
}