]> Creatis software - cpPlugins.git/blobdiff - plugins/ITKIO/ImageReader.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / plugins / ITKIO / ImageReader.cxx
index 64d63a2b3dd4569c0305b7c55a80d7b914a1bf73..b336078ddb12d82010a298ba923a5bb085d1ed25 100644 (file)
@@ -55,12 +55,18 @@ _GenerateData( )
 {
   // 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(
@@ -210,10 +216,13 @@ _GD1( itk::ImageIOBase* io )
 
   // 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( ) );