#include <ITKIO/ImageReader.h>
-#include <cpInstances/Image.h>
+#include <cpInstances/DataObjects/Image.h>
#include <cpPlugins/QT/OpenFileDialog.h>
#define ITKIOImageBase_HIDDEN
ImageReader( )
: Superclass( )
{
- this->_ConfigureOutput< cpInstances::Image >( "Output" );
+ this->_ConfigureOutput< cpInstances::DataObjects::Image >( "Output" );
this->m_Parameters.Clear( );
this->m_Parameters.ConfigureAsOpenFileNameList( "FileNames" );
this->m_Parameters.SetAcceptedFileExtensions(
{
// Get filenames
auto fnames = this->m_Parameters.GetOpenFileNameList( "FileNames" );
+ std::string fname = "";
if( fnames.size( ) > 1 )
{
std::stringstream fname_str;
fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
- std::string fname = fname_str.str( );
+ fname = fname_str.str( );
+ }
+ else if( fnames.size( ) == 1 )
+ fname = fnames[ 0 ];
+ if( fname != "" )
+ {
// Guess image properties
itk::ImageIOBase::Pointer io =
itk::ImageIOFactory::CreateImageIO(
io->ReadImageInformation( );
bool success = false;
unsigned int dim = io->GetNumberOfDimensions( );
-#ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_1
+#ifdef cpPlugins_PROCESS_DIMS_1
if( dim == 1 ) success = this->_GD0< 1 >( io );
-#endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_1
-#ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_2
+#endif // cpPlugins_PROCESS_DIMS_1
+#ifdef cpPlugins_PROCESS_DIMS_2
if( dim == 2 ) success = this->_GD0< 2 >( io );
-#endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_2
-#ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_3
+#endif // cpPlugins_PROCESS_DIMS_2
+#ifdef cpPlugins_PROCESS_DIMS_3
if( dim == 3 ) success = this->_GD0< 3 >( io );
-#endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_3
-#ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_4
+#endif // cpPlugins_PROCESS_DIMS_3
+#ifdef cpPlugins_PROCESS_DIMS_4
if( dim == 4 ) success = this->_GD0< 4 >( io );
-#endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_4
+#endif // cpPlugins_PROCESS_DIMS_4
if( !success )
this->_Error( "Image dimension not supported." );
}
// Get filenames
auto fnames = this->m_Parameters.GetOpenFileNameList( "FileNames" );
- if( fnames.size( ) == 2 )
+ if( fnames.size( ) == 1 || fnames.size( ) == 2 )
{
std::stringstream fname_str;
- fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
+ if( fnames.size( ) == 1 )
+ fname_str << fnames[ 0 ];
+ else
+ fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
auto f = this->_CreateITK< itk::ImageFileReader< _TImage > >( );
f->SetFileName( fname_str.str( ) );