this->m_UI->setupUi( this );
// Create and associate renderers
- this->m_MPR = new TMPR(
- this->m_UI->m_XPlaneVTK->GetRenderWindow( ),
- this->m_UI->m_YPlaneVTK->GetRenderWindow( ),
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( ),
- this->m_UI->m_3DVTK->GetRenderWindow( )
- );
+ this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
+
+ for( unsigned int i = 0; i < 4; ++i )
+ {
+ this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
+ this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 );
+
+ } // rof
+ this->m_UI->m_XPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 0 ] );
+ this->m_UI->m_YPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 1 ] );
+ this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 2 ] );
+ this->m_UI->m_3DVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 3 ] );
// signals <-> slots
QObject::connect(
// Delete objects
delete this->m_UI;
- delete this->m_MPR;
}
// -------------------------------------------------------------------------
dynamic_cast< TPluginImage* >( reader->GetOutput( 0 ) );
reader->DisconnectOutputs( );
if( this->m_InputImage.IsNotNull( ) )
- this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) );
+ {
+ this->m_MPRActors->SetInputData( this->m_InputImage->GetVTKImageData( ) );
+ this->m_MPRActors->PushDataInto(
+ this->m_Renderers[ 0 ],
+ this->m_Renderers[ 1 ],
+ this->m_Renderers[ 2 ],
+ this->m_Renderers[ 3 ]
+ );
+
+ /*
+ this->m_MPR.AssociatePlaneInteractor( 0, this->m_UI->m_XPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
+ this->m_MPR.AssociatePlaneInteractor( 1, this->m_UI->m_YPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
+ this->m_MPR.AssociatePlaneInteractor( 2, this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
+ */
+
+ } // fi
+ this->m_Renderers[ 0 ]->ResetCamera( );
+ this->m_Renderers[ 1 ]->ResetCamera( );
+ this->m_Renderers[ 2 ]->ResetCamera( );
+ this->m_Renderers[ 3 ]->ResetCamera( );
+
+ this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
+ this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
+ this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
+ this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
}
else
QMessageBox::critical(
void ImageMPR::
_triggered_actionImageToImage( )
{
+ /* TODO
if( this->m_InputImage.IsNull( ) )
return;
tr( "Error executing filter" ),
tr( err.c_str( ) )
);
+ */
}
// -------------------------------------------------------------------------
#include <QMainWindow>
// vtk stuff
+#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
+#include <cpExtensions/Visualization/MPRActors.h>
// Plugins interface
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
#include <cpPlugins/Interface/Image.h>
#include <cpPlugins/Interface/Mesh.h>
-#include <cpExtensions/Visualization/MPRWithDifferentWindows.h>
// -------------------------------------------------------------------------
namespace Ui
typedef cpPlugins::Interface::Parameters TParameters;
typedef std::set< std::string > TStringContainer;
- typedef cpExtensions::Visualization::MPRWithDifferentWindows TMPR;
+ typedef cpExtensions::Visualization::MPRActors TMPRActors;
public:
explicit ImageMPR( QWidget* parent = 0 );
TPluginMesh::Pointer m_InputMesh;
// Visualization stuff
- TMPR* m_MPR;
+ vtkSmartPointer< TMPRActors > m_MPRActors;
+ vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
vtkSmartPointer< vtkPolyDataMapper > m_InputMeshMapper;
vtkSmartPointer< vtkActor > m_InputMeshActor;
## example_ReadImageSeriesWriteImage
## example_ReadQuadEdgeMesh
## example_RenderQuadEdgeMesh
- ## example_MPR
+ example_MPR
)
FOREACH(prog ${EXAMPLES_PROGRAMS})
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Extensions/Visualization/MPRActors.h>
+#include <cpExtensions/Visualization/MPRObjects.h>
-#include <vtkActor.h>
-#include <vtkCallbackCommand.h>
-#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
-#include <vtkSmartPointer.h>
int main( int argc, char* argv[] )
{
- if( argc < 4 )
+ if( argc < 3 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " plugins_file"
- << " input_image"
- << " pixel_type" << std::endl;
+ << " plugins_file input_image(s)"
+ << std::endl;
return( 1 );
} // fi
std::string plugins_file = argv[ 1 ];
- std::string input_image_file = argv[ 2 ];
- std::string pixel_type = argv[ 3 ];
// Create interface
typedef cpPlugins::Interface::Interface TInterface;
typedef cpPlugins::Interface::ProcessObject TProcessObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader;
-
- reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" );
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
if( reader.IsNull( ) )
{
std::cerr << "No suitable reader found in plugins." << std::endl;
// Configure reader
TParameters reader_params = reader->GetDefaultParameters( );
- reader_params.AddValueToStringList( "FileNames", input_image_file );
- reader_params.SetValueAsString( "PixelType", pixel_type );
- reader_params.SetValueAsUint( "ImageDimension", 3 );
- reader_params.SetValueAsUint( "IsColorImage", 0 );
+ for( int i = 2; i < argc; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
reader->SetParameters( reader_params );
// Execute reader
std::string msg = reader->Update( );
-
if( msg != "" )
+ {
std::cerr << "ERROR: " << msg << std::endl;
+ return( 1 );
+
+ } // fi
+ cpPlugins::Interface::Image* image =
+ dynamic_cast< cpPlugins::Interface::Image* >( reader->GetOutput( 0 ) );
+ vtkImageData* vtk_image = image->GetVTKImageData( );
+ if( vtk_image == NULL )
+ {
+ std::cerr
+ << "ERROR: read image does not have a valid VTK conversion."
+ << std::endl;
+ return( 1 );
+
+ } // fi
// Visualization stuff
- vtkSmartPointer< vtkRenderWindow > window =
+ vtkSmartPointer< vtkRenderWindow > window =
vtkSmartPointer< vtkRenderWindow >::New( );
+ window->SetSize( 700, 700 );
- vtkSmartPointer< vtkRenderWindowInteractor > interactor =
+ // Renderers
+ vtkSmartPointer< vtkRenderer > renderer =
+ vtkSmartPointer< vtkRenderer >::New( );
+ window->AddRenderer( renderer );
+
+ // Interactor
+ vtkSmartPointer< vtkRenderWindowInteractor > interactor =
vtkSmartPointer< vtkRenderWindowInteractor >::New( );
-
interactor->SetRenderWindow( window );
- // Renderers
- vtkSmartPointer< vtkRenderer > xrenderer =
- vtkSmartPointer< vtkRenderer >::New( );
- vtkSmartPointer< vtkRenderer > yrenderer =
- vtkSmartPointer< vtkRenderer >::New( );
- vtkSmartPointer< vtkRenderer > zrenderer =
- vtkSmartPointer< vtkRenderer >::New( );
- vtkSmartPointer< vtkRenderer > wrenderer =
- vtkSmartPointer< vtkRenderer >::New( );
-
- xrenderer->SetBackground( 0.7, 0.5, 0.5 );
- yrenderer->SetBackground( 0.5, 0.7, 0.5 );
- zrenderer->SetBackground( 0.5, 0.5, 0.7 );
- wrenderer->SetBackground( 0.5, 0.5, 0.5 );
-
- xrenderer->SetViewport( 0, 0, 0.5, 0.5 );
- yrenderer->SetViewport( 0, 0.5, 0.5, 1 );
- zrenderer->SetViewport( 0.5, 0, 1, 0.5 );
- wrenderer->SetViewport( 0.5, 0.5, 1, 1 );
-
- window->AddRenderer( xrenderer );
- window->AddRenderer( yrenderer );
- window->AddRenderer( zrenderer );
- window->AddRenderer( wrenderer );
-
- // Create actors
- typedef cpPlugins::Extensions::Visualization::MPRActors TMPRActors;
- vtkSmartPointer< TMPRActors > mprActors =
- vtkSmartPointer< TMPRActors >::New( );
- mprActors->SetInputData(
- dynamic_cast< cpPlugins::Interface::Image* >( reader->GetOutput( 0 ) )->
- GetVTKImageData( )
- );
- mprActors->PushDataInto( xrenderer, yrenderer, zrenderer, wrenderer );
+ // Actors
+ cpExtensions::Visualization::MPRObjects mpr;
+ mpr.SetImage( vtk_image );
+ /*
+ mpr.AssociatePlaneInteractor( 0, interactor );
+ mpr.AssociatePlaneInteractor( 1, interactor );
+ mpr.AssociatePlaneInteractor( 2, interactor );
+ */
// Begin interaction
- xrenderer->ResetCamera( );
- yrenderer->ResetCamera( );
- zrenderer->ResetCamera( );
- wrenderer->ResetCamera( );
+ renderer->ResetCamera( );
window->Render( );
interactor->Start( );
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Image.h>
+
int main( int argc, char* argv[] )
{
if( argc < 4 )
return( 1 );
} // fi
+
+ dynamic_cast< cpPlugins::Interface::Image* >( reader->GetOutput( 0 ) )->GetVTKImageData( )->Print( std::cout );
+
return( 0 );
}
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#include <cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h>
+#include <itkImage.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkImageRegionConstIteratorWithIndex.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkPoints.h>
+#include <vtkPointData.h>
+#include <vtkSmartPointer.h>
+#include <vtkDoubleArray.h>
+
+// -------------------------------------------------------------------------
+template< class I >
+typename cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+Self* cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+New( )
+{
+ return( new Self );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+void cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+SetInputData( const I* image )
+{
+ this->m_ITKImage = image;
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+SecondRankDiffusionTensorToPolyData( )
+ : vtkPolyDataAlgorithm( )
+{
+ this->SetNumberOfInputPorts( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+~SecondRankDiffusionTensorToPolyData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+int cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
+RequestData(
+ vtkInformation* request,
+ vtkInformationVector** inputVector,
+ vtkInformationVector* outputVector
+ )
+{
+ if( this->m_ITKImage.IsNull( ) )
+ return( 0 );
+
+ // get the info objects
+ vtkInformation* outInfo = outputVector->GetInformationObject( 0 );
+ vtkPolyData* polyData = vtkPolyData::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT())
+ );
+
+ itk::ImageRegionConstIteratorWithIndex< I > tensorIt( this->m_ITKImage, this->m_ITKImage->GetRequestedRegion() );
+
+ vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+ vtkSmartPointer<vtkDoubleArray> vtkTensors = vtkSmartPointer<vtkDoubleArray>::New();
+ vtkTensors->SetNumberOfComponents(9);
+ for ( tensorIt.GoToBegin(); !tensorIt.IsAtEnd(); ++tensorIt )
+ {
+ typename I::IndexType tensorIndex = tensorIt.GetIndex();
+ typename I::PixelType tensor = tensorIt.Get();
+ typename I::PointType ptensor;
+
+ // TODO: std::cout << "\n Index [" << tensorIndex[0] << ", " << tensorIndex[1] << ", " << tensorIndex[2] << "]" << std::endl;
+ this->m_ITKImage->TransformIndexToPhysicalPoint( tensorIndex, ptensor );
+ vtkIdType vtkPointID = points->InsertNextPoint(ptensor[0], ptensor[1], ptensor[2]);
+
+ /**
+ * Definition included in cdifTypes.
+ * typedef itk::SymmetricSecondRankTensor< double > Diffusion2ndRankTensor;
+ */
+ //Diffusion2ndRankTensor Diffusion2ndRankTensor;
+
+
+ /**
+ * SYMMETRIC SECOND RANK TENSOR
+ *
+ * The upper-right triangle of the matrix:
+ *
+ * | 0 1 2 |
+ * | X 3 4 |
+ * | X X 5 |
+ *
+ * | xx xy xz |
+ * | X yy yz |
+ * | X X zz |
+ */
+ /*
+ Diffusion2ndRankTensor = tensor[0];
+ Diffusion2ndRankTensor = tensor[1];
+ Diffusion2ndRankTensor = tensor[2];
+ Diffusion2ndRankTensor = tensor[3];
+ Diffusion2ndRankTensor = tensor[4];
+ Diffusion2ndRankTensor = tensor[5];
+ */
+ typename I::PixelType::EigenValuesArrayType evalues;
+ typename I::PixelType::EigenVectorsMatrixType evectors;
+
+ /**
+ * Return an array containing EigenValues,
+ * and a matrix containing Eigenvectors.
+ */
+ tensor.ComputeEigenAnalysis(evalues, evectors);
+
+ /*
+ std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen values: " << evalues[0] << ", " << evalues[1] << ", " << evalues[2] << std::endl;
+
+ std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen vectors: "
+
+ << "(" << evectors(0,0) << ", " << evectors(0,1) << ", " << evectors(0,2) << "), "
+ << "(" << evectors(1,0) << ", " << evectors(1,1) << ", " << evectors(1,2) << "), "
+ << "(" << evectors(2,0) << ", " << evectors(2,1) << ", " << evectors(2,2) << ")" << std::endl;
+ */
+ evectors.GetVnlMatrix().scale_row(0, evalues[0]);
+ evectors.GetVnlMatrix().scale_row(1, evalues[1]);
+ evectors.GetVnlMatrix().scale_row(2, evalues[2]);
+
+ /*
+ std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen values x Eigen vectors : "
+
+ << "(" << evectors(0,0) << ", " << evectors(0,1) << ", " << evectors(0,2) << "), "
+ << "(" << evectors(1,0) << ", " << evectors(1,1) << ", " << evectors(1,2) << "), "
+ << "(" << evectors(2,0) << ", " << evectors(2,1) << ", " << evectors(2,2) << ")" << std::endl;
+ */
+ vtkTensors->InsertTuple9(
+ vtkPointID,
+ evectors(0,0), evectors(0,1), evectors(0,2),
+ evectors(1,0), evectors(1,1), evectors(1,2),
+ evectors(2,0), evectors(2,1), evectors(2,2)
+ );
+ } // rof
+
+ polyData->SetPoints( points );
+ vtkSmartPointer<vtkPointData> pointData = polyData->GetPointData();
+ pointData->SetTensors( vtkTensors );
+ return( 1 );
+
+ /**
+ * VISUALISATION CODE BELOW
+ */
+
+// vtkSmartPointer<vtkCubeSource> cubeSource = vtkSmartPointer<vtkCubeSource>::New();
+// cubeSource->Update();
+//
+// vtkSmartPointer<vtkTensorGlyph> tensorGlyph = vtkSmartPointer<vtkTensorGlyph>::New();
+//#if VTK_MAJOR_VERSION <= 5
+// tensorGlyph->SetInput(polyData);
+//#else
+// tensorGlyph->SetInputData(polyData);
+//#endif
+// tensorGlyph->SetSourceConnection(cubeSource->GetOutputPort());
+// tensorGlyph->ColorGlyphsOff();
+// tensorGlyph->ThreeGlyphsOff();
+// tensorGlyph->ExtractEigenvaluesOff();
+// tensorGlyph->Update();
+// .
+// .
+// .
+
+}
+
+// -------------------------------------------------------------------------
+template class cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< itk::Image< itk::SymmetricSecondRankTensor< float, 3 >, 3 > >;
+template class cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< itk::Image< itk::SymmetricSecondRankTensor< double, 3 >, 3 > >;
+
+// eof - $RCSfile$
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+#define __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+
+#include <cpExtensions/cpExtensions_Export.h>
+
+#include <vtkPolyDataAlgorithm.h>
+
+namespace cpExtensions
+{
+ namespace Algorithms
+ {
+ /**
+ */
+ template< class I >
+ class cpExtensions_EXPORT SecondRankDiffusionTensorToPolyData
+ : public vtkPolyDataAlgorithm
+ {
+ public:
+ typedef SecondRankDiffusionTensorToPolyData Self;
+
+ public:
+ static Self* New( );
+ vtkTypeMacro( SecondRankDiffusionTensorToPolyData, vtkPolyDataAlgorithm );
+
+ void SetInputData( const I* image );
+
+ protected:
+ SecondRankDiffusionTensorToPolyData( );
+ virtual ~SecondRankDiffusionTensorToPolyData( );
+
+ virtual int RequestData(
+ vtkInformation* , vtkInformationVector**, vtkInformationVector*
+ );
+
+ private:
+ SecondRankDiffusionTensorToPolyData( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ typename I::ConstPointer m_ITKImage;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+
+// eof - $RCSfile$
} // rof
if( w != NULL )
- {
w->AddActor( this->ImageOutlineActor );
-
- } // fi
}
// -------------------------------------------------------------------------
cpPlugins_Image_Export( itk::DiffusionTensor3D< float >, 3 );
cpPlugins_Image_Export( itk::DiffusionTensor3D< double >, 3 );
+cpPlugins_Image_Export( itk::DiffusionTensor3D< float >, 4 );
+cpPlugins_Image_Export( itk::DiffusionTensor3D< double >, 4 );
cpPlugins_Image_Export( itk::Offset< 2 >, 2 );
cpPlugins_Image_Export( itk::Offset< 3 >, 3 );
cpPlugins_Image_Export( itk::Offset< 4 >, 4 );
)
TARGET_LINK_LIBRARIES(
${LIBRARY_NAME}
+ cpExtensions
cpPlugins_Interface
)
#include <cpPlugins/Plugins/MarchingCubes.h>
#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
+#include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
/// TODO: doc
PLUMA_CONNECTOR
host.add( new MarchingCubesProvider( ) );
host.add( new OtsuThresholdImageFilterProvider( ) );
host.add( new RGBImageToOtherChannelsFilterProvider( ) );
+ host.add( new SecondRankDiffusionTensorToPolyDataProvider( ) );
return( true );
}
break;
} // hctiws
}
+ else if( D == 4 )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::DiffusionTensor3D< float >, 4 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::DiffusionTensor3D< double >, 4 >( names );
+ break;
+ default:
+ r = "ImageReader: Diffusion tensor type not supported.";
+ break;
+ } // hctiws
+ }
else
r = "ImageReader: Diffusion tensor dimension not supported.";
}
--- /dev/null
+#include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
+#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/Mesh.h>
+
+#include <cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h>
+#include <itkSymmetricSecondRankTensor.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
+SecondRankDiffusionTensorToPolyData( )
+ : Superclass( ),
+ m_Algorithm( NULL )
+{
+ this->m_ClassName = "cpPlugins::SecondRankDiffusionTensorToPolyData";
+ this->m_ClassCategory = "ImageToMeshFilter";
+
+ this->SetNumberOfInputs( 1 );
+ this->SetNumberOfOutputs( 1 );
+ this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
+
+ using namespace cpPlugins::Interface;
+ this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
+~SecondRankDiffusionTensorToPolyData( )
+{
+ if( this->m_Algorithm != NULL )
+ this->m_Algorithm->Delete( );
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
+_GenerateData( )
+{
+ // Get input
+ cpPlugins::Interface::Image* image =
+ this->_Input< cpPlugins::Interface::Image >( 0 );
+ if( image == NULL )
+ return( "SecondRankDiffusionTensorToPolyData: Input data is not a valid image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_ImageArray_Input_Demangle( itk::SymmetricSecondRankTensor, float, 3, 3, image, itk_image, r, _RealGD );
+ else cpPlugins_ImageArray_Input_Demangle( itk::SymmetricSecondRankTensor, double, 3, 3, image, itk_image, r, _RealGD );
+ else
+ r = "SecondRankDiffusionTensorToPolyData: Input does not have a DiffusionTensor3D.";
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
+_RealGD( itk::DataObject* image )
+{
+ typedef cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I > _F;
+
+ // Configure filter
+ _F* f = NULL;
+ if( this->m_Algorithm == NULL )
+ {
+ f = _F::New( );
+ this->m_Algorithm = f;
+
+ } // fi
+ f->SetInputData( dynamic_cast< I* >( image ) );
+ this->m_Algorithm->Update( );
+
+ // Connect output
+ cpPlugins::Interface::Mesh* out =
+ this->_Output< cpPlugins::Interface::Mesh >( 0 );
+ if( out != NULL )
+ {
+ out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return( "OtsuThresholdImageFilter: output not correctly created." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+#define __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+
+#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+class vtkPolyDataAlgorithm;
+
+namespace cpPlugins
+{
+ namespace Plugins
+ {
+ /**
+ */
+ class cpPlugins_EXPORT SecondRankDiffusionTensorToPolyData
+ : public cpPlugins::Interface::ImageToMeshFilter
+ {
+ public:
+ typedef SecondRankDiffusionTensorToPolyData Self;
+ typedef cpPlugins::Interface::ImageToMeshFilter Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( SecondRankDiffusionTensorToPolyData, cpPluginsInterfaceImageToMeshFilter );
+
+ protected:
+ SecondRankDiffusionTensorToPolyData( );
+ virtual ~SecondRankDiffusionTensorToPolyData( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ inline std::string _RealGD( itk::DataObject* image );
+
+ private:
+ // Purposely not implemented
+ SecondRankDiffusionTensorToPolyData( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ vtkPolyDataAlgorithm* m_Algorithm;
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( SecondRankDiffusionTensorToPolyData );
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
+
+// eof - $RCSfile$