// (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')
- vtkImageData *m_image = vtkImageData::New();
- m_image = bbGetInputImage();
- int grayLevel = 0;
- std::vector<double> coord = bbGetInputCoordinate();
+// vtkImageData *m_image = vtkImageData::New();
+// m_image = bbGetInputImage();
- grayLevel = m_image->GetScalarComponentAsDouble(coord[0],coord[1],coord[2],0);
+ double grayLevel = -9999;
+ std::vector<double> coord = bbGetInputCoordinate();
+ if (bbGetInputImage()!=NULL)
+ {
+ grayLevel = bbGetInputImage()->GetScalarComponentAsDouble(coord[0],coord[1],coord[2],0);
+ }
bbSetOutputGrayLevel(grayLevel);
}
--- /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 "bbcreaVtkPolyDataInfo.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PolyDataInfo)
+BBTK_BLACK_BOX_IMPLEMENTATION(PolyDataInfo,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 PolyDataInfo::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 ( bbGetInputIn()!=NULL)
+ {
+ bbSetOutputNumberOfCells( bbGetInputIn()->GetNumberOfCells() );
+ bbSetOutputNumberOfLines( bbGetInputIn()->GetNumberOfLines() );
+ bbSetOutputNumberOfPieces( bbGetInputIn()->GetNumberOfPieces() );
+ bbSetOutputNumberOfPoints( bbGetInputIn()->GetNumberOfPoints() );
+ bbSetOutputNumberOfPolys( bbGetInputIn()->GetNumberOfPolys() );
+ bbSetOutputNumberOfStrips( bbGetInputIn()->GetNumberOfStrips() );
+ bbSetOutputNumberOfVerts( bbGetInputIn()->GetNumberOfVerts() );
+ } else {
+ bbSetOutputNumberOfCells(-1);
+ bbSetOutputNumberOfLines(-1);
+ bbSetOutputNumberOfPieces(-1);
+ bbSetOutputNumberOfPoints(-1);
+ bbSetOutputNumberOfPolys(-1);
+ bbSetOutputNumberOfStrips(-1);
+ bbSetOutputNumberOfVerts(-1);
+ }// if
+
+}
+//=====
+// 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 PolyDataInfo::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(NULL);
+ bbSetOutputNumberOfCells(-9999);
+ bbSetOutputNumberOfLines(-9999);
+ bbSetOutputNumberOfPoints(-9999);
+ bbSetOutputNumberOfPieces(-9999);
+ bbSetOutputNumberOfPolys(-9999);
+ bbSetOutputNumberOfStrips(-9999);
+ bbSetOutputNumberOfVerts(-9999);
+}
+//=====
+// 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 PolyDataInfo::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 PolyDataInfo::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 __bbcreaVtkPolyDataInfo_h_INCLUDED__
+#define __bbcreaVtkPolyDataInfo_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkPolyData.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT PolyDataInfo
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(PolyDataInfo,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_OUTPUT( NumberOfCells , double );
+ BBTK_DECLARE_OUTPUT( NumberOfLines , double );
+ BBTK_DECLARE_OUTPUT( NumberOfPoints , double );
+ BBTK_DECLARE_OUTPUT( NumberOfPieces , double );
+ BBTK_DECLARE_OUTPUT( NumberOfPolys , double );
+ BBTK_DECLARE_OUTPUT( NumberOfStrips , double );
+ BBTK_DECLARE_OUTPUT( NumberOfVerts , double );
+ 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(PolyDataInfo,bbtk::AtomicBlackBox);
+ BBTK_NAME("PolyDataInfo");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(PolyDataInfo,In,"vtkPolyData", vtkPolyData* ,"");
+
+ BBTK_OUTPUT(PolyDataInfo,NumberOfCells,"Number of Cells",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfLines,"Number of Lines",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfPoints,"Number of Points",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfPieces,"Number of Pieces",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfPolys,"Number of Ploys",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfStrips,"Number of Strips",double,"");
+ BBTK_OUTPUT(PolyDataInfo,NumberOfVerts,"Number of Verts",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(PolyDataInfo);
+//=====
+// 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 // __bbcreaVtkPolyDataInfo_h_INCLUDED__
+
#include "vtkDataObject.h"
#include <vtkPointData.h>
+#include <vtkAppendPolyData.h>
+
//------------------------------------------------------------------------------
vtkVectorsVisu::vtkVectorsVisu()
:vtkVectorsTensorsVisuBase()
{
- _vtkarrowsource = vtkArrowSource::New();
- _vtkglyph = NULL;
- _vtklinesource = vtkLineSource ::New();
- _trans = vtkTransform ::New();
+ _vtkarrowsource = vtkArrowSource::New();
+ _vtkglyph = NULL;
+ _vtklineGlyphPolyData = NULL;
+ _trans = vtkTransform ::New();
+ double sizeCross = 0.05;
+
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 );
+
+ point1[0] = 1;
+ point1[1] = 0;
+ point1[2] = 0;
+ point2[0] = -1;
+ point2[1] = 0;
+ point2[2] = 0;
+ vtkLineSource *vtklinesource1 = vtkLineSource ::New();
+ vtklinesource1->SetPoint1( point1 );
+ vtklinesource1->SetPoint2( point2 );
+ vtklinesource1->Update();
+
+ point1[0] = 0;
+ point1[1] = sizeCross;
+ point1[2] = 0;
+ point2[0] = 0;
+ point2[1] = -sizeCross;
+ point2[2] = 0;
+ vtkLineSource *vtklinesource2 = vtkLineSource ::New();
+ vtklinesource2->SetPoint1( point1 );
+ vtklinesource2->SetPoint2( point2 );
+ vtklinesource2->Update();
+
+ point1[0] = 0;
+ point1[1] = 0;
+ point1[2] = sizeCross;
+ point2[0] = 0;
+ point2[1] = 0;
+ point2[2] = -sizeCross;
+ vtkLineSource *vtklinesource3 = vtkLineSource ::New();
+ vtklinesource3->SetPoint1( point1 );
+ vtklinesource3->SetPoint2( point2 );
+ vtklinesource3->Update();
+
+
+ vtkAppendPolyData *appendPolyData = vtkAppendPolyData::New();
+ appendPolyData->AddInputData( vtklinesource1->GetOutput() );
+ appendPolyData->AddInputData( vtklinesource2->GetOutput() );
+ appendPolyData->AddInputData( vtklinesource3->GetOutput() );
+ appendPolyData->Update();
+ _vtklineGlyphPolyData = appendPolyData->GetOutput();
}
//------------------------------------------------------------------------------
#endif
} else { // source Line
#if VTK_MAJOR_VERSION <= 5
- _vtkglyph->SetSource( _vtklinesource->GetOutput() );
+ _vtkglyph->SetSource( _vtklineGlyphPolyData );
#else
- _vtklinesource->Update();
- _vtkglyph->SetSourceData( _vtklinesource->GetOutput() );
+ _vtkglyph->SetSourceData( _vtklineGlyphPolyData );
#endif
}
_vtkglyph->SetScaleModeToScaleByVector();
// _pdm->SetColorModeToDefault();
// _pdm->SetColorModeToDirectScalars(); // NOT compile
// _pdm->SetScalarModeToUsePointFieldData();
- _pdm->ImmediateModeRenderingOn(); // obsolete
+// _pdm->ImmediateModeRenderingOn(); // obsolete
_pdm->SetLookupTable( _externalLut );
_pdm->SelectColorArray( "angle" );
} // if _externalLut
//---------------------------------------------
private:
vtkArrowSource *_vtkarrowsource;
- vtkLineSource *_vtklinesource;
+ vtkPolyData *_vtklineGlyphPolyData;
vtkGlyph3D *_vtkglyph;
vtkTransform *_trans;
};