new vtk:ProbeFilter Box32
set Box32.BoxProcessMode "Reactive"
+<<<<<<< HEAD
new creaVtk:TensorsVisu_Widget Box33
new wx:LayoutTab Box36
new creaVtk:TensorsVisu_Widget Box37
+=======
+new creaVtk:TensorsVisu_Wideget Box33
+
+new wx:LayoutTab Box36
+
+new creaVtk:TensorsVisu_Wideget Box37
+>>>>>>> master
new vtk:MaskPoint Box38
# ----------------------------------
# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+<<<<<<< HEAD
# - /tmpEED/creaTools2/ci/bin/../share/bbtk/bbs/creaVtk/appli/exampleVectorsVisu.bbg
+=======
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu.bbg
+>>>>>>> master
# ----------------------------------
APP_START
wx:LayoutSplit:Box05
ISEXEC:TRUE
20.586047:-67.968368:-900.000000
+<<<<<<< HEAD
57.261047:-77.968368:-900.000000
+=======
+59.666047:-77.968368:-900.000000
+>>>>>>> master
PORT
Proportion:"10"
FIN_BOX
BOX
wx:FileSelector:Box06
ISEXEC:FALSE
+<<<<<<< HEAD
-79.676950:57.942181:-900.000000
-42.301950:47.942181:-900.000000
+=======
+-82.100831:48.785297:-900.000000
+-44.725831:38.785297:-900.000000
+>>>>>>> master
FIN_BOX
BOX
vtk:LoadHola:Box07
BOX
vtk:StructuredPointsReader:Box08
ISEXEC:FALSE
+<<<<<<< HEAD
-65.776361:20.644357:-900.000000
-17.076361:10.644357:-900.000000
+=======
+-77.679349:22.958827:-900.000000
+-28.979349:12.958827:-900.000000
+>>>>>>> master
PORT
In:"/home/davila/Creatis/creaVtk/data/Vectors.vtk"
FIN_BOX
BOX
+<<<<<<< HEAD
std:ConcatStrings:Box09
ISEXEC:FALSE
-9.468286:43.584173:-900.000000
ISEXEC:FALSE
8.566544:63.723067:-900.000000
47.991544:53.723067:-900.000000
+=======
+std:Configuration:Box09
+ISEXEC:FALSE
+-32.049096:69.753914:-900.000000
+7.375904:59.753914:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box10
+ISEXEC:FALSE
+-37.166178:46.323063:-900.000000
+2.558822:36.323063:-900.000000
+PORT
+In2:"/creaVtk/Vectors.vtk"
+>>>>>>> master
FIN_BOX
CONNECTIONS:9
CONNECTION
Box08:Out:Box01:In
NumberOfControlPoints:0
CONNECTION
+<<<<<<< HEAD
Box10:DataPath:Box09:In1
NumberOfControlPoints:0
CONNECTION
Box09:Out:Box08:In
+=======
+Box09:DataPath:Box10:In1
+NumberOfControlPoints:0
+CONNECTION
+Box10:Out:Box08:In
+>>>>>>> master
NumberOfControlPoints:0
APP_END
# ----------------------------------
# - BBTKGEditor v 1.4 BBS BlackBox Script
+<<<<<<< HEAD
# - /tmpEED/creaTools2/ci/bin/../share/bbtk/bbs/creaVtk/appli/exampleVectorsVisu.bbs
+=======
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsVisu.bbs
+>>>>>>> master
# ----------------------------------
# BBTK GEditor Script
category "<VOID>"
new vtk:MaskPoint Box01
+<<<<<<< HEAD
set Box01.Ratio "30"
+=======
+ set Box01.Ratio "1"
+>>>>>>> master
new creaVtk:VectorsVisu Box02
set Box02.Active "true"
new vtk:StructuredPointsReader Box08
set Box08.In "/home/davila/Creatis/creaVtk/data/Vectors.vtk"
+<<<<<<< HEAD
new std:ConcatStrings Box09
set Box09.In2 "/creaVtk/Vectors.vtk"
new std:Configuration Box10
+=======
+new std:Configuration Box09
+
+new std:ConcatStrings Box10
+ set Box10.In2 "/creaVtk/Vectors.vtk"
+>>>>>>> master
connect Box01.Out Box02.In
connect Box08.Out Box01.In
+<<<<<<< HEAD
connect Box10.DataPath Box09.In1
connect Box09.Out Box08.In
+=======
+connect Box09.DataPath Box10.In1
+
+connect Box10.Out Box08.In
+>>>>>>> master
# ----------------------------------
# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbg
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbg
# ----------------------------------
APP_START
wx:Slider:Box06
ISEXEC:FALSE
96.421419:49.928393:-900.000000
-129.196419:39.928393:-900.000000
+147.821419:39.928393:-900.000000
PORT
In:"100"
PORT
wx:Slider:Box08
ISEXEC:FALSE
191.649098:61.508736:-900.000000
-224.424098:51.508736:-900.000000
+243.049098:51.508736:-900.000000
PORT
ChangeResolution:"true"
PORT
PORT
Label:"true"
PORT
-Max:"500000"
+Max:"5000"
PORT
Min:"1"
PORT
wx:LayoutLine:Box10
ISEXEC:FALSE
8.365236:62.514618:-900.000000
-53.940236:52.514618:-900.000000
+65.925236:52.514618:-900.000000
PORT
Orientation:"H"
FIN_BOX
wx:LayoutLine:Box11
ISEXEC:FALSE
47.351525:19.503081:-900.000000
-92.926525:9.503081:-900.000000
+104.911525:9.503081:-900.000000
PORT
Orientation:"H"
FIN_BOX
# ----------------------------------
# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbs
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbs
# ----------------------------------
include std
set Box08.ChangeResolution "true"
set Box08.In "100"
set Box08.Label "true"
- set Box08.Max "500000"
+ set Box08.Max "5000"
set Box08.Min "1"
set Box08.ReactiveOnTrack "True"
set Box08.Title "Scale Factor"
# ----------------------------------
# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+<<<<<<< HEAD
# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbg
+=======
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbg
+>>>>>>> master
# ----------------------------------
APP_START
boxchange
-75.932205:-101.708611:-900.000000
FIN_COMPLEX_PORT
-COMPLEXINPUTS:2
+COMPLEXINPUTS:3
COMPLEX_PORT
vtkImageData
38.028121:89.676762:-900.000000
renderer
-52.117833:88.203991:-900.000000
FIN_COMPLEX_PORT
+<<<<<<< HEAD
BOXES:8
BOX
creaVtk:VectorsVisu:Box00
ISEXEC:FALSE
-2.817636:-56.941435:-900.000000
34.807364:-66.941435:-900.000000
+=======
+COMPLEX_PORT
+boxexecute
+-104.232070:88.823851:-900.000000
+FIN_COMPLEX_PORT
+BOXES:9
+BOX
+creaVtk:VectorsVisu:Box00
+ISEXEC:FALSE
+-4.465574:-69.418679:-900.000000
+41.109426:-79.418679:-900.000000
+>>>>>>> master
FIN_BOX
BOX
creaVtk:PlaneWidget:Box01
-79.072661:-36.761184:-900.000000
-37.897661:-46.761184:-900.000000
FIN_BOX
+<<<<<<< HEAD
CONNECTIONS:21
+=======
+BOX
+std:MagicBox:Box11
+ISEXEC:FALSE
+-116.304953:49.494646:-900.000000
+-70.729953:39.494646:-900.000000
+FIN_BOX
+CONNECTIONS:22
+>>>>>>> master
CONNECTION
Box03:Out:Box00:In
NumberOfControlPoints:0
Box15:Out:Box13:BoxExecute
NumberOfControlPoints:0
CONNECTION
+<<<<<<< HEAD
Box01:BoxChange:Box15:In2
+=======
+boxexecute:boxexecute:Box11:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box15:In2
+>>>>>>> master
NumberOfControlPoints:0
APP_END
# ----------------------------------
# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+<<<<<<< HEAD
# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbs
+=======
+# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbs
+>>>>>>> master
# ----------------------------------
include std
set Box13.BoxProcessMode "Reactive"
new std:SharedMemory Box15
+<<<<<<< HEAD
+=======
+
+new std:MagicBox Box11
+>>>>>>> master
connect Box03.Out Box00.In
connect Box15.Out Box00.BoxExecute
connect Box06.boxChange Box15.In1
connect Box15.Out Box13.BoxExecute
+<<<<<<< HEAD
connect Box01.BoxChange Box15.In2
+=======
+connect Box11.Out Box15.In2
+>>>>>>> master
# Complex input ports
input vtkImageData Box04.In " "
input renderer Box05.In " "
+input boxexecute Box11.BoxExecute " "
# Complex output ports
output Widget Box06.widget " "
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkImageCutByAxis.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageCutByAxis)
+BBTK_BLACK_BOX_IMPLEMENTATION(ImageCutByAxis,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void ImageCutByAxis::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (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')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+
+ vtkImageData *newData=vtkImageData::New();
+ newData->DeepCopy( bbGetInputIn() );
+
+ int ext[6];
+ bbGetInputIn()->GetWholeExtent(ext);
+ double dimX=ext[1]-ext[0]+1;
+ double dimY=ext[3]-ext[2]+1;
+ double dimZ=ext[5]-ext[4]+1;
+
+ int x=bbGetInputPoint()[0];
+ int y=bbGetInputPoint()[1];
+ int z=bbGetInputPoint()[2];
+
+ int i,j;
+ bool c1=false;
+ bool c2=false;
+ bool c3=false;
+ bool c4=false;
+
+ if ( bbGetInputType()=="x-y-z+" )
+ {
+ if (bbGetInputTypeOrientation()==0) { c1=false; c2=true; c3=true; c4=true; }
+ if (bbGetInputTypeOrientation()==1) { c1=true; c2=false; c3=true; c4=true; }
+ if (bbGetInputTypeOrientation()==2) { c1=true; c2=false; c3=true; c4=true; }
+ }
+
+ if (bbGetInputInsideVol()==true)
+ {
+ c1=!c1;
+ c2=!c2;
+ c3=!c3;
+ c4=!c4;
+ } // IndideVol
+
+
+ int xmin,xmax,ymin,ymax;
+
+// void *imgPtr;
+// imgPtr=bbGetInputIn()->GetScalarPointer(x,y,z,0);
+// memset( bbGetInputIn()->GetScalarPointer() );
+
+ if (c1==true)
+ {
+ if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=0; ymax=y; }
+ if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=dimY-z; ymax=dimY; }
+ if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=dimY-z; ymax=dimY; }
+ for (j=ymin;j<ymax;j++){
+ for (i=xmin;i<xmax;i++){newData->SetScalarComponentFromDouble(i,j,0,0,0);} // for i
+ } // for j
+ } // c1
+
+ if (c2==true)
+ {
+ if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=y; ymax=dimY; }
+ if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=0; ymax=dimY-z; }
+ if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=0; ymax=dimY-z; }
+ for (j=ymin;j<ymax;j++){
+ for (i=xmin;i<xmax;i++){newData->SetScalarComponentFromDouble(i,j,0,0,0);} // for i
+ } // for j
+ } //c2
+
+ if (c3==true)
+ {
+ if (bbGetInputTypeOrientation()==0) { xmin=x; xmax=dimX; ymin=0; ymax=y; }
+ if (bbGetInputTypeOrientation()==1) { xmin=x; xmax=dimX; ymin=dimY-z; ymax=dimY; }
+ if (bbGetInputTypeOrientation()==2) { xmin=y; xmax=dimX; ymin=dimY-z; ymax=dimY; }
+ for (j=ymin;j<ymax;j++){
+ for (i=xmin;i<xmax;i++){newData->SetScalarComponentFromDouble(i,j,0,0,0);} // for i
+ } // for j
+ } //c3
+
+ if (c4==true)
+ {
+ if (bbGetInputTypeOrientation()==0) { xmin=x; xmax=dimX; ymin=y; ymax=dimY; }
+ if (bbGetInputTypeOrientation()==1) { xmin=x; xmax=dimX; ymin=0; ymax=dimY-z; }
+ if (bbGetInputTypeOrientation()==2) { xmin=y; xmax=dimX; ymin=0; ymax=dimY-z; }
+ for (j=ymin;j<ymax;j++){
+ for (i=xmin;i<xmax;i++){newData->SetScalarComponentFromDouble(i,j,0,0,0);} // for i
+ } // for j
+
+ } //c4
+
+ bbSetOutputOut( newData );
+
+}
+//=====
+// 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)
+//=====
+void ImageCutByAxis::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(NULL);
+ bbSetInputType("x+y+z+");
+ bbSetInputInsideVol(true);
+ std::vector<int> point;
+ point.push_back(0);
+ point.push_back(0);
+ point.push_back(0);
+ bbSetInputPoint(point);
+}
+//=====
+// 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)
+//=====
+void ImageCutByAxis::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void ImageCutByAxis::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkImageCutByAxis_h_INCLUDED__
+#define __bbcreaVtkImageCutByAxis_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include <vtkImageData.h>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT ImageCutByAxis
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ImageCutByAxis,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(InsideVol,bool);
+ BBTK_DECLARE_INPUT(Point,std::vector<int>);
+ BBTK_DECLARE_INPUT(Type,std::string);
+ BBTK_DECLARE_INPUT(TypeOrientation,int);
+ BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageCutByAxis,bbtk::AtomicBlackBox);
+ BBTK_NAME("ImageCutByAxis");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ImageCutByAxis,In,"Input image",vtkImageData*,"");
+ BBTK_INPUT(ImageCutByAxis,Type,"x y z x+y+ x-y+ x+y- x-y- y+z+ y+z- y-z+ y-z- x+z+ x+z- x-z+ x-z- x+y+z+ x-y+z+ x+y-z+ x+y+z- x-y-z+ x-y+z- x+y-z- x-y-z-",std::string,"");
+ BBTK_INPUT(ImageCutByAxis,InsideVol,"Inside volume",bool,"");
+ BBTK_INPUT(ImageCutByAxis,Point,"First input",std::vector<int>,"");
+ BBTK_INPUT(ImageCutByAxis,TypeOrientation,"TypeOrientation (default 0) 0=XY 1=XZ 2=YZ",int,"");
+ BBTK_OUTPUT(ImageCutByAxis,Out,"Output image",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ImageCutByAxis);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkImageCutByAxis_h_INCLUDED__
+
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkLightKit.h"
+#include "bbcreaVtkPackage.h"
+
+//#include <vtkLight.h>
+#include <vtkLightCollection.h>
+#include <vtkLightKit.h>
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,LightKit)
+BBTK_BLACK_BOX_IMPLEMENTATION(LightKit,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void LightKit::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (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')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ vtkLightCollection* originalLights = bbGetInputRenderer()->GetLights();
+ std::cout << "Now there are " << originalLights->GetNumberOfItems() << " lights." << std::endl;
+
+ if (firsttime==true)
+ {
+ firsttime=false;
+ bbGetInputRenderer()->RemoveAllLights();
+ vtkLightKit *lightKit=vtkLightKit::New();
+ //bbGetInputRenderer()->SetTwoSidedLighting(0);
+ lightKit->SetKeyLightWarmth( bbGetInputKeyLightWarmth() );
+ lightKit->SetFillLightWarmth( bbGetInputFillLightWarmth() );
+ lightKit->SetBackLightWarmth( bbGetInputBackLightWarmth() );
+ lightKit->AddLightsToRenderer( bbGetInputRenderer() );
+ }
+
+}
+//=====
+// 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)
+//=====
+void LightKit::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputRenderer(NULL);
+ bbSetInputKeyLightWarmth(0.8);
+ bbSetInputFillLightWarmth(5.0);
+ bbSetInputBackLightWarmth(0.5);
+}
+//=====
+// 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)
+//=====
+void LightKit::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void LightKit::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkLightKit_h_INCLUDED__
+#define __bbcreaVtkLightKit_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkRenderer.h>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT LightKit
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(LightKit,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(KeyLightWarmth,double);
+ BBTK_DECLARE_INPUT(FillLightWarmth,double);
+ BBTK_DECLARE_INPUT(BackLightWarmth,double);
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer *);
+
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+ bool firsttime;
+
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(LightKit,bbtk::AtomicBlackBox);
+ BBTK_NAME("LightKit");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(LightKit,KeyLightWarmth,"KeyLightWarmth", double ,"");
+ BBTK_INPUT(LightKit,FillLightWarmth,"FillLightWarmth", double ,"");
+ BBTK_INPUT(LightKit,BackLightWarmth,"BackLightWarmth", double ,"");
+ BBTK_INPUT(LightKit,Renderer,"3D scene in which to insert the surface",vtkRenderer*,"");
+// BBTK_OUTPUT(LightKit,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(LightKit);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkLightKit_h_INCLUDED__
+
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkMeshCutByAxis.h"
+#include "bbcreaVtkPackage.h"
+
+#include <vtkBox.h>
+#include <vtkPlane.h>
+#include <vtkClipPolyData.h>
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshCutByAxis)
+BBTK_BLACK_BOX_IMPLEMENTATION(MeshCutByAxis,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void MeshCutByAxis::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (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')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ int ok=0;
+ int sb=1000;
+ vtkPlane *clipPlane = vtkPlane::New();
+ vtkBox *clipBox = vtkBox::New();
+ vtkClipPolyData *clipper = vtkClipPolyData::New();
+ clipper -> SetInput( bbGetInputIn() );
+ clipper->SetInsideOut( bbGetInputInsideVol() );
+
+ int a; // correction border
+ if (bbGetInputInsideVol()==false)
+ {
+ a=1;
+ } else {
+ a=0;
+ }
+
+ int px=bbGetInputPoint()[0];
+ int py=bbGetInputPoint()[1];
+ int pz=bbGetInputPoint()[2];
+
+ if ( bbGetInputType()=="x" ) { clipPlane->SetNormal(1, 0, 0); ok=1; } else
+ if ( bbGetInputType()=="y" ) { clipPlane->SetNormal(0, 1, 0); ok=1; } else
+ if ( bbGetInputType()=="z" ) { clipPlane->SetNormal(0, 0, 1); ok=1; } else
+
+ if ( bbGetInputType()=="x+y+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x-y+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x+y-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz-sb ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x-y-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz-sb ,pz+sb ); ok=2; } else
+
+ if ( bbGetInputType()=="y+z+" ) { clipBox->SetBounds(px-sb,px+sb ,py ,py+sb ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="y-z+" ) { clipBox->SetBounds(px-sb,px+sb ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="y+z-" ) { clipBox->SetBounds(px-sb,px+sb ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else
+ if ( bbGetInputType()=="y-z-" ) { clipBox->SetBounds(px-sb,px+sb ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; } else
+
+ if ( bbGetInputType()=="x+z+" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+sb ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x-z+" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+sb ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x+z-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else
+ if ( bbGetInputType()=="x-z-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else
+
+
+ if ( bbGetInputType()=="x+y+z+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x-y+z+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x+y-z+" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x+y+z-" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else
+ if ( bbGetInputType()=="x-y-z+" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else
+ if ( bbGetInputType()=="x+y-z-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; } else
+ if ( bbGetInputType()=="x-y+z-" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else
+ if ( bbGetInputType()=="x-y-z-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; }
+
+ if (ok==1) {
+ clipPlane -> SetOrigin(px,py,pz);
+ clipper -> SetClipFunction(clipPlane);
+ bbSetOutputOut( clipper->GetOutput() );
+ } else if (ok==2) {
+
+ clipper -> SetClipFunction(clipBox);
+ bbSetOutputOut( clipper->GetOutput() );
+ } else {
+ bbSetOutputOut( bbGetInputIn() );
+ } // ok
+}
+//=====
+// 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)
+//=====
+void MeshCutByAxis::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(NULL);
+ bbSetInputType("x+y+z+");
+ bbSetInputInsideVol(true);
+ std::vector<int> point;
+ point.push_back(0);
+ point.push_back(0);
+ point.push_back(0);
+ bbSetInputPoint(point);
+}
+//=====
+// 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)
+//=====
+void MeshCutByAxis::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void MeshCutByAxis::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkMeshCutByAxis_h_INCLUDED__
+#define __bbcreaVtkMeshCutByAxis_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include <vtkPolyData.h>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT MeshCutByAxis
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(MeshCutByAxis,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(In,vtkPolyData*);
+ BBTK_DECLARE_INPUT(Type,std::string);
+ BBTK_DECLARE_INPUT(InsideVol,bool);
+ BBTK_DECLARE_INPUT(Point,std::vector<int>);
+ BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(MeshCutByAxis,bbtk::AtomicBlackBox);
+ BBTK_NAME("MeshCutByAxis");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("MeshCutByAxis");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(MeshCutByAxis,In,"Mesh to be cut",vtkPolyData*,"");
+ BBTK_INPUT(MeshCutByAxis,Type,"x y z x+y+ x-y+ x+y- x-y- y+z+ y+z- y-z+ y-z- x+z+ x+z- x-z+ x-z- x+y+z+ x-y+z+ x+y-z+ x+y+z- x-y-z+ x-y+z- x+y-z- x-y-z-",std::string,"");
+ BBTK_INPUT(MeshCutByAxis,InsideVol,"Inside volume",bool,"");
+ BBTK_INPUT(MeshCutByAxis,Point,"First input",std::vector<int>,"");
+ BBTK_OUTPUT(MeshCutByAxis,Out,"First output",vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(MeshCutByAxis);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkMeshCutByAxis_h_INCLUDED__
+
p0[2]=0;
double p1[3];
p1[0]=0;
- p1[1]=0;
+ p1[1]=1;
p1[2]=0;
double p2[3];
p2[0]=0;
p2[1]=0;
- p2[2]=0;
+ p2[2]=1;
double c[3];
c[0]=bbGetInputCenter()[0];
c[1]=bbGetInputCenter()[1];
c[2]=bbGetInputCenter()[2];
- plane->SetResolution( 100, 100);
+ plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() );
plane->SetOrigin( p0 );
plane->SetPoint1( p1 );
plane->SetPoint2( p2 );
plane->SetCenter( c );
plane->Update( );
bbSetOutputPlane( (vtkDataSet*)plane );
- std::cout << "CFT End of Process() CFT" << std::endl;
-
+ bbSetOutputPolyData( plane->GetOutput() );
+
}
//=====
// 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)
//=====
void PlaneSource::bbUserSetDefaultValues()
{
-
+ std::vector<double> c;
+ std::vector<double> n;
+ c.push_back(0);
+ c.push_back(0);
+ c.push_back(0);
+ n.push_back(1);
+ n.push_back(0);
+ n.push_back(0);
+ bbSetInputCenter(c);
+ bbSetInputNormal(n);
+ bbSetInputXResolution(100);
+ bbSetInputYResolution(100);
}
//=====
// 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)
#include "iostream"
#include "vtkPlaneSource.h"
#include "vtkDataSet.h"
+#include "vtkPolyData.h"
namespace bbcreaVtk
{
// 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)
//=====
BBTK_DECLARE_INPUT(Center,std::vector<double>);
- BBTK_DECLARE_INPUT(Normal,std::vector<double>);
+ BBTK_DECLARE_INPUT(Normal,std::vector<double>);
+ BBTK_DECLARE_INPUT(XResolution,int);
+ BBTK_DECLARE_INPUT(YResolution,int);
BBTK_DECLARE_OUTPUT(Plane,vtkDataSet*);
+ BBTK_DECLARE_OUTPUT(PolyData,vtkPolyData*);
BBTK_PROCESS(Process);
void Process();
//=====
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneSource,bbtk::AtomicBlackBox);
-BBTK_NAME("PlaneSource");
-BBTK_AUTHOR("carlos torres");
-BBTK_DESCRIPTION("No Description.");
-BBTK_CATEGORY("empty");
-BBTK_INPUT(PlaneSource,Center,"Center",std::vector<double>,"");
-BBTK_INPUT(PlaneSource,Normal,"Normal",std::vector<double>,"");
-BBTK_OUTPUT(PlaneSource,Plane,"Plane",vtkDataSet*,"");
+ BBTK_NAME("PlaneSource");
+ BBTK_AUTHOR("carlos torres");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(PlaneSource,Center,"Center (default[0,0,0]) ",std::vector<double>,"");
+ BBTK_INPUT(PlaneSource,Normal,"Normal (default[1,0,0]) ",std::vector<double>,"");
+ BBTK_INPUT(PlaneSource,XResolution,"XResolution (default 100)",int,"");
+ BBTK_INPUT(PlaneSource,YResolution,"YResolution (default 100)",int,"");
+ BBTK_OUTPUT(PlaneSource,Plane,"Plane",vtkDataSet*,"");
+ BBTK_OUTPUT(PlaneSource,PolyData,"vtkPolyData",vtkPolyData*,"");
BBTK_END_DESCRIBE_BLACK_BOX(PlaneSource);
//=====
// 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)
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkPointPicker.h"
+#include "bbcreaVtkPackage.h"
+
+#include <vtkPropPicker.h>
+#include <vtkCellPicker.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkRendererCollection.h>
+
+namespace bbcreaVtk
+{
+
+
+
+void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void*)
+{
+ printf("creaVtkCallbackPointPicker EED Picker\n");
+ vtkRenderWindowInteractor *iren = static_cast<vtkRenderWindowInteractor*>(caller);
+
+ int* pos = iren->GetEventPosition();
+ vtkCellPicker *picker = vtkCellPicker::New();
+ picker->SetTolerance(0.0005);
+ picker->Pick(pos[0], pos[1], 0, iren->GetRenderWindow()->GetRenderers()->GetFirstRenderer() );
+
+ if(picker->GetCellId() != -1)
+ {
+ printf("creaVtkCallbackPointPicker EED picker OK\n");
+ } else {
+ printf("creaVtkCallbackPointPicker EED picker --\n");
+ } // if
+
+
+/*
+{
+
+ std::cout << "Pick position is: " << worldPosition[0] << " " << worldPosition[1]
+ << " " << worldPosition[2] << endl;
+
+ vtkSmartPointer<vtkIdTypeArray> ids =
+ vtkSmartPointer<vtkIdTypeArray>::New();
+ ids->SetNumberOfComponents(1);
+ ids->InsertNextValue(picker->GetCellId());
+
+ vtkSmartPointer<vtkSelectionNode> selectionNode =
+ vtkSmartPointer<vtkSelectionNode>::New();
+ selectionNode->SetFieldType(vtkSelectionNode::CELL);
+ selectionNode->SetContentType(vtkSelectionNode::INDICES);
+ selectionNode->SetSelectionList(ids);
+
+ vtkSmartPointer<vtkSelection> selection =
+ vtkSmartPointer<vtkSelection>::New();
+ selection->AddNode(selectionNode);
+
+ vtkSmartPointer<vtkExtractSelection> extractSelection =
+ vtkSmartPointer<vtkExtractSelection>::New();
+#if VTK_MAJOR_VERSION <= 5
+ extractSelection->SetInput(0, this->Data);
+ extractSelection->SetInput(1, selection);
+#else
+ extractSelection->SetInputData(0, this->Data);
+ extractSelection->SetInputData(1, selection);
+#endif
+ extractSelection->Update();
+
+ // In selection
+ vtkSmartPointer<vtkUnstructuredGrid> selected =
+ vtkSmartPointer<vtkUnstructuredGrid>::New();
+ selected->ShallowCopy(extractSelection->GetOutput());
+
+ std::cout << "There are " << selected->GetNumberOfPoints()
+ << " points in the selection." << std::endl;
+ std::cout << "There are " << selected->GetNumberOfCells()
+ << " cells in the selection." << std::endl;
+
+
+#if VTK_MAJOR_VERSION <= 5
+ selectedMapper->SetInputConnection(
+ selected->GetProducerPort());
+#else
+ selectedMapper->SetInputData(selected);
+#endif
+
+ selectedActor->SetMapper(selectedMapper);
+ selectedActor->GetProperty()->EdgeVisibilityOn();
+ selectedActor->GetProperty()->SetEdgeColor(1,0,0);
+ selectedActor->GetProperty()->SetLineWidth(3);
+
+ this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(selectedActor);
+
+ }
+*/
+
+
+
+}
+
+
+//--------------------------------------------------------
+//--------------------------------------------------------
+//--------------------------------------------------------
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PointPicker)
+BBTK_BLACK_BOX_IMPLEMENTATION(PointPicker,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void PointPicker::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (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')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (firsttime==true)
+ {
+
+printf("EED PointPicker::Process Firsttime \n");
+ firsttime = false;
+// vtkCellPicker *picker = vtkCellPicker::New();
+// vtkPropPicker *picker = vtkCellPicker::New();
+// picker->SetTolerance(0.005);
+
+// picker->AddObserver("EndPickEvent", annotatePick)
+// iren = vtk.vtkRenderWindowInteractor()
+// iren.SetPicker(picker)
+
+/*
+ creaVtkCallbackPointPicker *callPicker = creaVtkCallbackPointPicker::New();
+ picker->AddObserver( vtkCommand::EndPickEvent , callPicker );
+ picker->AddObserver( vtkCommand::StartPickEvent , callPicker );
+ picker->AddObserver( vtkCommand::MouseMoveEvent , callPicker );
+ bbGetInputRenderer()->GetRenderWindow()->GetInteractor()->SetPicker(picker);
+*/
+
+ creaVtkCallbackPointPicker *callPicker = creaVtkCallbackPointPicker::New();
+ vtkRenderWindowInteractor *vrwi = bbGetInputRenderer()->GetRenderWindow()->GetInteractor();
+ vrwi->AddObserver( vtkCommand::EndPickEvent , callPicker );
+ vrwi->AddObserver( vtkCommand::StartPickEvent , callPicker );
+ vrwi->AddObserver( vtkCommand::MouseMoveEvent , callPicker );
+
+ } // if firsttime
+
+}
+//=====
+// 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)
+//=====
+void PointPicker::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+// bbSetInputIn(0);
+
+ firsttime=true;
+}
+//=====
+// 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)
+//=====
+void PointPicker::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void PointPicker::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkPointPicker_h_INCLUDED__
+#define __bbcreaVtkPointPicker_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkCommand.h"
+#include "vtkRenderer.h"
+
+namespace bbcreaVtk
+{
+
+
+//---------------------------------------------
+class creaVtkCallbackPointPicker : public vtkCommand
+{
+ public:
+ static creaVtkCallbackPointPicker *New() { return new creaVtkCallbackPointPicker; }
+ void Delete() { delete this; }
+ virtual void Execute(vtkObject *caller, unsigned long, void*);
+
+};
+
+
+//---------------------------------------------
+//---------------------------------------------
+//---------------------------------------------
+
+
+class bbcreaVtk_EXPORT PointPicker
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(PointPicker,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ BBTK_DECLARE_OUTPUT(Out,std::vector<double>);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ bool firsttime;
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(PointPicker,bbtk::AtomicBlackBox);
+BBTK_NAME("PointPicker");
+BBTK_AUTHOR("InfoDev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(PointPicker,Renderer,"vtk Renderer",vtkRenderer*,"");
+BBTK_OUTPUT(PointPicker,Out,"First output",std::vector<double>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(PointPicker);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkPointPicker_h_INCLUDED__
+
return newImage;
}
-
-void ReadMHDPlane::ReadNormalMHD()
+vtkImageData* ReadMHDPlane::ChangeOrientation(vtkImageData* imgOrg)
{
-// THE MAIN PROCESSING METHOD BODY
-// Here we simply set the input 'In' value to the output 'Out'
-// And print out the output value
-// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
-// void bbSet{Input|Output}NAME(const TYPE&)
-// const TYPE& bbGet{Input|Output}NAME() const
-// Where :
-// * NAME is the name of the input/output
-// (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')
-
-// bbSetOutputOut( bbGetInputIn() );
-// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- std::string inputfilename;
- int slice;
- int width;
- long long dataSize;
+ int width = bbGetInputWidth();
+ int ext[6];
+ int sizeXOrg, sizeYOrg,sizeZOrg;
+ int sizeXDst, sizeYDst,sizeZDst;
+ imgOrg->GetWholeExtent(ext);
+ int sizeLine;
+
+ sizeXOrg = ext[1]-ext[0]+1;
+ sizeYOrg = ext[3]-ext[2]+1;
+ sizeZOrg = ext[5]-ext[4]+1;
+ if (bbGetInputDirectionPlane()=="XY")
+ {
+ sizeXDst = ext[1]-ext[0]+1;
+ sizeYDst = ext[3]-ext[2]+1;
+ sizeZDst = width;
+ } // XY
+ if (bbGetInputDirectionPlane()=="YZ")
+ {
+ sizeXDst = width;
+ sizeYDst = ext[1]-ext[0]+1;
+ sizeZDst = ext[3]-ext[2]+1;
+ sizeLine = sizeYDst;
+ } // YZ
+ if (bbGetInputDirectionPlane()=="ZX")
+ {
+ sizeXDst = ext[1]-ext[0]+1;
+ sizeYDst = width;
+ sizeZDst = ext[3]-ext[2]+1;
+ sizeLine = sizeXDst;
+ } // ZX
+ vtkImageData *imgDst = vtkImageData::New();
+ imgDst->Initialize();
+ imgDst->SetScalarType( imgOrg->GetScalarType() );
+ imgDst->SetSpacing( imgOrg->GetSpacing() );
+ imgDst->SetDimensions( sizeXDst,sizeYDst,sizeZDst );
+ imgDst->SetWholeExtent(0,sizeXDst-1,0,sizeYDst-1,0,sizeZDst-1 );
+ imgDst->SetExtent(0,sizeXDst-1,0,sizeYDst-1,0,sizeZDst-1 );
+ imgDst->SetNumberOfScalarComponents(1);
+ imgDst->AllocateScalars();
+ imgDst->Update();
+
+ char *ptrDst,*ptrOrg;
+ int sizeBytes = imgOrg->GetScalarSize();
+ int sizeLineBytes = sizeLine*imgOrg->GetScalarSize();
+ int xx,yy,zz;
+
+ long int sizeXDstBytes = sizeXDst*sizeBytes;
+ long int sizeXYDstBytes = sizeXDst*sizeYDst*sizeBytes;
+ long int sizeXYDstBytes2 = sizeXDst*sizeYDst*sizeBytes*2;
+ long int sizeXYZDstBytes = sizeXDst*sizeYDst*sizeZDst*sizeBytes;
+ long int sizeXYZDstBytes1 = sizeXDst*sizeYDst*(sizeZDst-1)*sizeBytes;
+
+ ptrOrg = (char*)( imgOrg->GetScalarPointer() );
if (bbGetInputDirectionPlane()=="XY")
{
- inputfilename=bbGetInputFileName();
+ memcpy ( imgDst->GetScalarPointer(), ptrOrg , sizeXDst*sizeYDst*sizeZDst*(imgOrg->GetScalarSize()) );
} // if XY
-
- if ((bbGetInputDirectionPlane()=="YZ") || (bbGetInputDirectionPlane()=="ZX"))
+ if (bbGetInputDirectionPlane()=="ZX")
{
- //-- Split FileName
- std::size_t found = bbGetInputFileName().find_last_of("/\\");
- std::string path = bbGetInputFileName().substr(0,found+1);
- std::string filename = bbGetInputFileName().substr(found+1);
-#ifdef _WIN32
- path=path+"YZ_ZX\\";
-#else
- path=path+"YZ_ZX/";
-#endif
- if (bbGetInputDirectionPlane()=="YZ")
- {
- inputfilename = path+filename+"_YZ.mhd";
- } // if YZ
-
- if (bbGetInputDirectionPlane()=="ZX")
+ ptrDst = (char*)( imgDst->GetScalarPointer(0,0,sizeYOrg-00-1) );
+ for( zz=0 ; zz<sizeZOrg ; zz++)
{
- inputfilename = path+filename+"_ZX.mhd";
- } // XZ
- } // if YZ || XZ
-
- width = bbGetInputWidth();
- if (width<=0 ) { width=1; }
-
- slice = bbGetInputSlice();
- if (slice<0 ) { slice=0; }
-
- vtkImageData *newImage;
- long long newHeaderSize;
- std::string newFileName=inputfilename+"-OneSlice";
-
- int sx,sy,sz;
- char mystring[250];
- char strTmp[20];
- bool ok=true;
- FILE *ffIn = fopen(inputfilename.c_str(),"r");
- if (ffIn!=NULL)
- {
- FILE *ffOut = fopen(newFileName.c_str(),"w");
-
- while(!feof(ffIn))
- {
- strcpy(mystring,"\n");
- fgets(mystring,250,ffIn);
- if (strncmp("NDims",mystring,5)==0)
- {
- if (width==1)
- {
- strcpy(mystring,"NDims = 2\n");
- } else {
- strcpy(mystring,"NDims = 3\n");
- }
- }
- if (strncmp("DimSize",mystring,6)==0)
+// ptrDst=(char*)( imgDst->GetScalarPointer(0,zz,sizeYOrg-00-1) );
+ for( yy=0 ; yy<sizeYOrg ; yy++)
{
- sscanf(mystring,"%s %s %d %d %d",strTmp, strTmp, &sx, &sy,&sz);
-
- if (width==1)
- {
- sprintf(mystring,"DimSize = %d %d\n",sx,sy);
- } else {
- sprintf(mystring,"DimSize = %d %d %d\n",sx,sy,width);
- }
-
- newHeaderSize = (long long int)sx*(long long int)sy*(long long int)slice;
- if (bbGetInputSlice()>=sz) {ok=false;}
- } // if
- if (strncmp("ElementType = MET_CHAR",mystring,22)==0) { dataSize=sizeof(char); }
- if (strncmp("ElementType = VTK_CHAR",mystring,22)==0) { dataSize=sizeof(char); }
- if (strncmp("ElementType = MET_UCHAR",mystring,23)==0) { dataSize=sizeof(unsigned char); }
- if (strncmp("ElementType = VTK_UNSIGNED_CHAR",mystring,31)==0) { dataSize=sizeof(unsigned char); }
- if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { dataSize=sizeof(unsigned short); }
- if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { dataSize=sizeof(unsigned short); }
- if (strncmp("ElementType = MET_SHORT",mystring,23)==0) { dataSize=sizeof(short); }
- if (strncmp("ElementType = VTK_SHORT",mystring,23)==0) { dataSize=sizeof(short); }
- if (strncmp("ElementType = MET_UINT",mystring,22)==0) { dataSize=sizeof(unsigned int); }
- if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,30)==0) { dataSize=sizeof(unsigned int); }
- if (strncmp("ElementType = MET_INT",mystring,21)==0) { dataSize=sizeof(int); }
- if (strncmp("ElementType = VTK_INT",mystring,21)==0) { dataSize=sizeof(int); }
- if (strncmp("ElementType = MET_FLOAT",mystring,23)==0) { dataSize=sizeof(float); }
- if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0) { dataSize=sizeof(float); }
- if (strncmp("ElementType = MET_LONG",mystring,22)==0) { dataSize=sizeof(long); }
- if (strncmp("ElementType = VTK_LONG",mystring,22)==0) { dataSize=sizeof(long); }
- if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0) { dataSize=sizeof(double); }
- if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0) { dataSize=sizeof(double); }
- newHeaderSize=newHeaderSize*dataSize;
-
- if (strncmp("Offset",mystring,6)==0) {strcpy(mystring,"Offset = 0 0 0\n");}
- if (strncmp("HeaderSize",mystring,10)==0) {strcpy(mystring,"");}
- if (strncmp("ElementDataFile",mystring,15)==0)
- {
- fprintf(ffOut,"HeaderSize = %lld\n\n", newHeaderSize );
- } // if
- fprintf(ffOut,mystring);
- } // while
- fclose(ffIn);
- fclose(ffOut);
-
- if (ok==true)
- {
- vtkMetaImageReader * reader = vtkMetaImageReader::New();
- reader->SetFileName( newFileName.c_str() );
- reader->Update();
- newImage = reader->GetOutput();
- } // if ok
- } else {
- ok=false;
- printf("EED ERROR: Problem openin:%s\n", inputfilename.c_str() );
- }
-
- if (ok==false)
+// ptrOrg=(char*)( imgOrg->GetScalarPointer(0,yy,zz) );
+// ptrDst=(char*)( imgDst->GetScalarPointer(0,zz,sizeYOrg-yy-1) );
+ memcpy ( ptrDst, ptrOrg , sizeLineBytes );
+ ptrOrg = ptrOrg + sizeLineBytes;
+ ptrDst = ptrDst - sizeXYDstBytes;
+ } // for yy
+ ptrDst = ptrDst + sizeXDstBytes;
+ ptrDst = ptrDst + sizeXYZDstBytes;
+ } // for zz
+ } // ZX
+
+ if (bbGetInputDirectionPlane()=="YZ")
{
- newImage=CreateDefaultImage();
- } // if ok
-
- bbSetOutputOut( newImage );
+ ptrDst = (char*)( imgDst->GetScalarPointer(0,0,sizeYOrg-0-1) );
+ for( zz=0 ; zz<sizeZOrg ; zz++)
+ {
+ ptrDst=(char*)( imgDst->GetScalarPointer(zz,0,sizeYOrg-0-1) );
+ for( yy=0 ; yy<sizeYOrg ; yy++)
+ {
+// ptrDst=(char*)( imgDst->GetScalarPointer(zz,0,sizeYOrg-yy-1) );
+ for( xx=0 ; xx<sizeXOrg ; xx++)
+ {
+// ptrOrg=(char*)( imgOrg->GetScalarPointer(xx,yy,zz) );
+// ptrDst=(char*)( imgDst->GetScalarPointer(zz,xx,sizeYOrg-yy-1) );
+ memcpy ( ptrDst, ptrOrg , sizeBytes );
+ ptrOrg+= sizeBytes;
+ ptrDst+= sizeXDstBytes;
+ } /// for xx
+ ptrDst = ptrDst - sizeXYDstBytes2;
+ } // for yy
+ ptrDst = ptrDst + sizeXYZDstBytes;
+// ptrDst++;
+ } // for zz
+ } // ZX
+
+ return imgDst;
}
-
-
-
-
-void ReadMHDPlane::Read64lseek()
+void ReadMHDPlane::Read64lseek(std::string fileNameIn, std::string plane)
{
int slice;
int width;
-
width = bbGetInputWidth();
if (width<=0 ) { width=1; }
-
slice = bbGetInputSlice();
if (slice<0 ) { slice=0; }
-
int dimX=-1,dimY=-1,dimZ=-1;
int dim=-1;
std::string formattype("VOID");
float spcX=-1,spcY=-1,spcZ=-1;
float ox=-1,oy=-1,oz=-1;
long int headersize=0;
-
vtkImageData *newImage=NULL;
+
int imageType;
char mystring[250];
char strTmp[30];
char strTmp2[30];
- FILE *ffIn = fopen(bbGetInputFileName().c_str(),"r");
+ FILE *ffIn = fopen( fileNameIn.c_str() , "r");
long long dataSize;
-
if (ffIn!=NULL)
{
newImage = vtkImageData::New();
-
while(!feof(ffIn))
{
strcpy(mystring,"\n");
fgets(mystring,250,ffIn);
- if (strncmp("NDims",mystring,5)==0) { sscanf(mystring,"%s %s %d" ,strTmp, strTmp, &dim); }
- if (strncmp("DimSize",mystring,6)==0) { sscanf(mystring,"%s %s %d %d %d" ,strTmp, strTmp, &dimX, &dimY,&dimZ); }
+ if (strncmp("NDims",mystring,5)==0) { sscanf(mystring,"%s %s %d" ,strTmp, strTmp, &dim); }
+ if (strncmp("DimSize",mystring,6)==0) { sscanf(mystring,"%s %s %d %d %d" ,strTmp, strTmp, &dimX, &dimY,&dimZ); }
if (strncmp("ElementType",mystring,11)==0) { sscanf(mystring,"%s %s %s" ,strTmp, strTmp, strTmp2); formattype=strTmp2; }
- if (strncmp("ElementSpacing",mystring,14)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
- if (strncmp("ElementSize",mystring,11)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
- if (strncmp("Offset",mystring,6)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &ox, &oy, &oz); }
- if (strncmp("HeaderSize",mystring,10)==0) { sscanf(mystring,"%s %s %ld" ,strTmp, strTmp, &headersize); }
+ if (strncmp("ElementSpacing",mystring,14)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
+ if (strncmp("ElementSize",mystring,11)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
+ if (strncmp("Offset",mystring,6)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &ox, &oy, &oz); }
+ if (strncmp("HeaderSize",mystring,10)==0) { sscanf(mystring,"%s %s %ld" ,strTmp, strTmp, &headersize); }
if (strncmp("ElementDataFile",mystring,15)==0) { sscanf(mystring,"%s %s %s" ,strTmp, strTmp, strTmp2); elementdatafile=strTmp2; }
-
+
if (strncmp("ElementType = MET_CHAR",mystring,22)==0) { imageType =VTK_CHAR; dataSize=sizeof(char); }
if (strncmp("ElementType = VTK_CHAR",mystring,22)==0) { imageType =VTK_CHAR; dataSize=sizeof(char); }
} // while
fclose(ffIn);
-
newImage->Initialize();
-
-
int fd;
long long ret;
std::size_t found;
std::string filename;
- found = bbGetInputFileName().find_last_of("/\\");
- filename = bbGetInputFileName().substr(0,found+1) + elementdatafile ;
+ found = fileNameIn.find_last_of("/\\");
+ filename = fileNameIn.substr(0,found+1) + elementdatafile ;
long long pos;
-
long long lsize = dimX*dimY*width *dataSize;
-
-
#if defined(_WIN32)
_sopen_s( &fd, filename.c_str(), _O_RDONLY, _SH_DENYNO, 0 );
#else
fd = open ( filename.c_str() , O_RDONLY|O_LARGEFILE );
#endif // defined(_WIN32)
-
-
if (fd < 0)
{
printf("EED ReadMHDPlane::Read64lseek WARNNING! raw file not exist\n");
newImage=CreateDefaultImage();
// exit(1);
}
-
-
- if ((bbGetInputDirectionPlane()=="XY") && (fd>=0))
+ if ((plane=="XY") && (fd>=0))
{
newImage->SetSpacing( spcX,spcY,spcZ );
newImage->SetDimensions( dimX,dimY,width );
fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno));
exit(1);
}
-
if ((ret = read(fd, newImage->GetScalarPointer() , lsize)) < 0)
{
fprintf(stderr, "Failed reading: %s\n", strerror(errno));
exit(1);
}
} // if PLANE XY
-
- if ((bbGetInputDirectionPlane()=="XZ") && (fd>=0))
+ if ((plane=="ZX") && (fd>=0))
{
newImage->SetSpacing( spcX,spcZ,spcY );
newImage->SetDimensions( dimX,dimZ,width );
int iWidth;
for (iWidth=0;iWidth<width;iWidth++)
{
- copy_XZ_plane(fd,newImage,slice+iWidth,iWidth,dimX,dimY,dimZ,dataSize);
+ copy_ZX_plane(fd,newImage,slice+iWidth,iWidth,dimX,dimY,dimZ,dataSize);
}
} // if PLANE XZ
-
- if ((bbGetInputDirectionPlane()=="YZ") && (fd>=0))
+ if ((plane=="YZ") && (fd>=0))
{
newImage->SetSpacing( spcY,spcZ,spcX );
newImage->SetDimensions( dimY,dimZ,width );
{
copy_YZ_plane(fd,newImage,slice+iWidth,iWidth,dimX,dimY,dimZ,dataSize);
}
-
} // if PLANE YZ
#if defined(_WIN32)
_close (fd);
} else {
newImage=CreateDefaultImage();
} // if ffIn
-
bbSetOutputOut( newImage );
+ bbSetOutputOut2( ChangeOrientation(newImage) );
}
}
-void ReadMHDPlane::copy_XZ_plane(int fd,vtkImageData *newImage,int slice,int iWidth,int dimX,int dimY,int dimZ,int dataSize)
+void ReadMHDPlane::copy_ZX_plane(int fd,vtkImageData *newImage,int slice,int iWidth,int dimX,int dimY,int dimZ,int dataSize)
{
long long int j;
long long ret;
fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno));
exit(1);
}
-
if ((ret = read(fd, pImage , dimX*dataSize)) < 0)
{
fprintf(stderr, "Failed reading: %s\n", strerror(errno));
} // for j
}
-
-
void ReadMHDPlane::Process()
{
- if (bbGetInputType()==0)
+ if (bbGetInputActive()==true)
{
- ReadNormalMHD();
- }
-
- if (bbGetInputType()==1)
- {
- Read64lseek();
- }
-
+ if (bbGetInputType()==0)
+ {
+ //-- Split FileName
+ std::string inputfilename;
+ std::size_t found = bbGetInputFileName().find_last_of("/\\");
+ std::string path = bbGetInputFileName().substr(0,found+1);
+ std::string filename = bbGetInputFileName().substr(found+1);
+ #ifdef _WIN32
+ path=path+"YZ_ZX\\";
+ #else
+ path=path+"YZ_ZX/";
+ #endif
+ if (bbGetInputDirectionPlane()=="XY") { inputfilename = bbGetInputFileName(); } // if XY
+ if (bbGetInputDirectionPlane()=="YZ") { inputfilename = path+filename+"_YZ.mhd"; } // if YZ
+ if (bbGetInputDirectionPlane()=="ZX") { inputfilename = path+filename+"_ZX.mhd"; } // if XZ
+ Read64lseek( inputfilename ,"XY");
+ }
+ if (bbGetInputType()==1)
+ {
+ Read64lseek( bbGetInputFileName(), bbGetInputDirectionPlane() );
+ }
+ } // if active
}
+
//=====
// 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)
//=====
void ReadMHDPlane::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
+ bbSetInputActive(true);
bbSetInputFileName("");
bbSetInputSlice(0);
bbSetInputType(1);
bbSetInputWidth(1);
bbSetInputDirectionPlane("XY");
-
}
+
//=====
// 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)
//=====
void ReadMHDPlane::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
// if any
-
-
}
+
//=====
// 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)
//=====
void ReadMHDPlane::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
-// if any
-
-}
+// if any
}
-// EO namespace bbcreaVtk
+
+} // EO namespace bbcreaVtk
#define __bbcreaVtkReadMHDPlane_h_INCLUDED__
-
-
-
-
#include "bbcreaVtk_EXPORT.h"
#include "bbtkAtomicBlackBox.h"
#include "iostream"
//=====
// 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)
//=====
+ BBTK_DECLARE_INPUT(Active,bool);
BBTK_DECLARE_INPUT(FileName,std::string);
BBTK_DECLARE_INPUT(Slice,int);
BBTK_DECLARE_INPUT(Width,int);
BBTK_DECLARE_INPUT(DirectionPlane,std::string);
BBTK_DECLARE_INPUT(Type,int);
BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out2,vtkImageData*);
BBTK_PROCESS(Process);
vtkImageData* CreateDefaultImage();
- void ReadNormalMHD();
- void Read64lseek();
- void copy_XZ_plane(int fd,vtkImageData *newImage,int slice,int iWidth,int dimX,int dimY,int dimZ,int dataSize);
+// EED Borrame void ReadNormalMHD();
+// EED Borrame void Read64lseek();
+ void Read64lseek(std::string,std::string plane);
+ void copy_ZX_plane(int fd,vtkImageData *newImage,int slice,int iWidth,int dimX,int dimY,int dimZ,int dataSize);
void copy_YZ_plane(int fd,vtkImageData *newImage,int slice,int iWidth,int dimX,int dimY,int dimZ,int dataSize);
+ vtkImageData* ChangeOrientation(vtkImageData* img);
void Process();
BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
+ BBTK_INPUT(ReadMHDPlane,Active,"true/false (default true)",bool,"");
BBTK_INPUT(ReadMHDPlane,FileName,"Image file name",std::string,"");
BBTK_INPUT(ReadMHDPlane,Slice,"Slice number",int,"");
BBTK_INPUT(ReadMHDPlane,Width,"(1 default) Number of slices to be read",int,"");
BBTK_INPUT(ReadMHDPlane,DirectionPlane,"Direction plane: XY (default), YZ , XZ",std::string,"");
BBTK_INPUT(ReadMHDPlane,Type,"(1 default) 0 = Normal mhd, 1 = lseek64",int,"");
BBTK_OUTPUT(ReadMHDPlane,Out,"Image 2D",vtkImageData*,"");
+ BBTK_OUTPUT(ReadMHDPlane,Out2,"Image 2D in the good orientation",vtkImageData*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ReadMHDPlane);
//=====
// 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)
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
- if (firsttime==true)
+printf("EED ScalarsToColors::Process Start\n");
+ if (firsttime==true)
{
firsttime=false;
-
// Create the color map
if (bbGetInputType()==0)
{
_colorLookupTable = vtkLookupTable::New();
- _colorLookupTable->Build();
- double rgba1[4];
- double rgba2[4];
- for (int iLookTable = 0; iLookTable<128; iLookTable++)
- {
+ if (bbGetInputRange().size()==2)
+ {
+ _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+ } else {
+ _colorLookupTable->SetRange(0,255);
+ }
+ _colorLookupTable->SetNumberOfTableValues(1000);
+ _colorLookupTable->Build();
+ double rgba1[4];
+ double rgba2[4];
+ int iLookTable;
+ for (iLookTable = 0; iLookTable<500; iLookTable++)
+ {
_colorLookupTable->GetTableValue( iLookTable, rgba1);
- _colorLookupTable->GetTableValue(256-1-iLookTable, rgba2);
-
- _colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ _colorLookupTable->GetTableValue(1000-1-iLookTable, rgba2);
+ _colorLookupTable->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
_colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
} // for iLookTable
- } // if
- } // firsttime
-
- if (bbGetInputRange().size()==2)
- {
- _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
- } else {
- _colorLookupTable->SetTableRange( 0,1 );
- }
-
- double rgb[3];
- _colorLookupTable->GetColor( bbGetInputScalarValue() , rgb );
- std::vector<double>colorRGB;
- colorRGB.push_back( rgb[0] );
- colorRGB.push_back( rgb[1] );
- colorRGB.push_back( rgb[2] );
-
- bbSetOutputColor( colorRGB );
- bbSetOutputLookupTable(_colorLookupTable);
-
+ double rgba[4];
+ _colorLookupTable->GetTableValue(0,rgba);
+ rgba[3]=0;
+ _colorLookupTable->SetTableValue(0,rgba);
+
+ int i,iMax;
+
+ iMax=(1000/16)*4;
+ for (i=0;i<iMax;i++)
+ {
+
+ _colorLookupTable->GetTableValue(500+i, rgba);
+ rgba[3]=(double)i/(double)iMax;
+ _colorLookupTable->SetTableValue(500+i,rgba);
+ _colorLookupTable->GetTableValue(500-i, rgba);
+ rgba[3]=(double)i/(double)iMax;
+ _colorLookupTable->SetTableValue(500-i,rgba);
+
+ } // for
+
+
+/*
+ iMax=100;
+ for (i=0;i<iMax;i++)
+ {
+
+ _colorLookupTable->GetTableValue(500+100+i, rgba);
+ rgba[3]=(double)i/(double)iMax;
+ _colorLookupTable->SetTableValue(500+100+i,rgba);
+ _colorLookupTable->GetTableValue(500-100-i, rgba);
+ rgba[3]=(double)i/(double)iMax;
+ _colorLookupTable->SetTableValue(500-100-i,rgba);
+
+ } // for
+
+ iMax=200;
+ for (i=0;i<iMax;i++)
+ {
+ _colorLookupTable->GetTableValue(500+i, rgba);
+ rgba[3]=0;
+ _colorLookupTable->SetTableValue(500+i,rgba);
+ _colorLookupTable->GetTableValue(500-i, rgba);
+ rgba[3]=0;
+ _colorLookupTable->SetTableValue(500-i,rgba);
+ } // for
+*/
+
+
+
+ } // if Type 0
+
+//EED 2018-06-8 ***********************ARDS Projet***********************************************
+ if (bbGetInputType()==1)
+ {
+ _colorLookupTable = vtkLookupTable::New();
+ if (bbGetInputRange().size()==2)
+ {
+ _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+ } else {
+ _colorLookupTable->SetRange(0,255);
+ }
+ _colorLookupTable->SetValueRange(0.0, 1.0); // from black to white
+ _colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation
+ _colorLookupTable->SetRampToLinear();
+ _colorLookupTable->Build();
+ double rgba[4];
+ _colorLookupTable->GetTableValue(0,rgba);
+ rgba[3]=0;
+ _colorLookupTable->SetTableValue(0,rgba);
+ } // IF
+
+
+
+
+ } // firsttime
+
+ double rgb[3];
+ std::vector<double>colorRGB;
+ _colorLookupTable->GetColor( bbGetInputScalarValue() , rgb );
+ colorRGB.push_back( rgb[0] );
+ colorRGB.push_back( rgb[1] );
+ colorRGB.push_back( rgb[2] );
+ bbSetOutputColor( colorRGB );
+ bbSetOutputLookupTable(_colorLookupTable);
+
+printf("EED ScalarsToColors::Process End\n");
+
}
//=====
// 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)
#include <vtkScalarsToColors.h>
#include <vtkLookupTable.h>
+#include <vtkColorTransferFunction.h>
+
namespace bbcreaVtk
{
BBTK_PROCESS(Process);
void Process();
- bool firsttime;
- vtkLookupTable *_colorLookupTable;
+ bool firsttime;
+ vtkLookupTable *_colorLookupTable;
+ vtkColorTransferFunction *_volumeColor;
//=====
BBTK_AUTHOR("Info-Dev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(ScalarsToColors,Type,"Type of color table",int,"");
- BBTK_INPUT(ScalarsToColors,ScalarValue,"Scalar value",double,"");
+ BBTK_INPUT(ScalarsToColors,Type,"0 (default) Type of color table",int,"");
+ BBTK_INPUT(ScalarsToColors,ScalarValue,"Scalar value -> Color OUT",double,"");
BBTK_INPUT(ScalarsToColors,Range,"Min Max range",std::vector<double>,"");
BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector<double>,"");
BBTK_OUTPUT(ScalarsToColors,LookupTable,"LookupTable",vtkScalarsToColors*,"");
_typeForm = 0;
_LutEED = vtkLookupTableDirectionVector::New();
-// _LutEED->SetVectorMode(0);
-//_LutEED->SetVectorModeToMagnitude();
-//_LutEED->SetVectorModeToComponent();
-_LutEED->SetVectorModeToRGBColors();
+ //_LutEED->SetVectorMode(0);
+ //_LutEED->SetVectorModeToMagnitude();
+ //_LutEED->SetVectorModeToComponent();
+ _LutEED->SetVectorModeToRGBColors();
_pdm = vtkPolyDataMapper::New();
_actor = vtkActor::New();
:vtkVectorsTensorsVisuBase()
{
_vtkarrowsource = vtkArrowSource::New();
+<<<<<<< HEAD
_vtklinesource = vtkLineSource::New();
+=======
+>>>>>>> master
_vtkglyph = vtkGlyph3D::New();
+ _vtklinesource = vtkLineSource::New();
+
+ double point1[3];
+ double point2[3];
+ point1[0]=1;
+ point1[1]=0;
+ point1[2]=0;
+ point2[0]=-1;
+ point2[1]=0;
+ point2[2]=0;
+ _vtklinesource->SetPoint1( point1 );
+ _vtklinesource->SetPoint2( point2 );
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vtkVectorsVisu::Process()
{
+<<<<<<< HEAD
+=======
+>>>>>>> master
if(_active==true)
{
#if VTK_MAJOR_VERSION <= 5
_vtkglyph->SetInput( GetDataObject() );
+<<<<<<< HEAD
#else
_vtkglyph->SetInputData( GetDataObject() );
#endif
+=======
+>>>>>>> master
if(GetTypeForm()==1) // source Arrow
{
#if VTK_MAJOR_VERSION <= 5
_vtkglyph->SetSourceData( _vtklinesource->GetOutput() );
#endif
}
-
_vtkglyph->SetScaleModeToScaleByVector();
_vtkglyph->SetColorModeToColorByVector();
_vtkglyph->SetScaleFactor( GetScaleFactor() );
+<<<<<<< HEAD
_vtkglyph->Update();
_pdm->SetInputData( _vtkglyph->GetOutput());
#endif
+=======
+ _vtkglyph->Update();
+ _pdm->SetInput( _vtkglyph->GetOutput());
+>>>>>>> master
vtkPointData *data = _vtkglyph->GetOutput()->GetPointData();
//printf("EED -------------------------------------------\n");
//_vtkglyph->GetOutput()->Print(std::cout);
//printf("EED -------------------------------------------\n");
//data->Print(std::cout);
-printf("EED -------------------------------------------\n");
int i,sizeDa = data->GetNumberOfArrays();
-printf("EED vtkVectorsVisu::Process sizeDa %d \n", sizeDa );
for (i=0;i<sizeDa;i++)
{
+<<<<<<< HEAD
printf("EED vtkVectorsVisu::Process-name %d, %s \n", i, data->GetArrayName(i) );
}
//EED bbGetInputIn()->GetPointData()->AddArray( nda );
//EED2 _pdm->ScalarVisibilityOn();
+=======
+ data->GetArray(i)->Print(std::cout);
+}
+
+>>>>>>> master
_pdm->ScalarVisibilityOn();
_pdm->SetColorModeToMapScalars();
//_pdm->SetColorModeToDefault();
#include "vtkVectorsTensorsVisuBase.h"
-
#include "vtkArrowSource.h"
#include "vtkLineSource.h"
#include "vtkGlyph3D.h"
-
-
//---------------------------------------------
// Class Name: vtkVectorsVisu
// [classdescription]