# Prepare header to build shared libs (windows)
INCLUDE(GenerateExportHeader)
+# Find boost
+FIND_PACKAGE(Boost 1.30 COMPONENTS filesystem system REQUIRED)
+IF(Boost_FOUND)
+ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+ENDIF(Boost_FOUND)
+
# Find ITK and VTK
FIND_PACKAGE(ITK REQUIRED)
FIND_PACKAGE(VTK REQUIRED)
+SUBDIRS(
+ bash
+ )
+
IF(BUILD_EXAMPLES)
SUBDIRS(
examples
#include "ImageMPR.h"
#include "ui_ImageMPR.h"
-#include <cpPlugins/Interface/ParametersQtDialog.h>
-
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
// Start: load all disponible plugins
this->_LoadPlugins(
std::string( PLUGIN_PREFIX ) +
- std::string( "cpPlugins." ) +
+ std::string( "cpPluginsIO." ) +
std::string( PLUGIN_EXT )
);
}
this->m_ImageWriterClass = "";
this->m_MeshReaderClass = "";
this->m_MeshWriterClass = "";
- this->m_ImageToImageFilters.clear( );
- this->m_ImageToMeshFilters.clear( );
+ this->m_UI->MenuImageToImage->clear( );
+ this->m_UI->MenuImageToMesh->clear( );
- this->m_Plugins.UnloadAll( );
if( !( this->m_Plugins.Load( filename ) ) )
- {
- this->m_Plugins.UnloadAll( );
return( false );
- } // fi
-
typedef TPluginsInterface::TClasses _TClasses;
_TClasses::const_iterator cIt = this->m_Plugins.GetClasses( ).begin( );
for( ; cIt != this->m_Plugins.GetClasses( ).end( ); ++cIt )
this->m_MeshWriterClass = name;
else if( category == "ImageToImageFilter" )
{
- this->m_ImageToImageFilters.insert( name );
QAction* action =
this->m_UI->MenuImageToImage->addAction( QString( name.c_str( ) ) );
QObject::connect(
}
else if( category == "ImageToMeshFilter" )
{
- this->m_ImageToMeshFilters.insert( name );
QAction* action =
this->m_UI->MenuImageToMesh->addAction( QString( name.c_str( ) ) );
QObject::connect(
return( true );
}
+// -------------------------------------------------------------------------
+std::string ImageMPR::
+_LoadImage( TPluginImage::Pointer& image, const QStringList& names )
+{
+ // Block application
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
+
+ std::string ret = "";
+ image = NULL;
+
+ // Get a reader from loaded plugins
+ TPluginFilter::Pointer reader =
+ this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
+ if( reader.IsNotNull( ) )
+ {
+ // Configure reader
+ TParameters params = reader->GetDefaultParameters( );
+ QStringList::const_iterator qIt = names.begin( );
+ for( ; qIt != names.end( ); ++qIt )
+ params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
+ params.SetValueAsBool( "VectorType", false );
+ reader->SetParameters( params );
+
+ // Execute and get error message, if any
+ ret = reader->Update( );
+
+ // Assign fresh image, if any
+ if( ret == "" )
+ {
+ image = reader->GetOutput< TPluginImage >( 0 );
+ reader->DisconnectOutputs( );
+
+ } // fi
+ }
+ else
+ ret = "No suitable reader object found in loaded plugins.";
+
+ // Finish reading
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
+ return( ret );
+}
+
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionOpenPlugins( )
if( !( dialog.exec( ) ) )
return;
- this->m_InputImage = NULL;
-
- // Get a reader from plugins
- TPluginFilter::Pointer reader =
- this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
-
- // Configure reader
- TParameters reader_params = reader->GetDefaultParameters( );
- QStringList q_fnames = dialog.selectedFiles( );
- QStringList::const_iterator qIt = q_fnames.begin( );
- for( ; qIt != q_fnames.end( ); ++qIt )
- reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
- reader->SetParameters( reader_params );
-
- // Execute and get error message, if any
- QApplication::setOverrideCursor( Qt::WaitCursor );
- this->setEnabled( false );
- std::string err = reader->Update( );
- QApplication::restoreOverrideCursor( );
- this->setEnabled( true );
-
- // Assign fresh image, if any
+ // Read image
+ std::string err =
+ this->_LoadImage( this->m_InputImage, dialog.selectedFiles( ) );
if( err == "" )
{
- this->m_InputImage = reader->GetOutput< TPluginImage >( 0 );
- reader->DisconnectOutputs( );
- if( this->m_InputImage.IsNotNull( ) )
+ vtkImageData* vtk_id = this->m_InputImage->GetVTKImageData( );
+ if( vtk_id != NULL )
{
- vtkImageData* vtk_id = this->m_InputImage->GetVTKImageData( );
- if( vtk_id != NULL )
- {
- this->m_MPRObjects->SetImage( vtk_id );
- this->m_MPRObjects->ActivateInteractors( );
- this->m_MPRObjects->ResetCameras( );
- this->m_MPRObjects->RenderAll( );
- }
- else
- QMessageBox::critical(
- this,
- tr( "Error message" ),
- tr( "Read image does not have a valid VTK converter." )
- );
-
- } // fi
+ this->m_MPRObjects->SetImage( vtk_id );
+ this->m_MPRObjects->ActivateInteractors( );
+ this->m_MPRObjects->ResetCameras( );
+ this->m_MPRObjects->RenderAll( );
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Read image does not have a valid VTK converter." )
+ );
}
else
QMessageBox::critical(
void ImageMPR::
_triggered_actionOpenSegmentation( )
{
+ if( this->m_InputImage.IsNull( ) )
+ {
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Before reading a segmentation, first load a raw image." )
+ );
+ return;
+
+ } // fi
+
// Show dialog and check if it was accepted
QFileDialog dialog( this );
dialog.setFileMode( QFileDialog::ExistingFiles );
if( !( dialog.exec( ) ) )
return;
- this->m_InputImage = NULL;
-
- // Get a reader from plugins
- TPluginFilter::Pointer reader =
- this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
-
- // Configure reader
- TParameters reader_params = reader->GetDefaultParameters( );
- QStringList q_fnames = dialog.selectedFiles( );
- QStringList::const_iterator qIt = q_fnames.begin( );
- for( ; qIt != q_fnames.end( ); ++qIt )
- reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
- reader->SetParameters( reader_params );
-
- // Execute and get error message, if any
- QApplication::setOverrideCursor( Qt::WaitCursor );
- this->setEnabled( false );
- std::string err = reader->Update( );
- QApplication::restoreOverrideCursor( );
- this->setEnabled( true );
-
- // Assign fresh image, if any
+ // Read image
+ std::string err =
+ this->_LoadImage( this->m_InputSegmentation, dialog.selectedFiles( ) );
if( err == "" )
{
- this->m_InputSegmentation = reader->GetOutput< TPluginImage >( 0 );
- reader->DisconnectOutputs( );
- if( this->m_InputSegmentation.IsNotNull( ) )
+ vtkImageData* vtk_id = this->m_InputSegmentation->GetVTKImageData( );
+ if( vtk_id != NULL )
{
- vtkImageData* vtk_id = this->m_InputSegmentation->GetVTKImageData( );
- if( vtk_id != NULL )
- {
- /*
- this->m_MPRObjects->SetImage( vtk_id );
- this->m_MPRObjects->ResetCameras( );
- this->m_MPRObjects->RenderAll( );
- */
- }
- else
- QMessageBox::critical(
- this,
- tr( "Error message" ),
- tr( "Read image does not have a valid VTK converter." )
- );
-
- } // fi
+ this->m_MPRObjects->AddAuxiliaryImage( vtk_id );
+ this->m_MPRObjects->RenderAll( );
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Read image does not have a valid VTK converter." )
+ );
}
else
QMessageBox::critical(
void ImageMPR::
_triggered_actionOpenInputPolyData( )
{
+ /*
// Show dialog and check if it was accepted
QFileDialog dialog( this );
dialog.setFileMode( QFileDialog::ExistingFile );
tr( "Error reading mesh" ),
tr( err.c_str( ) )
);
+ */
}
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionImageToImage( )
{
+ /*
if( this->m_InputImage.IsNull( ) )
return;
tr( "Error executing filter" ),
tr( err.c_str( ) )
);
+ */
}
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionImageToMesh( )
{
+ /*
if( this->m_InputImage.IsNull( ) )
return;
tr( "Error executing filter" ),
tr( err.c_str( ) )
);
+ */
}
// eof - $RCSfile$
#ifndef __IMAGEMPR__H__
#define __IMAGEMPR__H__
-// Standard stuff
-#include <map>
-#include <set>
+#include <vector>
// Qt stuff
#include <QMainWindow>
typedef cpPlugins::Interface::ProcessObject TPluginFilter;
typedef cpPlugins::Interface::Parameters TParameters;
- typedef std::set< std::string > TStringContainer;
typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
public:
protected:
bool _LoadPlugins( const std::string& filename );
+ std::string _LoadImage(
+ TPluginImage::Pointer& image, const QStringList& names
+ );
private slots:
void _triggered_actionOpenPlugins( );
std::string m_ImageWriterClass;
std::string m_MeshReaderClass;
std::string m_MeshWriterClass;
- TStringContainer m_ImageToImageFilters;
- TStringContainer m_ImageToMeshFilters;
// Real data
TPluginImage::Pointer m_InputImage;
--- /dev/null
+## =========================
+## = Command line programs =
+## =========================
+
+SET(
+ BASH_PROGRAMS
+ cpPlugins_createHost
+ )
+
+FOREACH(prog ${BASH_PROGRAMS})
+ ADD_EXECUTABLE(${prog} ${prog}.cxx)
+ TARGET_LINK_LIBRARIES(${prog} ${Boost_LIBRARIES})
+ENDFOREACH(prog)
+
+## eof - $RCSfile$
--- /dev/null
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include <boost/filesystem/path.hpp>
+
+int main( int argc, char* argv[] )
+{
+ // Open file
+ if( argc < 4 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " output_code namespace filter1 filter2 ..."
+ << std::endl;
+ return( 1 );
+
+ } // fi
+ std::ofstream output_code( argv[ 1 ] );
+ if( !output_code )
+ {
+ std::cerr
+ << "Could not open file \"" << argv[ 1 ] << "\" for writing"
+ << std::endl;
+ return( 1 );
+
+ } // fi
+
+ output_code << "#include <Pluma/Connector.hpp>" << std::endl;
+ for( int i = 3; i < argc; ++i )
+ output_code << "#include \"" << argv[ i ] << "\"" << std::endl;
+ output_code
+ << std::endl
+ << "PLUMA_CONNECTOR" << std::endl
+ << "bool connect( pluma::Host& host )" << std::endl
+ << "{" << std::endl
+ << " using namespace " << argv[ 2 ] << ";" << std::endl;
+
+ for( int i = 3; i < argc; ++i )
+ {
+ boost::filesystem::path p( argv[ i ] );
+ output_code
+ << " host.add( new "
+ << p.stem( ).generic_string( )
+ << "Provider( ) );"
+ << std::endl;
+
+ } // rof
+
+ output_code
+ << " return( true );" << std::endl
+ << "}" << std::endl;
+
+ // Finish
+ output_code.close( );
+ return( 0 );
+}
+
+// eof - $RCSfile$
example_TestParameters
example_LoadPlugins
example_ReadWriteImage
- example_MarchingCubes
- example_OtsuFilter
- example_RGBImageToHSVChannels
- example_RGBImageToYPbPrChannels
+ ##example_MarchingCubes
+ ##example_OtsuFilter
+ ##example_RGBImageToHSVChannels
+ ##example_RGBImageToYPbPrChannels
## example_ReadImageSeriesWriteImage
## example_ReadQuadEdgeMesh
## example_RenderQuadEdgeMesh
- example_MPR
+ ##example_MPR
)
{
if( argc < 2 )
{
- std::cerr << "Usage: " << argv[ 0 ] << " plugins_file" << std::endl;
+ std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl;
return( 1 );
} // fi
- std::string plugins_file = argv[ 1 ];
// Create interface
typedef cpPlugins::Interface::Interface TInterface;
typedef TInterface::TClasses TClasses;
TInterface plugins;
- if( !plugins.Load( plugins_file ) )
- {
- std::cerr << "Error loading plugins file." << std::endl;
- return( 1 );
+ for( int i = 1; i < argc; ++i )
+ if( !plugins.Load( argv[ i ] ) )
+ std::cerr
+ << "Error loading plugins file \""
+ << argv[ i ] << "\""
+ << std::endl;
- } // fi
-
std::cout << "---------------------------------------------" << std::endl;
std::cout << "Loaded classes:" << std::endl;
TClasses::const_iterator cIt = plugins.GetClasses( ).begin( );
for( ; cIt != plugins.GetClasses( ).end( ); ++cIt )
std::cout << " := " << cIt->first << std::endl;
std::cout << "---------------------------------------------" << std::endl;
+
return( 0 );
}
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
-
#include <cpPlugins/Interface/Image.h>
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface TInterface;
+typedef cpPlugins::Interface::ProcessObject TProcessObject;
+typedef cpPlugins::Interface::DataObject TDataObject;
+typedef cpPlugins::Interface::Parameters TParameters;
+typedef TInterface::TClasses TClasses;
+
+// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
if( argc < 4 )
} // fi
// Create interface
- typedef cpPlugins::Interface::Interface TInterface;
- typedef TInterface::TClasses TClasses;
TInterface plugins;
if( !plugins.Load( argv[ 1 ] ) )
{
} // fi
// Create objects
- typedef cpPlugins::Interface::ProcessObject TProcessObject;
- typedef cpPlugins::Interface::DataObject TDataObject;
- typedef cpPlugins::Interface::Parameters TParameters;
- cpPlugins::Interface::ProcessObject::Pointer reader, writer;
- reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
- if( reader.IsNull( ) )
+ TProcessObject::Pointer reader, writer;
+ reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::IO::ImageWriter" );
+ if( reader.IsNull( ) || writer.IsNull( ) )
{
- std::cerr << "No suitable reader found in plugins." << std::endl;
- return( 1 );
-
- } // fi
- writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
- if( writer.IsNull( ) )
- {
- std::cerr << "No suitable writer found in plugins." << std::endl;
+ std::cerr
+ << "No suitable reader found in plugins." << std::endl
+ << "Reader: " << reader.GetPointer( ) << std::endl
+ << "Writer: " << writer.GetPointer( ) << std::endl
+ << std::endl;
return( 1 );
} // fi
this->RenderAll( );
}
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+AddAuxiliaryImage( vtkImageData* image )
+{
+ this->m_MPRActors->AddInputData( image );
+
+#error Definir LUT de la nueva imagen
+
+ this->m_MPRActors->PushDataInto(
+ this->m_Renderers[ 0 ],
+ this->m_Renderers[ 1 ],
+ this->m_Renderers[ 2 ],
+ this->m_Renderers[ 3 ]
+ );
+
+ // Rendering
+ this->RenderAll( );
+}
+
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRObjects::
ActivateInteractors( )
vtkRenderWindow* wz, vtkRenderWindow* w3D
);
void SetImage( vtkImageData* image );
+ void AddAuxiliaryImage( vtkImageData* image );
void ActivateInteractors( );
void ResetCamera( const int& id );
SET(
LIB_SOURCES_CXX
+ Instances_itkImage.cxx
+ Instances_itkVectorImage.cxx
+ Instances_itkMesh.cxx
BaseProcessObjects.cxx
DataObject.cxx
Image.cxx
- Instances_itkImage.cxx
- Instances_itkMesh.cxx
Interface.cxx
Mesh.cxx
Object.cxx
#include <itkVector.h>
// -------------------------------------------------------------------------
-#define cpPlugins_Image_Export( T, D ) \
- cpPlugins_TEMPLATE_EXPORT( \
- 2(class cpPlugins_Interface_EXPORT itk::Image< T, D >) \
+#define cpPlugins_ITKImage_Export( T, D ) \
+ cpPlugins_TEMPLATE_EXPORT( \
+ 2(class cpPlugins_Interface_EXPORT itk::Image< T, D >) \
)
// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Export( T, D ) \
+#define cpPlugins_ITKArrayImage_Export( A, T, DA, DI ) \
cpPlugins_TEMPLATE_EXPORT( \
- 2( \
- class cpPlugins_Interface_EXPORT \
- itk::ImageToVTKImageFilter< itk::Image< T, D > > \
- ) \
+ 3(class cpPlugins_Interface_EXPORT itk::Image< A< T, DA >, DI >) \
)
// -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Export( A, T, DA, DI ) \
- cpPlugins_TEMPLATE_EXPORT( \
- 3( \
- class cpPlugins_Interface_EXPORT \
- itk::Image< itk::A< T, DA >, DI > \
- ) \
- )
+#define cpPlugins_ITKImage_AllDims_Export( T ) \
+ cpPlugins_ITKImage_Export( T, 2 ); \
+ cpPlugins_ITKImage_Export( T, 3 ); \
+ cpPlugins_ITKImage_Export( T, 4 )
// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Export( A, T, DA, DI ) \
- cpPlugins_TEMPLATE_EXPORT( \
- 3( \
- class cpPlugins_Interface_EXPORT \
- itk::ImageToVTKImageFilter< itk::Image< itk::A< T, DA >, DI > > \
- ) \
+#define cpPlugins_ITKArrayImage_AllDims_Export( A, T ) \
+ cpPlugins_ITKArrayImage_Export( A, T, 2, 2 ); \
+ cpPlugins_ITKArrayImage_Export( A, T, 3, 3 ); \
+ cpPlugins_ITKArrayImage_Export( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_VTKImage_Export( T, D ) \
+ cpPlugins_TEMPLATE_EXPORT( \
+ 2( \
+ class cpPlugins_Interface_EXPORT \
+ itk::ImageToVTKImageFilter< itk::Image< T, D > > \
+ ) \
)
// -------------------------------------------------------------------------
-#define cpPlugins_Image_Export_AllDimensions( T ) \
- cpPlugins_Image_Export( T, 2 ); \
- cpPlugins_Image_Export( T, 3 ); \
- cpPlugins_Image_Export( T, 4 )
+#define cpPlugins_VTKArrayImage_Export( A, T, DA, DI ) \
+ cpPlugins_TEMPLATE_EXPORT( \
+ 3(class \
+ cpPlugins_Interface_EXPORT \
+ itk::ImageToVTKImageFilter< itk::Image< A< T, DA >, DI > >) \
+ )
// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Export_AllDimensions( T ) \
- cpPlugins_VTKImage_Export( T, 2 ); \
+#define cpPlugins_VTKImage_AllDims_Export( T ) \
+ cpPlugins_VTKImage_Export( T, 2 ); \
cpPlugins_VTKImage_Export( T, 3 )
// -------------------------------------------------------------------------
-#define cpPlugins_ImageArray_Export_AllDimensions( A, T ) \
- cpPlugins_ImageArray_Export( A, T, 2, 2 ); \
- cpPlugins_ImageArray_Export( A, T, 3, 3 ); \
- cpPlugins_ImageArray_Export( A, T, 4, 4 )
+#define cpPlugins_VTKArrayImage_AllDims_Export( A, T ) \
+ cpPlugins_VTKArrayImage_Export( A, T, 2, 2 ); \
+ cpPlugins_VTKArrayImage_Export( A, T, 3, 3 )
// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Export_AllDimensions( A, T ) \
- cpPlugins_VTKImageArray_Export( A, T, 2, 2 ); \
- cpPlugins_VTKImageArray_Export( A, T, 3, 3 )
-
+#define cpPlugins_Image_Export( T, D ) \
+ cpPlugins_ITKImage_Export( T, D ); \
+ cpPlugins_VTKImage_Export( T, D ) \
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_AllDims_Export( T ) \
+ cpPlugins_ITKImage_AllDims_Export( T ); \
+ cpPlugins_VTKImage_AllDims_Export( T ) \
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_AllDims_Export( A, T ) \
+ cpPlugins_ITKArrayImage_AllDims_Export( A, T ); \
+ cpPlugins_VTKArrayImage_AllDims_Export( A, T ) \
+
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
// -------------------------------------------------------------------------
-// ITK base clases
-cpPlugins_Image_Export_AllDimensions( char );
-cpPlugins_Image_Export_AllDimensions( short );
-cpPlugins_Image_Export_AllDimensions( int );
-cpPlugins_Image_Export_AllDimensions( long );
-cpPlugins_Image_Export_AllDimensions( unsigned char );
-cpPlugins_Image_Export_AllDimensions( unsigned short );
-cpPlugins_Image_Export_AllDimensions( unsigned int );
-cpPlugins_Image_Export_AllDimensions( unsigned long );
-cpPlugins_Image_Export_AllDimensions( float );
-cpPlugins_Image_Export_AllDimensions( double );
-
-cpPlugins_Image_Export_AllDimensions( std::complex< float > );
-cpPlugins_Image_Export_AllDimensions( std::complex< double > );
-
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< unsigned long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< float > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBPixel< double > );
-
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< unsigned long > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< float > );
-cpPlugins_Image_Export_AllDimensions( itk::RGBAPixel< double > );
-
-cpPlugins_ImageArray_Export_AllDimensions( Vector, float );
-cpPlugins_ImageArray_Export_AllDimensions( Vector, double );
-
-cpPlugins_ImageArray_Export_AllDimensions( CovariantVector, float );
-cpPlugins_ImageArray_Export_AllDimensions( CovariantVector, double );
-
-cpPlugins_ImageArray_Export_AllDimensions( Point, float );
-cpPlugins_ImageArray_Export_AllDimensions( Point, double );
-
-cpPlugins_ImageArray_Export_AllDimensions(
- SymmetricSecondRankTensor, float
- );
-cpPlugins_ImageArray_Export_AllDimensions(
- SymmetricSecondRankTensor, double
- );
-
-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 );
+cpPlugins_Image_AllDims_Export( char );
+cpPlugins_Image_AllDims_Export( short );
+cpPlugins_Image_AllDims_Export( int );
+cpPlugins_Image_AllDims_Export( long );
+cpPlugins_Image_AllDims_Export( unsigned char );
+cpPlugins_Image_AllDims_Export( unsigned short );
+cpPlugins_Image_AllDims_Export( unsigned int );
+cpPlugins_Image_AllDims_Export( unsigned long );
+cpPlugins_Image_AllDims_Export( float );
+cpPlugins_Image_AllDims_Export( double );
+
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< float > );
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, double );
+
+// -------------------------------------------------------------------------
+// ITK-only base clases
// -------------------------------------------------------------------------
-// ITK<->VTK base clases
-cpPlugins_VTKImage_Export_AllDimensions( char );
-cpPlugins_VTKImage_Export_AllDimensions( short );
-cpPlugins_VTKImage_Export_AllDimensions( int );
-cpPlugins_VTKImage_Export_AllDimensions( long );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned char );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned short );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned int );
-cpPlugins_VTKImage_Export_AllDimensions( unsigned long );
-cpPlugins_VTKImage_Export_AllDimensions( float );
-cpPlugins_VTKImage_Export_AllDimensions( double );
-
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< long > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBPixel< unsigned long > );
-
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< long > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned char > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned short > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned int > );
-cpPlugins_VTKImage_Export_AllDimensions( itk::RGBAPixel< unsigned long > );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( Vector, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( Vector, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( CovariantVector, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( CovariantVector, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions( Point, float );
-cpPlugins_VTKImageArray_Export_AllDimensions( Point, double );
-
-cpPlugins_VTKImageArray_Export_AllDimensions(
- SymmetricSecondRankTensor, float
- );
-cpPlugins_VTKImageArray_Export_AllDimensions(
- SymmetricSecondRankTensor, double
- );
-
-cpPlugins_VTKImage_Export( itk::DiffusionTensor3D< float >, 3 );
-cpPlugins_VTKImage_Export( itk::DiffusionTensor3D< double >, 3 );
+
+cpPlugins_ITKImage_AllDims_Export( std::complex< float > );
+cpPlugins_ITKImage_AllDims_Export( std::complex< double > );
+
+cpPlugins_ITKImage_Export( itk::Offset< 2 >, 2 );
+cpPlugins_ITKImage_Export( itk::Offset< 3 >, 3 );
+cpPlugins_ITKImage_Export( itk::Offset< 4 >, 4 );
// eof - $RCSfile$
--- /dev/null
+#include <cpPlugins/Interface/Macros.h>
+
+#include <complex>
+
+#include <itkVectorImage.h>
+
+#include <itkCovariantVector.h>
+#include <itkDiffusionTensor3D.h>
+#include <itkPoint.h>
+#include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkVector.h>
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Export( T, D ) \
+ cpPlugins_TEMPLATE_EXPORT( \
+ 2(class cpPlugins_Interface_EXPORT itk::VectorImage< T, D >) \
+ )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_Export( A, T, DA, DI ) \
+ cpPlugins_TEMPLATE_EXPORT( \
+ 3(class \
+ cpPlugins_Interface_EXPORT \
+ itk::VectorImage< A< T, DA >, DI >) \
+ )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_AllDims_Export( T ) \
+ cpPlugins_Image_Export( T, 2 ); \
+ cpPlugins_Image_Export( T, 3 ); \
+ cpPlugins_Image_Export( T, 4 )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_ArrayImage_AllDims_Export( A, T ) \
+ cpPlugins_ArrayImage_Export( A, T, 2, 2 ); \
+ cpPlugins_ArrayImage_Export( A, T, 3, 3 ); \
+ cpPlugins_ArrayImage_Export( A, T, 4, 4 )
+
+// -------------------------------------------------------------------------
+// ITK-VTK base clases
+// -------------------------------------------------------------------------
+
+cpPlugins_Image_AllDims_Export( char );
+cpPlugins_Image_AllDims_Export( short );
+cpPlugins_Image_AllDims_Export( int );
+cpPlugins_Image_AllDims_Export( long );
+cpPlugins_Image_AllDims_Export( unsigned char );
+cpPlugins_Image_AllDims_Export( unsigned short );
+cpPlugins_Image_AllDims_Export( unsigned int );
+cpPlugins_Image_AllDims_Export( unsigned long );
+cpPlugins_Image_AllDims_Export( float );
+cpPlugins_Image_AllDims_Export( double );
+
+cpPlugins_Image_AllDims_Export( std::complex< float > );
+cpPlugins_Image_AllDims_Export( std::complex< double > );
+
+cpPlugins_Image_Export( itk::Offset< 2 >, 2 );
+cpPlugins_Image_Export( itk::Offset< 3 >, 3 );
+cpPlugins_Image_Export( itk::Offset< 4 >, 4 );
+
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned char > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned short > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned int > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< unsigned long > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< float > );
+cpPlugins_Image_AllDims_Export( itk::RGBAPixel< double > );
+
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< float > );
+cpPlugins_Image_AllDims_Export( itk::DiffusionTensor3D< double > );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Vector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::CovariantVector, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::Point, double );
+
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, float );
+cpPlugins_ArrayImage_AllDims_Export( itk::SymmetricSecondRankTensor, double );
+
+// eof - $RCSfile$
#define cpPlugins_TEMPLATE_IMPORT( X ) \
extern template cpPlugins_TEMPLATE_##X;
-/* TODO
- #define cpPlugins_EXPORT_TEMPLATE( E, c, T ) \
- cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_EXPORT, E, T )
- #define cpPlugins_IMPORT_TEMPLATE( E, c, T ) \
- cpPlugins_TEMPLATE_##c( cpPlugins_TEMPLATE_IMPORT, E, T )
-*/
-
#endif // __CPPLUGINS__INTERFACE__MACROS__H__
// eof - $RCSfile$
-#include <cpPlugins/Plugins/BinaryThresholdImageFilter.h>
+#include "BinaryThresholdImageFilter.h"
#include <cpPlugins/Interface/Image.h>
#include <itkBinaryThresholdImageFilter.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::BinaryThresholdImageFilter::
+cpPlugins::BasicFilters::BinaryThresholdImageFilter::
BinaryThresholdImageFilter( )
: Superclass( )
{
- this->m_ClassName = "cpPlugins::BinaryThresholdImageFilter";
+ this->m_ClassName = "cpPlugins::BasicFilters::BinaryThresholdImageFilter";
this->m_ClassCategory = "ImageToImageFilter";
this->SetNumberOfInputs( 1 );
this->SetNumberOfOutputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::BinaryThresholdImageFilter::
+cpPlugins::BasicFilters::BinaryThresholdImageFilter::
~BinaryThresholdImageFilter( )
{
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
_GenerateData( )
{
cpPlugins::Interface::Image* image =
// -------------------------------------------------------------------------
template< class I >
-std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
_DemangleOutput( itk::DataObject* image )
{
return(
// -------------------------------------------------------------------------
template< class I, class O >
-inline std::string cpPlugins::Plugins::BinaryThresholdImageFilter::
+inline std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
_RealGD( itk::DataObject* image )
{
typedef itk::BinaryThresholdImageFilter< I, O > _F;
#ifndef __CPPLUGINS__PLUGINS__BINARYTHRESHOLDIMAGEFILTER__H__
#define __CPPLUGINS__PLUGINS__BINARYTHRESHOLDIMAGEFILTER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace cpPlugins
{
- namespace Plugins
+ namespace BasicFilters
{
/**
*/
- class cpPlugins_EXPORT BinaryThresholdImageFilter
+ class cpPluginsBasicFilters_EXPORT BinaryThresholdImageFilter
: public cpPlugins::Interface::ImageToImageFilter
{
public:
--- /dev/null
+SET(LIBRARY_NAME cpPluginsBasicFilters)
+
+## ===============
+## = Source code =
+## ===============
+
+FILE(GLOB LIB_HEADERS_H "*.h")
+FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_SOURCES_C "*.c")
+FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+## =====================
+## = Compilation rules =
+## =====================
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${LIBRARY_NAME}_Host.cxx
+ DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+ COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::BasicFilters ${LIB_HEADERS_H}
+ )
+
+ADD_LIBRARY(
+ ${LIBRARY_NAME}
+ SHARED
+ ${LIBRARY_NAME}_Host.cxx
+ ${LIB_SOURCES_C}
+ ${LIB_SOURCES_CPP}
+ ${LIB_SOURCES_CXX}
+ )
+GENERATE_EXPORT_HEADER(
+ ${LIBRARY_NAME}
+ BASE_NAME ${LIBRARY_NAME}
+ EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+ EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/BasicFilters/${LIBRARY_NAME}_Export.h
+ STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+ )
+TARGET_LINK_LIBRARIES(
+ ${LIBRARY_NAME}
+ cpPlugins_Interface
+ cpExtensions
+ )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
+
+## eof - $RCSfile$
-#include <cpPlugins/Plugins/MarchingCubes.h>
+#include "MarchingCubes.h"
#include <cpPlugins/Interface/Image.h>
#include <cpPlugins/Interface/Mesh.h>
#include <vtkMarchingSquares.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MarchingCubes::
+cpPlugins::BasicFilters::MarchingCubes::
MarchingCubes( )
: Superclass( ),
m_Algorithm( NULL )
{
- this->m_ClassName = "cpPlugins::MarchingCubes";
+ this->m_ClassName = "cpPlugins::BasicFilters::MarchingCubes";
this->m_ClassCategory = "ImageToMeshFilter";
this->SetNumberOfInputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MarchingCubes::
+cpPlugins::BasicFilters::MarchingCubes::
~MarchingCubes( )
{
if( this->m_Algorithm != NULL )
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MarchingCubes::
+std::string cpPlugins::BasicFilters::MarchingCubes::
_GenerateData( )
{
// Get input
#ifndef __CPPLUGINS__PLUGINS__MARCHINGCUBES__H__
#define __CPPLUGINS__PLUGINS__MARCHINGCUBES__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
class vtkPolyDataAlgorithm;
namespace cpPlugins
{
- namespace Plugins
+ namespace BasicFilters
{
/**
*/
- class cpPlugins_EXPORT MarchingCubes
+ class cpPluginsBasicFilters_EXPORT MarchingCubes
: public cpPlugins::Interface::ImageToMeshFilter
{
public:
-#include <cpPlugins/Plugins/MedianImageFilter.h>
+#include "MedianImageFilter.h"
#include <cpPlugins/Interface/Image.h>
#include <itkMedianImageFilter.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MedianImageFilter::
+cpPlugins::BasicFilters::MedianImageFilter::
MedianImageFilter( )
: Superclass( )
{
- this->m_ClassName = "cpPlugins::MedianImageFilter";
+ this->m_ClassName = "cpPlugins::BasicFilters::MedianImageFilter";
this->m_ClassCategory = "ImageToImageFilter";
this->SetNumberOfInputs( 1 );
this->SetNumberOfOutputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MedianImageFilter::
+cpPlugins::BasicFilters::MedianImageFilter::
~MedianImageFilter( )
{
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MedianImageFilter::
+std::string cpPlugins::BasicFilters::MedianImageFilter::
_GenerateData( )
{
cpPlugins::Interface::Image* image =
// -------------------------------------------------------------------------
template< class I >
-std::string cpPlugins::Plugins::MedianImageFilter::
+std::string cpPlugins::BasicFilters::MedianImageFilter::
_DemangleOutput( itk::DataObject* image )
{
return(
// -------------------------------------------------------------------------
template< class I, class O >
-inline std::string cpPlugins::Plugins::MedianImageFilter::
+inline std::string cpPlugins::BasicFilters::MedianImageFilter::
_RealGD( itk::DataObject* image )
{
typedef itk::MedianImageFilter< I, O > _F;
#ifndef __CPPLUGINS__PLUGINS__MEDIANIMAGEFILTER__H__
#define __CPPLUGINS__PLUGINS__MEDIANIMAGEFILTER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace cpPlugins
{
- namespace Plugins
+ namespace BasicFilters
{
/**
*/
- class cpPlugins_EXPORT MedianImageFilter
+ class cpPluginsBasicFilters_EXPORT MedianImageFilter
: public cpPlugins::Interface::ImageToImageFilter
{
public:
-#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
+#include "OtsuThresholdImageFilter.h"
#include <cpPlugins/Interface/Image.h>
#include <itkOtsuThresholdImageFilter.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::OtsuThresholdImageFilter::
+cpPlugins::BasicFilters::OtsuThresholdImageFilter::
OtsuThresholdImageFilter( )
: Superclass( )
{
- this->m_ClassName = "cpPlugins::OtsuThresholdImageFilter";
+ this->m_ClassName = "cpPlugins::BasicFilters::OtsuThresholdImageFilter";
this->m_ClassCategory = "ImageToImageFilter";
this->SetNumberOfInputs( 1 );
this->SetNumberOfOutputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::OtsuThresholdImageFilter::
+cpPlugins::BasicFilters::OtsuThresholdImageFilter::
~OtsuThresholdImageFilter( )
{
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
_GenerateData( )
{
cpPlugins::Interface::Image* image =
// -------------------------------------------------------------------------
template< class I >
-std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
_DemangleOutput( itk::DataObject* image )
{
return(
// -------------------------------------------------------------------------
template< class I, class O >
-inline std::string cpPlugins::Plugins::OtsuThresholdImageFilter::
+inline std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
_RealGD( itk::DataObject* image )
{
typedef itk::OtsuThresholdImageFilter< I, O > _F;
#ifndef __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
#define __CPPLUGINS__PLUGINS__OTSUTHRESHOLDIMAGEFILTER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace cpPlugins
{
- namespace Plugins
+ namespace BasicFilters
{
/**
*/
- class cpPlugins_EXPORT OtsuThresholdImageFilter
+ class cpPluginsBasicFilters_EXPORT OtsuThresholdImageFilter
: public cpPlugins::Interface::ImageToImageFilter
{
public:
-#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
+#include "RGBImageToOtherChannelsFilter.h"
#include <cpPlugins/Interface/Image.h>
#include <cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.h>
#include <cpExtensions/Algorithms/RGBToYPbPrFunction.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
RGBImageToOtherChannelsFilter( )
: Superclass( )
{
typedef cpPlugins::Interface::Parameters TParameters;
- this->m_ClassName = "cpPlugins::RGBImageToOtherChannelsFilter";
+ this->m_ClassName = "cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter";
this->m_ClassCategory = "ImageToImageFilter";
this->SetNumberOfInputs( 1 );
this->SetNumberOfOutputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
~RGBImageToOtherChannelsFilter( )
{
}
)
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
_GenerateData( )
{
cpPlugins::Interface::Image* image =
// -------------------------------------------------------------------------
template< class I >
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
_DemangleOutput( itk::DataObject* image )
{
typedef typename I::PixelType _P;
// -------------------------------------------------------------------------
template< class I, class C >
-std::string cpPlugins::Plugins::RGBImageToOtherChannelsFilter::
+std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
_RealGD( itk::DataObject* image )
{
typedef itk::Image< itk::RGBPixel< double >, I::ImageDimension > _O;
#ifndef __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
#define __CPPLUGINS__PLUGINS__RGBIMAGETOOTHERCHANNELSFILTER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace cpPlugins
{
- namespace Plugins
+ namespace BasicFilters
{
/**
*/
- class cpPlugins_EXPORT RGBImageToOtherChannelsFilter
+ class cpPluginsBasicFilters_EXPORT RGBImageToOtherChannelsFilter
: public cpPlugins::Interface::ImageToImageFilter
{
public:
-SET(LIBRARY_NAME cpPlugins)
-
-## ===============
-## = Source code =
-## ===============
-
-FILE(GLOB LIB_HEADERS_H "*.h")
-FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-FILE(GLOB LIB_SOURCES_C "*.c")
-FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-FILE(GLOB LIB_SOURCES_CXX "*.cxx")
-
-## =====================
-## = Compilation rules =
-## =====================
-
-ADD_LIBRARY(
- ${LIBRARY_NAME}
- SHARED
- ${LIB_SOURCES_C}
- ${LIB_SOURCES_CPP}
- ${LIB_SOURCES_CXX}
- )
-GENERATE_EXPORT_HEADER(
- ${LIBRARY_NAME}
- BASE_NAME ${LIBRARY_NAME}
- EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
- EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/Plugins/${LIBRARY_NAME}_Export.h
- STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
- )
-TARGET_LINK_LIBRARIES(
- ${LIBRARY_NAME}
- cpExtensions
- cpPlugins_Interface
+SUBDIRS(
+ IO
+ BasicFilters
)
-## ========================
-## -- Installation rules --
-## ========================
+# SET(LIBRARY_NAME cpPlugins)
-INSTALL(
- TARGETS ${LIBRARY_NAME}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static
- )
+# ## ===============
+# ## = Source code =
+# ## ===============
+
+# FILE(GLOB LIB_HEADERS_H "*.h")
+# FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+# FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+# FILE(GLOB LIB_SOURCES_C "*.c")
+# FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+# FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+# ## =====================
+# ## = Compilation rules =
+# ## =====================
+
+# ADD_CUSTOM_COMMAND(
+# OUTPUT ${LIBRARY_NAME}_Host.cxx
+# DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+# COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::Plugins ${LIB_HEADERS_H}
+# )
+
+# ADD_LIBRARY(
+# ${LIBRARY_NAME}
+# SHARED
+# ${LIBRARY_NAME}_Host.cxx
+# ${LIB_SOURCES_C}
+# ${LIB_SOURCES_CPP}
+# ${LIB_SOURCES_CXX}
+# )
+# GENERATE_EXPORT_HEADER(
+# ${LIBRARY_NAME}
+# BASE_NAME ${LIBRARY_NAME}
+# EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+# EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/Plugins/${LIBRARY_NAME}_Export.h
+# STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+# )
+# TARGET_LINK_LIBRARIES(
+# ${LIBRARY_NAME}
+# cpExtensions
+# cpPlugins_Interface
+# )
+
+# ## ========================
+# ## -- Installation rules --
+# ## ========================
+
+# INSTALL(
+# TARGETS ${LIBRARY_NAME}
+# RUNTIME DESTINATION bin
+# LIBRARY DESTINATION lib
+# ARCHIVE DESTINATION lib/static
+# )
-## eof - $RCSfile$
+# ## eof - $RCSfile$
+++ /dev/null
-#include <Pluma/Connector.hpp>
-#include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Plugins/ImageWriter.h>
-#include <cpPlugins/Plugins/MeshReader.h>
-#include <cpPlugins/Plugins/MeshWriter.h>
-#include <cpPlugins/Plugins/MarchingCubes.h>
-#include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
-#include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
-#include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
-#include <cpPlugins/Plugins/BinaryThresholdImageFilter.h>
-#include <cpPlugins/Plugins/MedianImageFilter.h>
-
-/// TODO: doc
-PLUMA_CONNECTOR
-bool connect( pluma::Host& host )
-{
- using namespace cpPlugins::Plugins;
-
- host.add( new ImageReaderProvider( ) );
- host.add( new ImageWriterProvider( ) );
- host.add( new MeshReaderProvider( ) );
- host.add( new MeshWriterProvider( ) );
- host.add( new MarchingCubesProvider( ) );
- host.add( new OtsuThresholdImageFilterProvider( ) );
- host.add( new RGBImageToOtherChannelsFilterProvider( ) );
- host.add( new SecondRankDiffusionTensorToPolyDataProvider( ) );
- host.add( new BinaryThresholdImageFilterProvider( ) );
- host.add( new MedianImageFilterProvider( ) );
-
- return( true );
-}
-
-// eof - $RCSfile$
--- /dev/null
+SET(LIBRARY_NAME cpPluginsIO)
+
+## ===============
+## = Source code =
+## ===============
+
+FILE(GLOB LIB_HEADERS_H "*.h")
+FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_SOURCES_C "*.c")
+FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+## =====================
+## = Compilation rules =
+## =====================
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${LIBRARY_NAME}_Host.cxx
+ DEPENDS ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIB_HEADERS_H} ${LIB_HEADERS_HPP} ${LIB_HEADERS_HXX}
+ COMMAND ${PROJECT_BINARY_DIR}/cpPlugins_createHost ${LIBRARY_NAME}_Host.cxx cpPlugins::IO ${LIB_HEADERS_H}
+ )
+
+ADD_LIBRARY(
+ ${LIBRARY_NAME}
+ SHARED
+ ${LIBRARY_NAME}_Host.cxx
+ ${LIB_SOURCES_C}
+ ${LIB_SOURCES_CPP}
+ ${LIB_SOURCES_CXX}
+ )
+GENERATE_EXPORT_HEADER(
+ ${LIBRARY_NAME}
+ BASE_NAME ${LIBRARY_NAME}
+ EXPORT_MACRO_NAME ${LIBRARY_NAME}_EXPORT
+ EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/cpPlugins/IO/${LIBRARY_NAME}_Export.h
+ STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
+ )
+TARGET_LINK_LIBRARIES(
+ ${LIBRARY_NAME}
+ cpPlugins_Interface
+ )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
+
+## eof - $RCSfile$
--- /dev/null
+#include "ImageReader.h"
+#include <cpPlugins/Interface/Image.h>
+
+#include <set>
+
+#include <itkImageFileReader.h>
+#include <itkImageSeriesReader.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::IO::ImageReader::
+ImageReader( )
+ : Superclass( )
+{
+ this->m_ClassName = "cpPlugins::IO::ImageReader";
+ this->m_ClassCategory = "ImageReader";
+
+ this->SetNumberOfOutputs( 1 );
+ this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
+ this->m_DefaultParameters.Configure( Parameters::Bool, "VectorType" );
+ this->m_DefaultParameters.SetValueAsBool( "VectorType", false );
+ this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::IO::ImageReader::
+~ImageReader( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::IO::ImageReader::
+_GenerateData( )
+{
+ // Get filenames
+ TStringList names;
+ this->m_Parameters.GetValueAsStringList( names, "FileNames" );
+
+ std::string r = "";
+ if( names.size( ) >= 1 )
+ {
+ // Guess image properties
+ itk::ImageIOBase::Pointer io =
+ itk::ImageIOFactory::CreateImageIO(
+ names[ 0 ].c_str( ),
+ itk::ImageIOFactory::ReadMode
+ );
+ if( io.IsNotNull( ) )
+ {
+ io->SetFileName( names[ 0 ] );
+ io->ReadImageInformation( );
+ if( names.size( ) >= 1 )
+ {
+ switch( io->GetNumberOfDimensions( ) )
+ {
+ case 2: r = this->_GD0< 2 >( io, names ); break;
+ case 3: r = this->_GD0< 3 >( io, names ); break;
+ case 4: r = this->_GD0< 4 >( io, names ); break;
+ default:
+ r = "ImageReader: Image dimension not supported.";
+ break;
+ } // hctiws
+
+ } // fi
+ }
+ else
+ r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
+ }
+ else
+ r = "No image files given";
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int D >
+std::string cpPlugins::IO::ImageReader::
+_GD0( itk::ImageIOBase* io, const TStringList& names )
+{
+ itk::ImageIOBase::IOComponentType ct = io->GetComponentType( );
+ itk::ImageIOBase::IOPixelType pt = io->GetPixelType( );
+ std::string r = "";
+
+ if( pt == itk::ImageIOBase::SCALAR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_GD1< unsigned char, D >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_GD1< char, D >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_GD1< unsigned short, D >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_GD1< short, D >( names );
+ break;
+ case itk::ImageIOBase::UINT:
+ r = this->_GD1< unsigned int, D >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_GD1< int, D >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_GD1< unsigned long, D >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_GD1< long, D >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< float, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< double, D >( names );
+ break;
+ default:
+ r = "ImageReader: Scalar pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::RGB )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_GD1< itk::RGBPixel< unsigned char >, D >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_GD1< itk::RGBPixel< char >, D >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_GD1< itk::RGBPixel< unsigned short >, D >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_GD1< itk::RGBPixel< short >, D >( names );
+ break;
+ case itk::ImageIOBase::UINT:
+ r = this->_GD1< itk::RGBPixel< unsigned int >, D >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_GD1< itk::RGBPixel< int >, D >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_GD1< itk::RGBPixel< unsigned long >, D >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_GD1< itk::RGBPixel< long >, D >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::RGBPixel< float >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::RGBPixel< double >, D >( names );
+ break;
+ default:
+ r = "ImageReader: RGB pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::RGBA )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::UCHAR:
+ r = this->_GD1< itk::RGBAPixel< unsigned char >, D >( names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_GD1< itk::RGBAPixel< char >, D >( names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_GD1< itk::RGBAPixel< unsigned short >, D >( names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_GD1< itk::RGBAPixel< short >, D >( names );
+ break;
+ case itk::ImageIOBase::UINT:
+ r = this->_GD1< itk::RGBAPixel< unsigned int >, D >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_GD1< itk::RGBAPixel< int >, D >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_GD1< itk::RGBAPixel< unsigned long >, D >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_GD1< itk::RGBAPixel< long >, D >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::RGBAPixel< float >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::RGBAPixel< double >, D >( names );
+ break;
+ default:
+ r = "ImageReader: RGBA pixel type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::VECTOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::Vector< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::Vector< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Vector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::POINT )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::Point< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::Point< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Point type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::CovariantVector< float, D >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::CovariantVector< double, D >, D >( names );
+ break;
+ default:
+ r = "ImageReader: CovariantVector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r =
+ this->_GD1< itk::SymmetricSecondRankTensor< float, D >, D >(
+ names
+ );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r =
+ this->_GD1< itk::SymmetricSecondRankTensor< double, D >, D >(
+ names
+ );
+ break;
+ default:
+ r = "ImageReader: Vector type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< itk::DiffusionTensor3D< float >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< itk::DiffusionTensor3D< double >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Diffusion tensor type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::COMPLEX )
+ {
+ switch( ct )
+ {
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< std::complex< float >, D >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< std::complex< double >, D >( names );
+ break;
+ default:
+ r = "ImageReader: Complex type not supported.";
+ break;
+ } // hctiws
+ }
+ else if( pt == itk::ImageIOBase::OFFSET )
+ r = this->_GD1< itk::Offset< D >, D >( names );
+ else
+ r = "ImageReader: Image pixel type not yet supported.";
+ /* TODO
+ itk::ImageIOBase::FIXEDARRAY
+ itk::ImageIOBase::MATRIX
+ */
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+std::string cpPlugins::IO::ImageReader::
+_GD1( const TStringList& names )
+{
+ if( this->m_Parameters.GetValueAsBool( "VectorType" ) )
+ return( this->_RealGD< itk::VectorImage< P, D > >( names ) );
+ else
+ return( this->_RealGD< itk::Image< P, D > >( names ) );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::IO::ImageReader::
+_RealGD( const TStringList& names )
+{
+ cpPlugins::Interface::Image* out =
+ this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ if( out == NULL )
+ return( "ImageReader: No output object properly created." );
+
+ std::string r = "";
+ if( names.size( ) == 1 )
+ {
+ // Read single image
+ typedef itk::ImageFileReader< I > _SR;
+ _SR* reader =
+ dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
+ if( reader == NULL )
+ {
+ this->m_RealProcessObject = _SR::New( );
+ reader =
+ dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
+
+ } // fi
+ reader->SetFileName( names[ 0 ] );
+ try
+ {
+ reader->Update( );
+ out->SetITKImage< I >( reader->GetOutput( ) );
+ }
+ catch( itk::ExceptionObject& err )
+ {
+ r = "ImageReader: " + std::string( err.GetDescription( ) );
+ out->SetITKImage< I >( NULL );
+
+ } // yrt
+ }
+ else if( names.size( ) > 1 )
+ {
+ // Read image series
+ std::set< std::string > ordered_names;
+ for( unsigned int i = 0; i < names.size( ); ++i )
+ ordered_names.insert( names[ i ] );
+
+ typedef itk::ImageSeriesReader< I > _MR;
+ _MR* reader =
+ dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
+ if( reader == NULL )
+ {
+ this->m_RealProcessObject = _MR::New( );
+ reader =
+ dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
+
+ } // fi
+ std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
+ for( ; fnIt != ordered_names.end( ); ++fnIt )
+ {
+ reader->AddFileName( *fnIt );
+ }
+ try
+ {
+ reader->Update( );
+ out->SetITKImage< I >( reader->GetOutput( ) );
+ }
+ catch( itk::ExceptionObject& err )
+ {
+ r = "ImageReader: " + std::string( err.GetDescription( ) );
+ out->SetITKImage< I >( NULL );
+
+ } // yrt
+ }
+ else
+ r = "ImageReader: No image files given";
+ return( r );
+}
+
+// eof - $RCSfile$
#include <vector>
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace itk
namespace cpPlugins
{
- namespace Plugins
+ namespace IO
{
/**
*/
- class cpPlugins_EXPORT ImageReader
+ class cpPluginsIO_EXPORT ImageReader
: public cpPlugins::Interface::ImageSource
{
public:
std::string _GD0( itk::ImageIOBase* io, const TStringList& names );
template< class P, unsigned int D >
+ std::string _GD1( const TStringList& names );
+
+ template< class I >
std::string _RealGD( const TStringList& names );
private:
-#include <cpPlugins/Plugins/ImageWriter.h>
+#include "ImageWriter.h"
#include <cpPlugins/Interface/Image.h>
#include <itkImageFileWriter.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageWriter::
+cpPlugins::IO::ImageWriter::
ImageWriter( )
: Superclass( )
{
- this->m_ClassName = "cpPlugins::ImageWriter";
+ this->m_ClassName = "cpPlugins::IO::ImageWriter";
this->m_ClassCategory = "ImageWriter";
this->SetNumberOfInputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageWriter::
+cpPlugins::IO::ImageWriter::
~ImageWriter( )
{
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageWriter::
+std::string cpPlugins::IO::ImageWriter::
_GenerateData( )
{
cpPlugins::Interface::Image* image =
// -------------------------------------------------------------------------
template< class I >
-std::string cpPlugins::Plugins::ImageWriter::
+std::string cpPlugins::IO::ImageWriter::
_RealGD( itk::DataObject* image )
{
typedef itk::ImageFileWriter< I > _W;
#ifndef __CPPLUGINS__PLUGINS__IMAGEWRITER__H__
#define __CPPLUGINS__PLUGINS__IMAGEWRITER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
namespace cpPlugins
{
- namespace Plugins
+ namespace IO
{
/**
*/
- class cpPlugins_EXPORT ImageWriter
+ class cpPluginsIO_EXPORT ImageWriter
: public cpPlugins::Interface::ImageSink
{
public:
-#include <cpPlugins/Plugins/MeshReader.h>
+#include "MeshReader.h"
#include <cpPlugins/Interface/Mesh.h>
#include <vtkPolyData.h>
#include <vtkPolyDataReader.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshReader::
+cpPlugins::IO::MeshReader::
MeshReader( )
: Superclass( ),
m_Reader( NULL )
{
- this->m_ClassName = "cpPlugins::MeshReader";
+ this->m_ClassName = "cpPlugins::IO::MeshReader";
this->m_ClassCategory = "MeshReader";
this->SetNumberOfOutputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshReader::
+cpPlugins::IO::MeshReader::
~MeshReader( )
{
if( this->m_Reader != NULL )
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
_GenerateData( )
{
using namespace cpPlugins::Interface;
// -------------------------------------------------------------------------
template< unsigned int D >
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
_GD0( )
{
using namespace cpPlugins::Interface;
// -------------------------------------------------------------------------
template< class P, unsigned int D >
-std::string cpPlugins::Plugins::MeshReader::
+std::string cpPlugins::IO::MeshReader::
_GD1( )
{
// Get filename
#ifndef __CPPLUGINS__PLUGINS__MESHREADER__H__
#define __CPPLUGINS__PLUGINS__MESHREADER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
class vtkDataReader;
namespace cpPlugins
{
- namespace Plugins
+ namespace IO
{
/**
*/
- class cpPlugins_EXPORT MeshReader
+ class cpPluginsIO_EXPORT MeshReader
: public cpPlugins::Interface::MeshSource
{
public:
-#include <cpPlugins/Plugins/MeshWriter.h>
+#include "MeshWriter.h"
#include <cpPlugins/Interface/Mesh.h>
#include <vtkSmartPointer.h>
#include <vtkPolyDataWriter.h>
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshWriter::
+cpPlugins::IO::MeshWriter::
MeshWriter( )
: Superclass( ),
m_Writer( NULL )
{
- this->m_ClassName = "cpPlugins::MeshWriter";
+ this->m_ClassName = "cpPlugins::IO::MeshWriter";
this->m_ClassCategory = "MeshWriter";
this->SetNumberOfInputs( 1 );
}
// -------------------------------------------------------------------------
-cpPlugins::Plugins::MeshWriter::
+cpPlugins::IO::MeshWriter::
~MeshWriter( )
{
if( this->m_Writer != NULL )
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshWriter::
+std::string cpPlugins::IO::MeshWriter::
_GenerateData( )
{
cpPlugins::Interface::Mesh* mesh =
#ifndef __CPPLUGINS__PLUGINS__MESHWRITER__H__
#define __CPPLUGINS__PLUGINS__MESHWRITER__H__
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/IO/cpPluginsIO_Export.h>
#include <cpPlugins/Interface/BaseProcessObjects.h>
class vtkDataWriter;
namespace cpPlugins
{
- namespace Plugins
+ namespace IO
{
/**
*/
- class cpPlugins_EXPORT MeshWriter
+ class cpPluginsIO_EXPORT MeshWriter
: public cpPlugins::Interface::MeshSink
{
public:
+++ /dev/null
-#include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Interface/Image.h>
-
-#include <set>
-
-#include <itkImageFileReader.h>
-#include <itkImageSeriesReader.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageReader::
-ImageReader( )
- : Superclass( )
-{
- this->m_ClassName = "cpPlugins::ImageReader";
- this->m_ClassCategory = "ImageReader";
-
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
-
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
- this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageReader::
-~ImageReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageReader::
-_GenerateData( )
-{
- // Get filenames
- TStringList names;
- this->m_Parameters.GetValueAsStringList( names, "FileNames" );
-
- std::string r = "";
- if( names.size( ) >= 1 )
- {
- // Guess image properties
- itk::ImageIOBase::Pointer io =
- itk::ImageIOFactory::CreateImageIO(
- names[ 0 ].c_str( ),
- itk::ImageIOFactory::ReadMode
- );
- if( io.IsNotNull( ) )
- {
- io->SetFileName( names[ 0 ] );
- io->ReadImageInformation( );
- if( names.size( ) >= 1 )
- {
- switch( io->GetNumberOfDimensions( ) )
- {
- case 2: r = this->_GD0< 2 >( io, names ); break;
- case 3: r = this->_GD0< 3 >( io, names ); break;
- case 4: r = this->_GD0< 4 >( io, names ); break;
- default:
- r = "ImageReader: Image dimension not supported.";
- break;
- } // hctiws
-
- } // fi
- }
- else
- r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
- }
- else
- r = "No image files given";
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::ImageReader::
-_GD0( itk::ImageIOBase* io, const TStringList& names )
-{
- itk::ImageIOBase::IOComponentType ct = io->GetComponentType( );
- itk::ImageIOBase::IOPixelType pt = io->GetPixelType( );
- std::string r = "";
-
- if( pt == itk::ImageIOBase::SCALAR )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< unsigned char, D >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< char, D >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< unsigned short, D >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< short, D >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< unsigned int, D >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< int, D >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< unsigned long, D >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< long, D >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< float, D >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< double, D >( names );
- break;
- default:
- r = "ImageReader: Scalar pixel type not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::RGB )
- {
- if( D == 2 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBPixel< unsigned char >, 2 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBPixel< char >, 2 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBPixel< unsigned short >, 2 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBPixel< short >, 2 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBPixel< unsigned int >, 2 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBPixel< int >, 2 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBPixel< unsigned long >, 2 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBPixel< long >, 2 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBPixel< float >, 2 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBPixel< double >, 2 >( names );
- break;
- default:
- r = "ImageReader: RGB pixel type not supported.";
- break;
- } // hctiws
- }
- else if( D == 3 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBPixel< unsigned char >, 3 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBPixel< char >, 3 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBPixel< unsigned short >, 3 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBPixel< short >, 3 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBPixel< unsigned int >, 3 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBPixel< int >, 3 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBPixel< unsigned long >, 3 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBPixel< long >, 3 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBPixel< float >, 3 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBPixel< double >, 3 >( names );
- break;
- default:
- r = "ImageReader: RGB pixel type not supported.";
- break;
- } // hctiws
- }
- else if( D == 4 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBPixel< unsigned char >, 4 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBPixel< char >, 4 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBPixel< unsigned short >, 4 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBPixel< short >, 4 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBPixel< unsigned int >, 4 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBPixel< int >, 4 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBPixel< unsigned long >, 4 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBPixel< long >, 4 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBPixel< float >, 4 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBPixel< double >, 4 >( names );
- break;
- default:
- r = "ImageReader: RGB pixel type not supported.";
- break;
- } // hctiws
-
- } // fi
- }
- else if( pt == itk::ImageIOBase::RGBA )
- {
- if( D == 2 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBAPixel< unsigned char >, 2 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBAPixel< char >, 2 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBAPixel< unsigned short >, 2 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBAPixel< short >, 2 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBAPixel< unsigned int >, 2 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBAPixel< int >, 2 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBAPixel< unsigned long >, 2 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBAPixel< long >, 2 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBAPixel< float >, 2 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBAPixel< double >, 2 >( names );
- break;
- default:
- r = "ImageReader: RGBA pixel type not supported.";
- break;
- } // hctiws
- }
- else if( D == 3 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBAPixel< unsigned char >, 3 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBAPixel< char >, 3 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBAPixel< unsigned short >, 3 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBAPixel< short >, 3 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBAPixel< unsigned int >, 3 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBAPixel< int >, 3 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBAPixel< unsigned long >, 3 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBAPixel< long >, 3 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBAPixel< float >, 3 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBAPixel< double >, 3 >( names );
- break;
- default:
- r = "ImageReader: RGBA pixel type not supported.";
- break;
- } // hctiws
- }
- else if( D == 4 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::UCHAR:
- r = this->_RealGD< itk::RGBAPixel< unsigned char >, 4 >( names );
- break;
- case itk::ImageIOBase::CHAR:
- r = this->_RealGD< itk::RGBAPixel< char >, 4 >( names );
- break;
- case itk::ImageIOBase::USHORT:
- r = this->_RealGD< itk::RGBAPixel< unsigned short >, 4 >( names );
- break;
- case itk::ImageIOBase::SHORT:
- r = this->_RealGD< itk::RGBAPixel< short >, 4 >( names );
- break;
- case itk::ImageIOBase::UINT:
- r = this->_RealGD< itk::RGBAPixel< unsigned int >, 4 >( names );
- break;
- case itk::ImageIOBase::INT:
- r = this->_RealGD< itk::RGBAPixel< int >, 4 >( names );
- break;
- case itk::ImageIOBase::ULONG:
- r = this->_RealGD< itk::RGBAPixel< unsigned long >, 4 >( names );
- break;
- case itk::ImageIOBase::LONG:
- r = this->_RealGD< itk::RGBAPixel< long >, 4 >( names );
- break;
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::RGBAPixel< float >, 4 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::RGBAPixel< double >, 4 >( names );
- break;
- default:
- r = "ImageReader: RGBA pixel type not supported.";
- break;
- } // hctiws
-
- } // fi
- }
- else if( pt == itk::ImageIOBase::OFFSET )
- {
- switch( D )
- {
- case 2:
- r = this->_RealGD< itk::Offset< 2 >, 2 >( names );
- break;
- case 3:
- r = this->_RealGD< itk::Offset< 3 >, 3 >( names );
- break;
- case 4:
- r = this->_RealGD< itk::Offset< 4 >, 4 >( names );
- break;
- default:
- r = "ImageReader: Offset pixel dimension not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::VECTOR )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::Vector< float, D >, D >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::Vector< double, D >, D >( names );
- break;
- default:
- r = "ImageReader: Vector type not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::POINT )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::Point< float, D >, D >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::Point< double, D >, D >( names );
- break;
- default:
- r = "ImageReader: Point type not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::CovariantVector< float, D >, D >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::CovariantVector< double, D >, D >( names );
- break;
- default:
- r = "ImageReader: CovariantVector type not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r =
- this->_RealGD< itk::SymmetricSecondRankTensor< float, D >, D >(
- names
- );
- break;
- case itk::ImageIOBase::DOUBLE:
- r =
- this->_RealGD< itk::SymmetricSecondRankTensor< double, D >, D >(
- names
- );
- break;
- default:
- r = "ImageReader: Vector type not supported.";
- break;
- } // hctiws
- }
- else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
- {
- if( D == 3 )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< itk::DiffusionTensor3D< float >, 3 >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< itk::DiffusionTensor3D< double >, 3 >( names );
- break;
- default:
- r = "ImageReader: Diffusion tensor type not supported.";
- 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.";
- }
- else if( pt == itk::ImageIOBase::COMPLEX )
- {
- switch( ct )
- {
- case itk::ImageIOBase::FLOAT:
- r = this->_RealGD< std::complex< float >, D >( names );
- break;
- case itk::ImageIOBase::DOUBLE:
- r = this->_RealGD< std::complex< double >, D >( names );
- break;
- default:
- r = "ImageReader: Complex type not supported.";
- break;
- } // hctiws
- }
- else
- r = "ImageReader: Image pixel type not yet supported.";
- /* TODO
- itk::ImageIOBase::FIXEDARRAY
- itk::ImageIOBase::MATRIX
- */
-
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::ImageReader::
-_RealGD( const TStringList& names )
-{
- typedef itk::Image< P, D > _I;
-
- cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
- if( out == NULL )
- return( "ImageReader: No output object properly created." );
-
- std::string r = "";
- if( names.size( ) == 1 )
- {
- // Read single image
- typedef itk::ImageFileReader< _I > _SR;
- _SR* reader =
- dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_RealProcessObject = _SR::New( );
- reader =
- dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- reader->SetFileName( names[ 0 ] );
- try
- {
- reader->Update( );
- out->SetITKImage< _I >( reader->GetOutput( ) );
- }
- catch( itk::ExceptionObject& err )
- {
- r = "ImageReader: " + std::string( err.GetDescription( ) );
- out->SetITKImage< _I >( NULL );
-
- } // yrt
- }
- else if( names.size( ) > 1 )
- {
- // Read image series
- std::set< std::string > ordered_names;
- for( unsigned int i = 0; i < names.size( ); ++i )
- ordered_names.insert( names[ i ] );
-
- typedef itk::ImageSeriesReader< _I > _MR;
- _MR* reader =
- dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_RealProcessObject = _MR::New( );
- reader =
- dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
- for( ; fnIt != ordered_names.end( ); ++fnIt )
- {
- reader->AddFileName( *fnIt );
- }
- try
- {
- reader->Update( );
- out->SetITKImage< _I >( reader->GetOutput( ) );
- }
- catch( itk::ExceptionObject& err )
- {
- r = "ImageReader: " + std::string( err.GetDescription( ) );
- out->SetITKImage< _I >( NULL );
-
- } // yrt
- }
- else
- r = "ImageReader: No image files given";
- return( r );
-}
-
-// eof - $RCSfile$