From: Eduardo DAVILA Date: Fri, 25 Aug 2017 15:56:03 +0000 (+0200) Subject: #3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=79a0adc7590431ebc6044df732b0a40e0b39ba78;p=creaVtk.git #3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbg b/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbg new file mode 100644 index 0000000..aedd47d --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbg @@ -0,0 +1,79 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:6 +BOX +creaVtk:TransformVector:Box00 +ISEXEC:FALSE +-10.219737:10.520318:-900.000000 +31.830263:0.520318:-900.000000 +PORT +InX:"0 10 20 30 40" +PORT +InY:"0 0 0 0 0" +PORT +InZ:"0 0 0 0 0" +FIN_BOX +BOX +vtk:Transform:Box01 +ISEXEC:FALSE +3.907547:36.670822:-900.000000 +39.482547:26.670822:-900.000000 +PORT +RotateWXYZ:"45 0 0 1" +FIN_BOX +BOX +wx:OutputText:Box02 +ISEXEC:FALSE +-32.763275:-20.740055:-900.000000 +4.011725:-30.740055:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box03 +ISEXEC:FALSE +8.577941:-39.514940:-900.000000 +45.352941:-49.514940:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box04 +ISEXEC:FALSE +60.578368:-42.821325:-900.000000 +97.353368:-52.821325:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box05 +ISEXEC:TRUE +-7.514513:-74.543965:-900.000000 +50.045487:-84.543965:-900.000000 +FIN_BOX +CONNECTIONS:7 +CONNECTION +Box01:Out:Box00:Transform +NumberOfControlPoints:0 +CONNECTION +Box00:OutX:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box05:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box00:OutY:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box00:OutZ:Box04:In +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbs b/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbs new file mode 100644 index 0000000..75474cc --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbs @@ -0,0 +1,53 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/ExampleTransformVector.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include vtk +include wx + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:TransformVector Box00 + set Box00.InX "0 10 20 30 40" + set Box00.InY "0 0 0 0 0" + set Box00.InZ "0 0 0 0 0" + +new vtk:Transform Box01 + set Box01.RotateWXYZ "45 0 0 1" + +new wx:OutputText Box02 + +new wx:OutputText Box03 + +new wx:OutputText Box04 + +new wx:LayoutLine Box05 + + +connect Box01.Out Box00.Transform + +connect Box00.OutX Box02.In + +connect Box02.Widget Box05.Widget1 + +connect Box03.Widget Box05.Widget2 + +connect Box04.Widget Box05.Widget3 + +connect Box00.OutY Box03.In + +connect Box00.OutZ Box04.In + + + +# Complex input ports +exec Box05 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg new file mode 100644 index 0000000..7b82938 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg @@ -0,0 +1,81 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:7 +BOX +creaVtk:VectorsExploration_Widget:Box05 +ISEXEC:FALSE +-44.335624:-18.635991:-900.000000 +7.914376:-28.635991:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box06 +ISEXEC:FALSE +23.896150:19.838313:-900.000000 +87.616150:9.838313:-900.000000 +FIN_BOX +BOX +vtk:LoadHola:Box07 +ISEXEC:FALSE +25.399053:55.607393:-900.000000 +60.949053:45.607393:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box08 +ISEXEC:FALSE +-62.370455:29.757470:-900.000000 +-22.645455:19.757470:-900.000000 +PORT +In2:"/creaVtk/Vectors.vtk" +FIN_BOX +BOX +std:Configuration:Box09 +ISEXEC:FALSE +-44.035044:51.399266:-900.000000 +-4.610044:41.399266:-900.000000 +FIN_BOX +BOX +vtk:StructuredPointsReader:Box10 +ISEXEC:FALSE +-62.069874:10.820898:-900.000000 +-13.369874:0.820898:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box11 +ISEXEC:TRUE +-8.566544:-57.410876:-900.000000 +30.513456:-67.410876:-900.000000 +PORT +Orientation:"H" +FIN_BOX +CONNECTIONS:7 +CONNECTION +Box06:Renderer1:Box05:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box07:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box09:DataPath:Box08:In1 +NumberOfControlPoints:0 +CONNECTION +Box08:Out:Box10:In +NumberOfControlPoints:0 +CONNECTION +Box10:Out:Box05:vtkImageData_vectors +NumberOfControlPoints:0 +CONNECTION +Box05:widget:Box11:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box11:Widget2 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs new file mode 100644 index 0000000..c999230 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs @@ -0,0 +1,55 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include creaMaracasVisu +include vtk +include std +include wx + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:VectorsExploration_Widget Box05 + +new creaMaracasVisu:ViewerNV Box06 + +new vtk:LoadHola Box07 + +new std:ConcatStrings Box08 + set Box08.In2 "/creaVtk/Vectors.vtk" + +new std:Configuration Box09 + +new vtk:StructuredPointsReader Box10 + +new wx:LayoutSplit Box11 + set Box11.Orientation "H" + + +connect Box06.Renderer1 Box05.vtkRenderer + +connect Box07.Out Box06.In + +connect Box09.DataPath Box08.In1 + +connect Box08.Out Box10.In + +connect Box10.Out Box05.vtkImageData_vectors + +connect Box05.widget Box11.Widget1 + +connect Box06.Widget Box11.Widget2 + + + +# Complex input ports +exec Box11 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbg new file mode 100644 index 0000000..ceb87df --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbg @@ -0,0 +1,112 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:10 +BOX +creaVtk:VectorsTensors_manualread_Widget:Box02 +ISEXEC:FALSE +-103.099113:11.121479:-900.000000 +-41.649113:1.121479:-900.000000 +FIN_BOX +BOX +vtk:LoadHola:Box03 +ISEXEC:FALSE +-32.011824:71.838740:-900.000000 +3.538176:61.838740:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box04 +ISEXEC:FALSE +-42.532141:40.878949:-900.000000 +21.187859:30.878949:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box05 +ISEXEC:TRUE +-90.625022:-42.983012:-900.000000 +-51.545022:-52.983012:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:OutputText:Box06 +ISEXEC:FALSE +17.583959:-41.179529:-900.000000 +54.358959:-51.179529:-900.000000 +FIN_BOX +BOX +std:Configuration:Box07 +ISEXEC:FALSE +40.428078:21.040635:-900.000000 +79.853078:11.040635:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box08 +ISEXEC:FALSE +7.364222:-3.907547:-900.000000 +47.089222:-13.907547:-900.000000 +PORT +In2:"/creaVtk/Vectors.vtk" +FIN_BOX +BOX +wx:OutputText:Box09 +ISEXEC:FALSE +58.925175:-40.416681:-900.000000 +95.700175:-50.416681:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box10 +ISEXEC:FALSE +56.821112:-4.347021:-900.000000 +96.546112:-14.347021:-900.000000 +PORT +In2:"/creaVtk/Tensors.vtk" +FIN_BOX +BOX +wx:LayoutLine:Box11 +ISEXEC:TRUE +36.520531:-61.619003:-900.000000 +94.080531:-71.619003:-900.000000 +PORT +WinHeight:"100" +FIN_BOX +CONNECTIONS:10 +CONNECTION +Box03:Out:Box04:In +NumberOfControlPoints:0 +CONNECTION +Box02:widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box04:Renderer1:Box02:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box07:DataPath:Box08:In1 +NumberOfControlPoints:0 +CONNECTION +Box08:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box07:DataPath:Box10:In1 +NumberOfControlPoints:0 +CONNECTION +Box10:Out:Box09:In +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box11:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box09:Widget:Box11:Widget2 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbs new file mode 100644 index 0000000..545d8d5 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbs @@ -0,0 +1,70 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsTensors_manualread_Widget.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include vtk +include creaMaracasVisu +include wx +include std + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:VectorsTensors_manualread_Widget Box02 + +new vtk:LoadHola Box03 + +new creaMaracasVisu:ViewerNV Box04 + +new wx:LayoutSplit Box05 + set Box05.Orientation "H" + +new wx:OutputText Box06 + +new std:Configuration Box07 + +new std:ConcatStrings Box08 + set Box08.In2 "/creaVtk/Vectors.vtk" + +new wx:OutputText Box09 + +new std:ConcatStrings Box10 + set Box10.In2 "/creaVtk/Tensors.vtk" + +new wx:LayoutLine Box11 + set Box11.WinHeight "100" + + +connect Box03.Out Box04.In + +connect Box02.widget Box05.Widget1 + +connect Box04.Renderer1 Box02.vtkRenderer + +connect Box04.Widget Box05.Widget2 + +connect Box07.DataPath Box08.In1 + +connect Box08.Out Box06.In + +connect Box07.DataPath Box10.In1 + +connect Box10.Out Box09.In + +connect Box06.Widget Box11.Widget1 + +connect Box09.Widget Box11.Widget2 + + + +# Complex input ports +exec Box05 +exec Box11 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbg new file mode 100644 index 0000000..0c6cedf --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbg @@ -0,0 +1,81 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:7 +BOX +creaVtk:VectorsVisu_Widget:Box00 +ISEXEC:FALSE +-23.144699:0.601161:-900.000000 +22.280301:-9.398839:-900.000000 +FIN_BOX +BOX +vtk:LoadHola:Box01 +ISEXEC:FALSE +35.769080:65.526550:-900.000000 +71.319080:55.526550:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box02 +ISEXEC:FALSE +20.740055:22.242957:-900.000000 +84.460055:12.242957:-900.000000 +FIN_BOX +BOX +vtk:StructuredPointsReader:Box03 +ISEXEC:FALSE +-48.393461:24.948182:-900.000000 +0.306539:14.948182:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box04 +ISEXEC:FALSE +-42.381851:45.387656:-900.000000 +-2.656851:35.387656:-900.000000 +PORT +In2:"/creaVtk/Vectors.vtk" +FIN_BOX +BOX +std:Configuration:Box05 +ISEXEC:FALSE +-36.670822:64.925389:-900.000000 +2.754178:54.925389:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box06 +ISEXEC:TRUE +12.323801:-42.081271:-900.000000 +51.403801:-52.081271:-900.000000 +PORT +Orientation:"H" +FIN_BOX +CONNECTIONS:7 +CONNECTION +Box01:Out:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box00:renderer +NumberOfControlPoints:0 +CONNECTION +Box04:Out:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box05:DataPath:Box04:In1 +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box00:vtkDataObject +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box06:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Box06:Widget1 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbs new file mode 100644 index 0000000..1456ef1 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbs @@ -0,0 +1,55 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu_Widget.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include vtk +include creaMaracasVisu +include std +include wx + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:VectorsVisu_Widget Box00 + +new vtk:LoadHola Box01 + +new creaMaracasVisu:ViewerNV Box02 + +new vtk:StructuredPointsReader Box03 + +new std:ConcatStrings Box04 + set Box04.In2 "/creaVtk/Vectors.vtk" + +new std:Configuration Box05 + +new wx:LayoutSplit Box06 + set Box06.Orientation "H" + + +connect Box01.Out Box02.In + +connect Box02.Renderer1 Box00.renderer + +connect Box04.Out Box03.In + +connect Box05.DataPath Box04.In1 + +connect Box03.Out Box00.vtkDataObject + +connect Box02.Widget Box06.Widget2 + +connect Box00.Widget Box06.Widget1 + + + +# Complex input ports +exec Box06 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h index 4b4e276..7da041e 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h @@ -27,13 +27,15 @@ class bbcreaVtk_EXPORT UnMosaicVectorVtkImageData }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(UnMosaicVectorVtkImageData,bbtk::AtomicBlackBox); -BBTK_NAME("UnMosaicVectorVtkImageData"); -BBTK_AUTHOR("carlos torres"); -BBTK_DESCRIPTION("No Description."); -BBTK_CATEGORY("empty"); -BBTK_INPUT(UnMosaicVectorVtkImageData,In,"2D image list",std::vector,""); -BBTK_INPUT(UnMosaicVectorVtkImageData,NbImagesInMosaicVector,"Vector of Number of Images In Mosaic ",std::vector,""); -BBTK_OUTPUT(UnMosaicVectorVtkImageData,Out,"3D image Vector",std::vector,""); + BBTK_NAME("UnMosaicVectorVtkImageData"); + BBTK_AUTHOR("carlos torres"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(UnMosaicVectorVtkImageData,In,"2D image list",std::vector,""); + BBTK_INPUT(UnMosaicVectorVtkImageData,NbImagesInMosaicVector,"Vector of Number of Images In Mosaic ",std::vector,""); + + BBTK_OUTPUT(UnMosaicVectorVtkImageData,Out,"3D image Vector",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(UnMosaicVectorVtkImageData); //===== // 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/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx index 38f2ffb..33b2347 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx @@ -28,68 +28,79 @@ void VectorsExtraction::Process() // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - std::cout<< "MLER VectorsExtraction Process Start" << std::endl; - +std::cout<< "MLER VectorsExtraction Process Start" << std::endl; if(bbGetInputVectorsFieldImage() != NULL ) { - vtkImageData *m_VectorImage = bbGetInputVectorsFieldImage(); - vtkIdType m_idType; - vtkDoubleArray *velocity = vtkDoubleArray::New(); - - std::vector coord = bbGetInputCoordinates(); - std::vector vec; - - vec.push_back(0); - vec.push_back(0); - vec.push_back(0); - - double ang1 = 0;//Angle 1 - double ang2 = 0;//ANgle 2 - double comp = 0;//Component x + y + vtkImageData *m_VectorImage = bbGetInputVectorsFieldImage(); + vtkIdType m_idType; + vtkDoubleArray *velocity = vtkDoubleArray::New(); + std::vector coord = bbGetInputCoordinates(); + std::vector vec; + vec.push_back(0); + vec.push_back(0); + vec.push_back(0); + double ang1 = 0;//Angle 1 + double ang2 = 0;//ANgle 2 + double comp = 0;//Component x + y + //Find coordinate into the image +std::cout << "ups ." << std::endl; + m_idType = m_VectorImage->FindPoint(coord[0],coord[1],coord[2]); +std::cout << "m_idType" << m_idType << std::endl; + //Recuperate vector of vectorFieldImage + m_VectorImage->Print(std::cout); + + + int sizeArrays= m_VectorImage->GetPointData()->GetNumberOfArrays(); + for (int iArray=0; iArrayGetPointData()->GetArrayName(iArray) ); + } // for iArrays + +vtkDataArray *dataArray = m_VectorImage->GetPointData()->GetArray("velocity"); +if (dataArray!=NULL) +{ + printf("DataArrya ok \n"); + double *vecData; + vecData=dataArray->GetTuple3(m_idType); + printf("info data: %f %f %f \n", vecData[0], vecData[1], vecData[2] ); + vec[0]=vecData[0]; + vec[1]=vecData[1]; + vec[2]=vecData[2]; + bbSetOutputVector(vec); - //Find coordinate into the image - m_idType = m_VectorImage->FindPoint(coord[0],coord[1],coord[2]); - std::cout << m_idType; +} // if dataArray - //Recuperate vector of vectorFieldImage velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity")); - //velocity->Print(std::cout); - - std::cout<< "# components velocity: " << velocity->GetNumberOfComponents()<GetNumberOfTuples()<GetComponent(m_idType,0); - vec[1] = velocity->GetComponent(m_idType,1); - vec[2] = velocity->GetComponent(m_idType,2); - - std::cout << "velocity :" << vec[0] << "," <Print(std::cout); - - std::cout << "ang1: " << ang1 << std::endl; - std::cout << "ang2: " << ang2 << std::endl; - - bbSetOutputAngle1(ang1); - bbSetOutputAngle2(ang2); - bbSetOutputVector(vec); - bbSetOutputX(coord[0]); - bbSetOutputY(coord[1]); - bbSetOutputZ(coord[2]); - + //velocity->Print(std::cout); + if (velocity!=NULL) + { + std::cout<< "# components velocity: " << velocity->GetNumberOfComponents()<GetNumberOfTuples()<GetComponent(m_idType,0); + vec[1] = velocity->GetComponent(m_idType,1); + vec[2] = velocity->GetComponent(m_idType,2); + std::cout << "velocity :" << vec[0] << "," <Print(std::cout); + std::cout << "ang1: " << ang1 << std::endl; + std::cout << "ang2: " << ang2 << std::endl; + bbSetOutputAngle1(ang1); + bbSetOutputAngle2(ang2); + bbSetOutputVector(vec); + bbSetOutputX(coord[0]); + bbSetOutputY(coord[1]); + bbSetOutputZ(coord[2]); + + } else { + bbSetOutputAngle1(ang1); + bbSetOutputAngle2(ang2); + bbSetOutputVector(vec); + }// if velocity }// if image != NULL - - std::cout<< "MLER VectorsExtraction Process END" << std::endl; - +std::cout<< "MLER VectorsExtraction Process END" << std::endl; } //===== // 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/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h index d7770f8..f190d31 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h @@ -40,18 +40,18 @@ class bbcreaVtk_EXPORT VectorsExtraction }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorsExtraction,bbtk::AtomicBlackBox); -BBTK_NAME("VectorsExtraction"); -BBTK_AUTHOR("Monica ESPINOSA"); -BBTK_DESCRIPTION("No Description."); -BBTK_CATEGORY("empty"); -BBTK_INPUT(VectorsExtraction,Coordinates,"Coordinates (x,y,z)",std::vector,""); -BBTK_INPUT(VectorsExtraction,VectorsFieldImage,"Image of Vectors Field",vtkImageData*,""); -BBTK_OUTPUT(VectorsExtraction,Vector,"",std::vector,""); -BBTK_OUTPUT(VectorsExtraction,X,"x",double,""); -BBTK_OUTPUT(VectorsExtraction,Y,"y",double,""); -BBTK_OUTPUT(VectorsExtraction,Z,"z",double,""); -BBTK_OUTPUT(VectorsExtraction,Angle1,"Angle 1 (Helix Angle)",double,""); -BBTK_OUTPUT(VectorsExtraction,Angle2,"Angle 2 (Transversal Angle)",double,""); + BBTK_NAME("VectorsExtraction"); + BBTK_AUTHOR("Monica ESPINOSA"); + BBTK_DESCRIPTION("Warning! looking ofr a 'velocity' array. BOX NOT TESTED!"); + BBTK_CATEGORY("empty"); + BBTK_INPUT(VectorsExtraction,Coordinates,"Coordinates (x,y,z)",std::vector,""); + BBTK_INPUT(VectorsExtraction,VectorsFieldImage,"Image of Vectors Field",vtkImageData*,""); + BBTK_OUTPUT(VectorsExtraction,Vector,"",std::vector,""); + BBTK_OUTPUT(VectorsExtraction,X,"x",double,""); + BBTK_OUTPUT(VectorsExtraction,Y,"y",double,""); + BBTK_OUTPUT(VectorsExtraction,Z,"z",double,""); + BBTK_OUTPUT(VectorsExtraction,Angle1,"Angle 1 (Helix Angle)",double,""); + BBTK_OUTPUT(VectorsExtraction,Angle2,"Angle 2 (Transversal Angle)",double,""); BBTK_END_DESCRIBE_BLACK_BOX(VectorsExtraction); //===== // 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/creaVtkUnMosaicVectorVtkImageData.cpp b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp index 2226f2d..93faba5 100644 --- a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp +++ b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp @@ -43,14 +43,12 @@ std::vector creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkI std::vector nbImagesPerRow; std::vector nbImagesInMosaic; double imagesInMosaic; - for(int i = 0; i < NbImagesInMosaicVector.size(); i++) { imagesInMosaic = NbImagesInMosaicVector[i]; nbImagesPerRow.push_back( ceil(sqrt(imagesInMosaic)) ); nbImagesInMosaic.push_back(NbImagesInMosaicVector[i]); - } - + } // for i if(imageInput.size() != NbImagesInMosaicVector.size()) { for(int j = NbImagesInMosaicVector.size(); j < imageInput.size(); j++) @@ -58,42 +56,38 @@ std::vector creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkI imagesInMosaic = NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1]; nbImagesPerRow.push_back( ceil(sqrt(imagesInMosaic)) ); nbImagesInMosaic.push_back( NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1] ); - } - } - + } // for j + } // for imageInput size if (nbImagesPerRow.size() == 0 || nbImagesInMosaic.size() == 0) - { + { std::cout << "VtkUnMosaicVectorVtkImageData ERROR: The number of Images by mosaic is not set " << std::endl; - } - + } // if nbImagesPerRow size std::vector imageIn = imageInput; - std::vector mImageOut; - for (int i = 0 ; i < (unsigned int)imageIn.size() ; i++) { - mImageOut.push_back( unMosaic(imageIn[i], nbImagesPerRow[i], nbImagesInMosaic[i]) ); - } - + for (int i = 0 ; i < (unsigned int)imageIn.size() ; i++) + { + mImageOut.push_back( unMosaic(imageIn[i], nbImagesPerRow[i], nbImagesInMosaic[i]) ); + } // for i return mImageOut; } +//------------------------------------------------------------------------------ vtkImageData * creaVtkUnMosaicVectorVtkImageData::unMosaic(vtkImageData *imageIn, int nbImagesPerRow, int numberOfImagesInMosaic) { - int inputdims[3]; - int outputdims[3]; - imageIn->GetDimensions (inputdims); - unsigned short *input = (unsigned short *)(imageIn->GetScalarPointer()); - + int inputdims[3]; + int outputdims[3]; + imageIn->GetDimensions (inputdims); + unsigned short *input = (unsigned short *)(imageIn->GetScalarPointer()); //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 - imageIn->Update(); + imageIn->Update(); #else - imageIn->Modified(); -#endif - - unsigned int div = (unsigned int)ceil(sqrt( (double)numberOfImagesInMosaic ) ); - outputdims[0] = inputdims[0] / div; - outputdims[1] = inputdims[1] / div; - outputdims[2] = numberOfImagesInMosaic; + // .. +#endif + unsigned int div = (unsigned int)ceil(sqrt( (double)numberOfImagesInMosaic ) ); + outputdims[0] = inputdims[0] / div; + outputdims[1] = inputdims[1] / div; + outputdims[2] = numberOfImagesInMosaic; vtkImageData *vtkImageOut; vtkImageOut = vtkImageData::New(); @@ -111,10 +105,7 @@ vtkImageData * creaVtkUnMosaicVectorVtkImageData::unMosaic(vtkImageData *imageIn #else vtkImageOut->AllocateScalars(VTK_UNSIGNED_SHORT,1); #endif - - unsigned short *output =(unsigned short *)(vtkImageOut->GetScalarPointer()); - unsigned short *dest = output; int dimXImageElem = outputdims[0]; int dimYImageElem = outputdims[1]; @@ -131,18 +122,8 @@ vtkImageData * creaVtkUnMosaicVectorVtkImageData::unMosaic(vtkImageData *imageIn memcpy(dest, input+debImage, dimXImageElem*sizeof(unsigned short)); debImage += dimXImageElem*nbImagesPerRow; dest += dimXImageElem; - } - } + } // for j + } // for i return vtkImageOut; } -//--------------------------------------------- -//Method template -//--------------------------------------------- -/* -void creaVtkUnMosaicVectorVtkImageData::FunctionName(int& parameterA) -{ - parameterA = 2 * parameterA; - return; -} -*/