/* # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Sante) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ #include "vtkTensorsVisu.h" #include "vtkProperty.h" //------------------------------------------------------------------------ vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase() { ss = vtkSphereSource::New(); superquadratic = vtkSuperquadricSource::New(); cs = vtkCubeSource::New(); tg = vtkTensorGlyph::New(); pdn = vtkPolyDataNormals::New(); pd = vtkPolyData::New(); pod = vtkPointData::New(); } //------------------------------------------------------------------------ vtkTensorsVisu::~vtkTensorsVisu() { } //------------------------------------------------------------------------ void vtkTensorsVisu::Process() { printf("EED vtkTensorsVisu::Process Start\n"); if (_active==true) { if(GetTypeForm()==2) // source superquadratic { superquadratic->SetThetaResolution(20); superquadratic->SetPhiResolution(20); tg->SetSource(superquadratic->GetOutput()); } else if(GetTypeForm()==1) { // source sphere tg->SetSource(ss->GetOutput()); } else { // source cube tg->SetSource(cs->GetOutput()); } tg->SetInput( GetDataObject() ); // tg->ScalingOn(); // tg->SetScaling(25); //if(isfromcal) tg->SetScaleFactor( GetScaleFactor() ); tg->ScalingOn( ); //else // //tg->SetScaleFactor(2); // tg->SetScaleFactor(scale_factor); //EED tg->Update(); //The normals are needed to generate the right colors and if // not used some of the glyphs are black. pdn->SetInput(tg->GetOutput()); //EED pdn->Update(); //EED================================ //pdm->SetInput( tg->GetOutput()); //pdm->SetScalarRange( range ); //vtkPolyData *pd = tg->GetOutput(); //vtkPointData *pointdata = pd->GetPointData(); //vtkDataArray *da = pointdata->GetVectors(); //vtkDataArray *nda = vtkFloatArray::New(); //nda->DeepCopy(da); //pointdata->AddArray( nda ); //reader->GetOutput()->GetPointData()->AddArray( nda ); //pdm->SetInput(pdn->GetOutput()); //pdm->ScalarVisibilityOn(); //pdm->SetLookupTable(vLutEED); //pdm->SetColorModeToMapScalars(); //pdm->SelectColorArray("color"); //pdm->SetScalarModeToUsePointFieldData(); //pdm->ImmediateModeRenderingOn(); //===================================== _pdm->SetInput( pdn->GetOutput() ); _pdm->ImmediateModeRenderingOn(); _pdm->ScalarVisibilityOn(); _pdm->SetScalarModeToUsePointFieldData(); //EED _pdm->Update(); _actor->SetMapper( _pdm ); _actor->GetProperty()->SetOpacity( GetOpacity() ); tg->ColorGlyphsOn(); // tg->ExtractEigenvaluesOn(); tg->SetColorModeToEigenvalues(); _pdm->SetLookupTable( _LutEED ); _pdm->SelectColorArray( "Normals" ); //int tcg = tg->GetColorGlyphs(); // tg->SetColorGlyphs(10); // tg->SetColorModeToScalars(); //tg->ThreeGlyphsOn(); //vtkDataArray* da = vtkDataArray::New(); pd = tg->GetOutput(); pd->Update(); pod = pd->GetPointData(); pod->Update(); //EED1 if(pod->GetScalars()) //EED1 { //EED1 _pdm->SetScalarRange(pod->GetScalars()->GetRange()); //EED1 } //pdm->SelectColorArray("GlyphVector"); //EED _pdm->Update(); tg->Print( std::cout ); printf("EED vtkTensorsVisu::Process ------------------------------------------\n"); pd->Print( std::cout ); tg->Update(); vtkPolyData *pd = pdn->GetOutput(); vtkPointData *pointdata = pd->GetPointData(); printf("EED vtkTensorsVisu::Process XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx\n"); pointdata->Print( std::cout ); int aa = pd->GetNumberOfPieces (); int bb = pd->GetNumberOfVerts (); int cc = pd->GetNumberOfLines (); int dd = pd->GetNumberOfPolys (); int ee = pd->GetNumberOfStrips (); int ff = pd->GetNumberOfCells(); printf("EED vtkTensorsVisu::Process %d %d %d %d %d %d \n", aa,bb,cc,dd,ee,ff); vtkPolyData *ttt = (vtkPolyData *)GetDataObject(); int numPnts = ttt->GetNumberOfPoints(); printf("EED vtkTensorsVisu::Process numPnts %d \n", numPnts ); vtkIdType numSourcePts, numSourceCells; vtkPoints *sourcePts; sourcePts = tg->GetSource()->GetPoints(); numSourcePts = sourcePts->GetNumberOfPoints(); numSourceCells = tg->GetSource()->GetNumberOfCells(); printf("EED vtkTensorsVisu::Process numSourcePts %d numSourceCells %d\n", numSourcePts, numSourceCells); int i,sizeDa = pointdata->GetNumberOfArrays(); printf("EED vtkTensorsVisu::Process sizeDa %d \n", sizeDa ); for (i=0;iGetArray(i)->GetSize() / numPnts; printf("EED vtkTensorsVisu::Process-name %d, %s, size=%d %d \n", i, pointdata->GetArrayName(i) , pointdata->GetArray(i)->GetSize(), faces ); } } // _active VisibilityActor(); printf("EED vtkTensorsVisu::Process End.\n"); }