]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 13 Feb 2016 22:24:36 +0000 (17:24 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 13 Feb 2016 22:24:36 +0000 (17:24 -0500)
22 files changed:
lib/cpPlugins/Interface/DataObject.cxx
lib/cpPlugins/Interface/Image.cxx
lib/cpPlugins/Interface/Image.h
lib/cpPlugins/Interface/Image.hxx
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.hxx
lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/CPRFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/ImageInterpolatorSource.cxx
lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/TriangleMeshToBinaryImageFilter.cxx
lib/cpPlugins/Plugins/IO/MeshReader.cxx

index 489392d57651f271eedfbd7032c81b4c78b5e63c..0bbe13bdeb4973d0d23ee9b11c3f350aabcca5e5 100644 (file)
@@ -80,8 +80,10 @@ DataObject( )
 cpPlugins::Interface::DataObject::
 ~DataObject( )
 {
-  auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
-  delete ptr;
+  /* TODO
+     auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+     delete ptr;
+  */
 }
 
 // eof - $RCSfile$
index 44deb4e4e9eb9b478536790ff208a96d0407936b..b1f18f89c7aa3d2115c7ea9d84b77e0ba0740d83 100644 (file)
@@ -5,8 +5,16 @@ void cpPlugins::Interface::Image::
 SetITK( itk::LightObject* o )
 {
   this->Superclass::SetITK( o );
-  this->_ITK_2_VTK_0< 2 >( o );
-  this->_ITK_2_VTK_0< 3 >( o );
+  bool success = false;
+  success |= this->_ITK_2_VTK_0< 2 >( o );
+  success |= this->_ITK_2_VTK_0< 3 >( o );
+  if( !success )
+  {
+    this->m_VTKObject = NULL;
+    this->m_ITKvVTK = NULL;
+
+  } // fi
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
index 45b47faf37175195f59d7249eafa4b2721c70464..88808c4a59c7e360ece328eb27a23fc050356b9c 100644 (file)
@@ -34,13 +34,13 @@ namespace cpPlugins
       virtual ~Image( );
 
       template< unsigned int D >
-        inline void _ITK_2_VTK_0( itk::LightObject* o );
+        inline bool _ITK_2_VTK_0( itk::LightObject* o );
 
       template< class P, unsigned int D >
-        inline void _ITK_2_VTK_1( itk::LightObject* o );
+        inline bool _ITK_2_VTK_1( itk::LightObject* o );
 
       template< class I >
-        inline void _ITK_2_VTK_2( itk::LightObject* o );
+        inline bool _ITK_2_VTK_2( itk::LightObject* o );
 
     private:
       // Purposely not implemented
index 1bb8b77be545eb3c5af9add91d94aab9cb6db618..3160fea305f850e73ca3fdd897da294052390254 100644 (file)
 
 // -------------------------------------------------------------------------
 template< unsigned int D >
-void cpPlugins::Interface::Image::
+bool cpPlugins::Interface::Image::
 _ITK_2_VTK_0( itk::LightObject* o )
 {
+  bool s = false;
   if( dynamic_cast< itk::ImageBase< D >* >( o ) != NULL )
   {
-    this->_ITK_2_VTK_1< char, D >( o );
-    this->_ITK_2_VTK_1< short, D >( o );
-    this->_ITK_2_VTK_1< int, D >( o );
-    this->_ITK_2_VTK_1< long, D >( o );
-    this->_ITK_2_VTK_1< unsigned char, D >( o );
-    this->_ITK_2_VTK_1< unsigned short, D >( o );
-    this->_ITK_2_VTK_1< unsigned int, D >( o );
-    this->_ITK_2_VTK_1< unsigned long, D >( o );
-    this->_ITK_2_VTK_1< float, D >( o );
-    this->_ITK_2_VTK_1< double, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< char >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< short >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< int >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< long >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< unsigned char >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< unsigned short >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< unsigned int >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< unsigned long >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< float >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBPixel< double >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< char >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< short >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< int >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< long >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned char >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned short >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned int >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned long >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< float >, D >( o );
-    this->_ITK_2_VTK_1< itk::RGBAPixel< double >, D >( o );
-    this->_ITK_2_VTK_1< itk::DiffusionTensor3D< float >, D >( o );
-    this->_ITK_2_VTK_1< itk::DiffusionTensor3D< double >, D >( o );
-    this->_ITK_2_VTK_1< itk::Vector< float, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::Vector< double, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::CovariantVector< float, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::CovariantVector< double, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::Point< float, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::Point< double, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< float, D >, D >( o );
-    this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< double, D >, D >( o );
-  }
-  else
-  {
-    this->m_VTKObject = NULL;
-    this->m_ITKvVTK = NULL;
-    this->Modified( );
+    s |= this->_ITK_2_VTK_1< char, D >( o );
+    s |= this->_ITK_2_VTK_1< short, D >( o );
+    s |= this->_ITK_2_VTK_1< int, D >( o );
+    s |= this->_ITK_2_VTK_1< long, D >( o );
+    s |= this->_ITK_2_VTK_1< unsigned char, D >( o );
+    s |= this->_ITK_2_VTK_1< unsigned short, D >( o );
+    s |= this->_ITK_2_VTK_1< unsigned int, D >( o );
+    s |= this->_ITK_2_VTK_1< unsigned long, D >( o );
+    s |= this->_ITK_2_VTK_1< float, D >( o );
+    s |= this->_ITK_2_VTK_1< double, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< char >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< short >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< int >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< long >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< unsigned char >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< unsigned short >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< unsigned int >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< unsigned long >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< float >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBPixel< double >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< char >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< short >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< int >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< long >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned char >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned short >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned int >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned long >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< float >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::RGBAPixel< double >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::DiffusionTensor3D< float >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::DiffusionTensor3D< double >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::Vector< float, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::Vector< double, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::CovariantVector< float, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::CovariantVector< double, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::Point< float, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::Point< double, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< float, D >, D >( o );
+    s |= this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< double, D >, D >( o );
 
   } // fi
+  return( s );
 }
 
 // -------------------------------------------------------------------------
 template< class P, unsigned int D >
-void cpPlugins::Interface::Image::
+bool cpPlugins::Interface::Image::
 _ITK_2_VTK_1( itk::LightObject* o )
 {
-  if( dynamic_cast< itk::Image< P, D >* >( o ) == NULL )
-  {
-    this->m_VTKObject = NULL;
-    this->m_ITKvVTK = NULL;
-    this->Modified( );
-  }
+  if( dynamic_cast< itk::Image< P, D >* >( o ) != NULL )
+    return( this->_ITK_2_VTK_2< itk::Image< P, D > >( o ) );
   else
-    this->_ITK_2_VTK_2< itk::Image< P, D > >( o );
+    return( false );
 }
 
 // -------------------------------------------------------------------------
 template< class I >
-void cpPlugins::Interface::Image::
+bool cpPlugins::Interface::Image::
 _ITK_2_VTK_2( itk::LightObject* o )
 {
   typedef itk::ImageToVTKImageFilter< I > _I2V;
@@ -111,14 +103,10 @@ _ITK_2_VTK_2( itk::LightObject* o )
     // Keep object track
     this->m_ITKObject = o;
     this->m_VTKObject = f->GetOutput( );
+    return( true );
   }
   else
-  {
-    this->m_VTKObject = NULL;
-    this->m_ITKvVTK = NULL;
-
-  } // fi
-  this->Modified( );
+    return( false );
 }
 
 #ifndef cpPlugins_Interface_EXPORTS
index e2ea0de61e79640917d122c376c24a2eed027b2f..72897d6729a615ca3368a85a62c434297e8063cf 100644 (file)
@@ -154,7 +154,12 @@ Update( )
   {
     bool iv = i->second.IsValid( );
     bool ir = i->second.IsRequired( );
-    if( iv || !ir )
+    if( !iv && ir )
+      r =
+        "ProcessObject: Required input \"" +
+        i->first + "@" + this->GetClassName( ) +
+        "\" is not valid (=NULL).";
+    if( iv && r == "" )
     {
       Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
       if( src != NULL )
@@ -163,12 +168,8 @@ Update( )
         r = src->Update( );
 
       } // fi
-    }
-    else
-      r =
-        "ProcessObject: Required input \"" +
-        i->first + "@" + this->GetClassName( ) +
-        "\" is not valid (=NULL).";
+
+    } // fi
 
   } // rof
 
index ccddc04d9506ce3369b4e09f01c0f48d069107b6..54c2f37bb8ede077d0f7238dbf760f5ac3382ec3 100644 (file)
@@ -74,8 +74,8 @@ _CreateITK( )
   if( filter == NULL )
   {
     typename F::Pointer filter_ptr = F::New( );
-    this->SetITK( filter_ptr.GetPointer( ) );
-    this->SetVTK( NULL );
+    this->m_ITKObject = filter_ptr;
+    this->m_VTKObject = NULL;
     filter = filter_ptr.GetPointer( );
     this->Modified( );
 
@@ -92,8 +92,8 @@ _CreateVTK( )
   if( filter == NULL )
   {
     vtkSmartPointer< F > filter_ptr = vtkSmartPointer< F >::New( );
-    this->SetITK( NULL );
-    this->SetVTK( filter_ptr );
+    this->m_ITKObject = NULL;
+    this->m_VTKObject = filter_ptr;
     filter = filter_ptr.GetPointer( );
     this->Modified( );
 
index 0168f77c6882a241a200946a6d214cbf9b41e45f..f4dd37b7f8e64bed757b81ff2508327f5c3954e2 100644 (file)
@@ -76,13 +76,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "BinaryErodeImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 98926796d276469c85df76d22fa845d7a1a2d2f6..af2c26ae01d11f165081115cf1dfdc5b6b558d0d 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 BinaryThresholdImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" );
@@ -33,9 +33,6 @@ std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "BinaryThresholdImageFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -85,13 +82,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "BinaryThresholdImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 21dcbab574a8c1f0649872b35d73aec9b0b2ba5e..a67baa177a394637b3ffcfd6cb7daf842c86bc24 100644 (file)
@@ -9,8 +9,8 @@ cpPlugins::BasicFilters::CPRFilter::
 CPRFilter( )
   : Superclass( )
 {
-  this->_AddInput( "InputImage", true );
-  this->_AddInput( "InputAxis", true );
+  this->_AddInput( "InputImage" );
+  this->_AddInput( "InputAxis" );
   this->_AddInput( "Interpolator", false );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
@@ -38,9 +38,6 @@ _GenerateData( )
 {
   auto image =
     this->GetInputData< cpPlugins::Interface::Image >( "InputImage" );
-  if( image == NULL )
-    return( "CPRFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
@@ -77,6 +74,8 @@ _GD1( I* image )
     this->GetInputData< cpPlugins::Interface::PolyLineParametricPath >(
       "InputAxis"
       )->GetITK< _Path >( );
+  if( axis == NULL )
+    return( "CPRFilter: Invalid input axis." );
   auto w_int =
     this->GetInputData< cpPlugins::Interface::DataObject >( "Interpolator" );
   _Interpolator* interpolator = NULL;
@@ -96,7 +95,7 @@ _GD1( I* image )
   // Assign output
   auto out =
     this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  out->SetITK< I >( filter->GetOutput( ) );
+  out->SetITK( filter->GetOutput( ) );
   return( "" );
 }
 
index a0b051d16c7d173977a9894edc5458f17f9c2b62..a6a916cbd48f129f92bb30ef916236473c3d161e 100644 (file)
@@ -13,8 +13,8 @@ cpPlugins::BasicFilters::Cutter::
 Cutter( )
   : Superclass( )
 {
-  this->_AddInput( "InputMesh", true );
-  this->_AddInput( "InputFunction", true );
+  this->_AddInput( "InputMesh" );
+  this->_AddInput( "InputFunction" );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 }
 
@@ -34,9 +34,6 @@ _GenerateData( )
     this->GetInputData< cpPlugins::Interface::ImplicitFunction >(
       "InputFunction"
       );
-  if( function == NULL )
-    return( "Cutter: Input data 1 is not a valid implicit function." );
-
   vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
   cutter->DebugOn( );
   cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
index 0e553fd1bca1a6fe31e9e4868c2e064042f5f23d..12cb54034c2e9e2bb26b831d5af315f1dbb6d05e 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 ExtractSliceImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Axis" );
@@ -29,9 +29,6 @@ std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "ExtractSliceImageFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
 /*
@@ -80,13 +77,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "ExtractSliceImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index d47bc6e2a652cdd9766e449262306c33c0f92b25..0a1aa5c2c979829c263b3e52e68d9abd9765d02d 100644 (file)
@@ -9,7 +9,7 @@ cpPlugins::BasicFilters::ImageInterpolatorSource::
 ImageInterpolatorSource( )
   : Superclass( )
 {
-  this->_AddInput( "ReferenceImage", true );
+  this->_AddInput( "ReferenceImage" );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" );
 
   std::vector< std::string > type_choices;
@@ -37,9 +37,6 @@ _GenerateData( )
 {
   auto image =
     this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
-  if( image == NULL )
-    return( "ImageInterpolatorSource: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
index 022d46921e154debfed27bab97b292b75f0f44f5..957136d3187879ce34c35c1105b1d4dff64f436a 100644 (file)
@@ -5,7 +5,7 @@ cpPlugins::BasicFilters::InputDataReproducer::
 InputDataReproducer( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" );
   this->m_Parameters->Clear( );
 }
index 6877a3d3e2ee65134f72dca8f3d90c9906ad56f8..e8e9b101e8888c32f6c5d5769e4e2d574d3fdfc7 100644 (file)
@@ -194,7 +194,7 @@ MacheteFilter( )
   : Superclass( ),
     m_PlaneWidget( NULL )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" );
 
@@ -302,8 +302,8 @@ _RealImage( itk::DataObject* dobj )
   } // fi
 
   // Assign outputs
-  pos_out->SetITK< I >( filter->GetPositiveOutput( ) );
-  neg_out->SetITK< I >( filter->GetNegativeOutput( ) );
+  pos_out->SetITK( filter->GetPositiveOutput( ) );
+  neg_out->SetITK( filter->GetNegativeOutput( ) );
   return( "" );
 }
 
index 772b9c289ac402350f2b7201648146e5c748bbd7..7f9d251523494fd0e97f246f0f4727a3a9440ac6 100644 (file)
@@ -12,7 +12,7 @@ cpPlugins::BasicFilters::MacheteImageFilter::
 MacheteImageFilter()
 : Superclass()
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >("Output");
 
   this->m_Parameters->ConfigureAsReal("Radius");
@@ -39,9 +39,6 @@ std::string cpPlugins::BasicFilters::MacheteImageFilter::
 _GenerateData()
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >("Input");
-  if (image == NULL)
-    return("MacheteImageFilter: No input image.");
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes(2, image, itk_image, r, _GD0);
@@ -58,8 +55,8 @@ _GD0(itk::DataObject* image)
 {
   return(
     this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
-    image
-    )
+      image
+      )
     );
 }
 
@@ -90,13 +87,8 @@ _RealGD(itk::DataObject* image)
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >("Output");
-  if (out != NULL)
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return("");
-  }
-  else
-    return("MacheteImageFilter: output not correctly created.");
+  out->SetITK( filter->GetOutput( ) );
+  return("");
 }
 
 // eof - $RCSfile$
index 0203b099288d6c47f0646c243cacece3d886ed96..388b75e293ef3f4f202d4351fcdf8614cde72877 100644 (file)
@@ -11,7 +11,7 @@ cpPlugins::BasicFilters::MarchingCubes::
 MarchingCubes( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 
   this->m_Parameters->ConfigureAsRealList( "Thresholds" );
@@ -29,8 +29,6 @@ _GenerateData( )
 {
   // Get input
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "MarchingCubes: Input data is not a valid image." );
   vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
   if( vtk_image == NULL )
     return( "MarchingCubes: Input does not have a valid VTK conversion." );
index 2e4c763fd61ab6c9470300de7bb89d364e50c08f..0046f07e76abe73bdd10bd614fcfc636ffdd31f4 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::MedianImageFilter::
 MedianImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Radius" );
@@ -26,9 +26,6 @@ std::string cpPlugins::BasicFilters::MedianImageFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "MedianImageFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -70,13 +67,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "MedianImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 0c4852bfd0107a35132403fcea796aec2484d4dc..5c419ae4e1bf6e61930742365e10332ee79c1e27 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 OtsuThresholdImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
@@ -31,9 +31,6 @@ std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "OtsuThresholdImageFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -78,13 +75,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "OtsuThresholdImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 700043d032dc1f5920cc275fbc05fbc647f65e4f..f7fdfff5641ee384d8f2df2a662013467ccf0209 100644 (file)
@@ -11,9 +11,7 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 RGBImageToOtherChannelsFilter( )
   : Superclass( )
 {
-  typedef cpPlugins::Interface::Parameters TParameters;
-
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   std::vector< std::string > choices;
@@ -33,9 +31,6 @@ std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "RGBImageToOtherChannelsFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllRGBTypes( 2, image, itk_image, r, _GD0 );
@@ -86,14 +81,7 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< _O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "RGBImageToOtherChannelsFilter: output not correctly created." );
-
+  out->SetITK( filter->GetOutput( ) );
   return( "" );
 }
 
index 474867517de476607183479b8a3b501a915d706e..90fa01946e5ef426d477428101e15557eb8b9b0f 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
 SignedMaurerDistanceMapImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "BackgroundValue" );
@@ -39,9 +39,6 @@ std::string cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
 _GenerateData( )
 {
   auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "SignedMaurerDistanceMapImageFilter: No input image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -98,13 +95,8 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "SignedMaurerDistanceMapImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index e3800292ca6086db6cae1e3d1670c5c793de5371..5dc3f68c6d2bf18cdb13f7e605758048b27bac48 100644 (file)
@@ -10,7 +10,7 @@ cpPlugins::BasicFilters::TriangleMeshToBinaryImageFilter::
 TriangleMeshToBinaryImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "InsideValue" );
@@ -36,9 +36,6 @@ _GenerateData( )
   typedef itk::Mesh< double, 3 > _3D;
 
   auto input = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
-  if( input == NULL )
-    return( "TriangleMeshToBinaryImageFilter: No valid input mesh." );
-
   auto in_3f = input->GetITK< _3F >( );
   auto in_3d = input->GetITK< _3D >( );
   if     ( in_3f != NULL ) return( this->_GD0( in_3f ) );
@@ -120,13 +117,8 @@ _RealGD( M* mesh )
 
   // Connect output
   auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< I >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "TriangleMeshToBinaryImageFilter: output not correctly created." );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index c820c68a9620fdca76405c5c260c81aa544fa9a7..943d3ac6badb87b07d77833a75dc30ac72274212 100644 (file)
@@ -85,10 +85,7 @@ _GD1( )
     stlr->Update( );
 
     auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
-    if( out != NULL )
-      out->SetVTK( stlr->GetOutput( ) );
-    else
-      return( "MeshReader: output not correctly created." );
+    out->SetVTK( stlr->GetOutput( ) );
     return( "" );
   }
   else if( ext == "obj" )
@@ -102,10 +99,7 @@ _GD1( )
     pdr->Update( );
 
     auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
-    if( out != NULL )
-      out->SetVTK( pdr->GetOutput( ) );
-    else
-      return( "MeshReader: output not correctly created." );
+    out->SetVTK( pdr->GetOutput( ) );
     return( "" );
 
   } // fi