From: Eduardo DAVILA Date: Fri, 27 Jun 2014 13:32:01 +0000 (+0200) Subject: 2387 creaVtk Feature New Normal New box, lib, script ImageDataStructuredPoints X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=08174c39ec53c37ea8ea7d6c97cf9f7af13659da;p=creaVtk.git 2387 creaVtk Feature New Normal New box, lib, script ImageDataStructuredPoints --- diff --git a/bbtk_creaVtk_PKG/bbs/boxes/PlaneWidget_StreamLineVisu_Widget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/PlaneWidget_StreamLineVisu_Widget.bbg index 5021db8..0d4cfd6 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/PlaneWidget_StreamLineVisu_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/PlaneWidget_StreamLineVisu_Widget.bbg @@ -13,16 +13,16 @@ PACKAGENAME:creaVtk COMPLEXOUTPUTS:2 COMPLEX_PORT Widget -43.902100:-98.162712:-900.000000 +-2.239362:-103.517011:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT boxchange -2.719569:-99.199517:-900.000000 +-21.059819:-100.774311:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:2 COMPLEX_PORT Renderer --76.250351:96.135240:-900.000000 +27.686049:87.001435:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT In @@ -42,8 +42,8 @@ FIN_BOX BOX creaVtk:PlaneWidget:Box01 ISEXEC:FALSE --21.579484:-8.987179:-900.000000 -23.995516:-18.987179:-900.000000 +15.270694:-28.357144:-900.000000 +60.845694:-38.357144:-900.000000 PORT Active:"true" PORT @@ -52,20 +52,20 @@ FIN_BOX BOX std:MagicBox:Box02 ISEXEC:FALSE --75.688060:56.627905:-900.000000 --30.113060:46.627905:-900.000000 +21.476726:47.966538:-900.000000 +67.051726:37.966538:-900.000000 FIN_BOX BOX creaVtk:PlaneWidget_StreamLineVisu_Interface:Box03 ISEXEC:FALSE --1.056909:57.144870:-900.000000 -70.118091:47.144870:-900.000000 +-76.332059:46.908709:-900.000000 +-5.157059:36.908709:-900.000000 FIN_BOX BOX vtk:vtkImageDataPointerRelay:Box04 ISEXEC:FALSE -92.104177:56.032598:-900.000000 -163.279177:46.032598:-900.000000 +81.238099:47.686190:-900.000000 +152.413099:37.686190:-900.000000 FIN_BOX CONNECTIONS:17 CONNECTION diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.h b/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.h index 93d6d40..c679b52 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.h @@ -24,7 +24,7 @@ class bbcreaVtk_EXPORT ImageDataStructuredPoints BBTK_DECLARE_INPUT(X, vtkImageData*); BBTK_DECLARE_INPUT(Y, vtkImageData*); BBTK_DECLARE_INPUT(Z, vtkImageData*); - BBTK_DECLARE_OUTPUT(ImageEnsemble, vtkStructuredPoints*); + BBTK_DECLARE_OUTPUT(ImageEnsemble, vtkImageData*); BBTK_PROCESS(Process); void Process(); //===== @@ -40,7 +40,7 @@ BBTK_CATEGORY("empty"); BBTK_INPUT(ImageDataStructuredPoints,X,"Image X",vtkImageData*,""); BBTK_INPUT(ImageDataStructuredPoints,Y,"Image Y",vtkImageData*,""); BBTK_INPUT(ImageDataStructuredPoints,Z,"Image Z",vtkImageData*,""); -BBTK_OUTPUT(ImageDataStructuredPoints,ImageEnsemble,"Image Ensemble",vtkStructuredPoints*,""); +BBTK_OUTPUT(ImageDataStructuredPoints,ImageEnsemble,"Image Ensemble",vtkImageData*,""); BBTK_END_DESCRIBE_BLACK_BOX(ImageDataStructuredPoints); //===== // 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) diff --git a/lib/creaVtk/creaVtkStreamLine.cpp b/lib/creaVtk/creaVtkStreamLine.cpp index 6f213f9..5085b1d 100644 --- a/lib/creaVtk/creaVtkStreamLine.cpp +++ b/lib/creaVtk/creaVtkStreamLine.cpp @@ -102,6 +102,10 @@ printf("creaVtkStreamLine::Process Start \n"); printf("EED creaVtkStreamLine::Process StreamLine PrintSelf\n"); _streamer->Print(std::cout); +printf("EED creaVtkStreamLine::Process StreamLine->GetOutput() PrintSelf\n"); + _streamer->GetOutput()->Print(std::cout); + + //EED 3aout2011 _tubefilter->SetInput(_streamer->GetOutput()); _tubefilter->SetRadius( GetScaleFactor() ); @@ -166,6 +170,7 @@ printf("EED creaVtkStreamLine::Process StreamLine PrintSelf\n"); _actor->SetMapper( _streamMapper2 ); +printf("EED lib creaVTK creaVtkStreamLine::Process opacity %f\n", GetOpacity() ); _actor->GetProperty()->SetOpacity( GetOpacity() ); }// _active diff --git a/lib/creaVtk/vtkImageDataStrucPoints.cpp b/lib/creaVtk/vtkImageDataStrucPoints.cpp index 69ac58a..3678f7f 100644 --- a/lib/creaVtk/vtkImageDataStrucPoints.cpp +++ b/lib/creaVtk/vtkImageDataStrucPoints.cpp @@ -26,6 +26,8 @@ */ #include "vtkImageDataStrucPoints.h" +#include "vtkStructuredPointsWriter.h" + vtkImageDataStrucPoints::vtkImageDataStrucPoints() { @@ -49,13 +51,10 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData* imageY->GetSpacing(spc); - vtkDoubleArray *arrayX; - vtkDoubleArray *arrayY; - vtkDoubleArray *arrayZ; - unsigned char *ptrUCharX = (unsigned char *)imageX->GetScalarPointer(); - unsigned char *ptrUCharY = (unsigned char *)imageY->GetScalarPointer(); - unsigned char *ptrUCharZ = (unsigned char *)imageZ->GetScalarPointer(); + double *ptrUCharX = (double *)imageX->GetScalarPointer(); + double *ptrUCharY = (double *)imageY->GetScalarPointer(); + double *ptrUCharZ = (double *)imageZ->GetScalarPointer(); long int sizeimage = dim[0]*dim[1]*dim[2]; @@ -70,26 +69,43 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData* double vz; int i; + +printf("EED vtkImageDataStrucPoints::joinComponents sizeimage%d\n", sizeimage ); for( i = 0 ; i < sizeimage ; i++ ) { - vx = *ptrUCharX; - vy = *ptrUCharY; - vz = *ptrUCharZ; - ptrUCharX++; - ptrUCharY++; - ptrUCharZ++; - array->SetTuple3(i,vx, vy , vz ); + vx = *ptrUCharX; + vy = *ptrUCharY; + vz = *ptrUCharZ; + ptrUCharX++; + ptrUCharY++; + ptrUCharZ++; + array->SetTuple3(i,vx, vy , vz ); } // for i - - _structuredPoints = vtkStructuredPoints::New(); _structuredPoints->SetDimensions(dim[0], dim[1], dim[2]); _structuredPoints->SetSpacing(spc); - _structuredPoints->SetScalarTypeToFloat(); - _structuredPoints->SetNumberOfScalarComponents(1); + _structuredPoints->SetScalarTypeToDouble(); + _structuredPoints->SetNumberOfScalarComponents(3); _structuredPoints->GetPointData()->SetVectors(array); _structuredPoints->GetPointData()->SetNumberOfTuples(sizeimage); + _structuredPoints->Modified(); + _structuredPoints->Update(); + + _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(); + + + } diff --git a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp index f582efe..405d741 100644 --- a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp +++ b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp @@ -210,7 +210,12 @@ vtkVectorsTensorsVisuBase::vtkVectorsTensorsVisuBase() _typeForm = 0; _LutEED = vtkLookupTableDirectionVector::New(); - _LutEED->SetVectorMode(0); +// _LutEED->SetVectorMode(0); +//_LutEED->SetVectorModeToMagnitude(); +//_LutEED->SetVectorModeToComponent(); +_LutEED->SetVectorModeToRGBColors(); + + _pdm = vtkPolyDataMapper::New(); _actor = vtkActor::New();