]> Creatis software - cpPlugins.git/commitdiff
modifications for filters and installer
authorJose Luis Guzman <cycopepe@gmail.com>
Wed, 21 Oct 2015 19:32:11 +0000 (21:32 +0200)
committerJose Luis Guzman <cycopepe@gmail.com>
Wed, 21 Oct 2015 19:32:11 +0000 (21:32 +0200)
appli/ImageMPR/CMakeLists.txt
appli/examples/CMakeLists.txt
lib/cpExtensions/Algorithms/MacheteImageFilter.h
lib/cpExtensions/Algorithms/MacheteImageFilter.hxx
lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h

index d67386d2acebda4d120f7482f7aedf78feb451f2..3a63336e7586db93e752fdb42a24bbe7fd17ca2b 100644 (file)
@@ -277,10 +277,10 @@ install(TARGETS ImageMPR
    DESTINATION bin
    COMPONENT applications)
 
-set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Standard MPR viewer application")
+#set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Standard MPR viewer application")
 
 #set (CPACK_NSIS_MODIFY_PATH "ON")
-SET( CPACK_PACKAGE_EXECUTABLES ImageMPR ImageMPR ) 
+#SET( CPACK_PACKAGE_EXECUTABLES ImageMPR ImageMPR ) 
 SET( CPACK_CREATE_DESKTOP_LINKS ImageMPR ) 
 
 INCLUDE(CPack)
\ No newline at end of file
index 35353a0b0504349c2489557a7901d416a5907844..5d197de7ed4745bcaf65001cfbf49ac57616ceec 100644 (file)
@@ -5,7 +5,7 @@
 
 SET(
   EXAMPLES_PROGRAMS_ONLY_EXTENSIONS
-  example_TestQuadSplitter
+  #example_TestQuadSplitter
   )
 
 FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_EXTENSIONS})
index 4dde2dc49cc5ee85e92b36548615d306e89067e7..d9d3c3273a8bc4dd9181441740e739a7e9909634 100644 (file)
@@ -29,9 +29,18 @@ namespace cpExtensions
 
       /** Run-time type information (and related methods). */
       itkTypeMacro(MacheteImageFilter, ImageToImageFilter);
+      
+      typedef typename I::PixelType           RadiusType;
+      //typedef typename I::SizeValueType      RadiusValueType;
+      
+      itkGetConstReferenceMacro(Radius, RadiusType);
 
-      void SetRadius(double radius);
-      void SetPoint(itk::Point<double, 3> point);
+      
+      void SetRadius(const RadiusType & rad);
+      //void SetRadius(const RadiusValueType & rad);
+
+      void SetPoint(itk::Point<double, 3> & point);
+      void SetPoint(const double & x, const double & y, const double & z);
 
     protected:
       MacheteImageFilter(){}
@@ -40,13 +49,14 @@ namespace cpExtensions
       /** Does the real work. */
       virtual void GenerateData();
 
+      RadiusType m_Radius;
+      itk::Point<double, 3> point;
 
     private:
       MacheteImageFilter(const Self &); //purposely not implemented
       void operator=(const Self &);  //purposely not implemented
 
-      double radius;
-      itk::Point<double, 3> point;
+     
     };
 
   } // ecapseman
index 4a381498fecd3638d6c777f8b6f7b703741f6efa..a984df17784e2548021efbb44c7047ba6689e3d0 100644 (file)
@@ -32,10 +32,10 @@ void cpExtensions::Algorithms::MacheteImageFilter<  I, O>
     otherPoint[0] = p0[0];
     otherPoint[1] = p0[1];
     otherPoint[2] = p0[2];
-    otherPoint[2] = this->point[2]; // TODO : Solve this hammer
+    //otherPoint[2] = this->point[2]; // TODO : Solve this hammer
 
     double dist = this->point.EuclideanDistanceTo(otherPoint);
-    if (dist <= this->radius)
+    if (dist <= this->m_Radius)
     {
       outputIterator.Set(0);
     }
@@ -48,18 +48,44 @@ void cpExtensions::Algorithms::MacheteImageFilter<  I, O>
     ++outputIterator;
   }
 
+  
 }
 
 template< class I, class O>
-void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(double rad){
-  this->radius = rad;
+void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(const RadiusType & rad)
+{
+  if (this->m_Radius != rad)
+  {
+    this->m_Radius = rad;
+    this->Modified();
+  }
 }
 
+//template< class I, class O>
+//void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetRadius(const RadiusValueType & rad)
+//{
+//  RadiusType r;
+//  r.Fill(rad);
+//  this->SetRadius(r);
+//}
+
 template< class I, class O>
-void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point<double, 3> point){
-  this->point = point;
+void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(itk::Point<double, 3> & p){
+  if (point != p)
+  {
+    this->point = p;
+    this->Modified();
+  }
 }
 
+template< class I, class O>
+void cpExtensions::Algorithms::MacheteImageFilter< I, O>::SetPoint(const double & x, const double & y, const double & z)
+{
+  this->point[0] = x;
+  this->point[1] = y;
+  this->point[2] = z;
+  this->Modified();
+}
 
 
 
index ac99136fd605758806105227e134bd2d8f26ec08..3ad43fe88cd52f8d7b83e2d4927603e9454ee515 100644 (file)
@@ -27,7 +27,7 @@ namespace cpPlugins
         );
       cpPlugins_Id_Macro(
         cpPlugins::BasicFilters::BinaryErodeImageFilter,
-        "ImageToImageFilter"
+        "ImageToBinaryImageFilter"
         );
 
     protected:
index ff4e03a57ec2848791a0a758ee65ff53dd37d06b..f56c6e1e7f7ed6b17f127e8e8d25976a08cfc92d 100644 (file)
@@ -9,85 +9,92 @@
 
 // -------------------------------------------------------------------------
 cpPlugins::BasicFilters::MacheteImageFilter::
-MacheteImageFilter( )
-  : Superclass( )
+MacheteImageFilter()
+: Superclass()
 {
-  this->_AddInput( "Input" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddInput("Input");
+  this->_MakeOutput< cpPlugins::Interface::Image >("Output");
+
+  this->m_Parameters->ConfigureAsReal("Radius", 20);
+  //this->m_Parameters->ConfigureAsPoint("Point", 3, 3);
+  this->m_Parameters->ConfigureAsReal("X", 30);
+  this->m_Parameters->ConfigureAsReal("Y", 30);
+  this->m_Parameters->ConfigureAsReal("Z", 30);
+
 
-  this->m_Parameters->ConfigureAsUint( "Radius", 2 );
 }
 
 // -------------------------------------------------------------------------
 cpPlugins::BasicFilters::MacheteImageFilter::
-~MacheteImageFilter( )
+~MacheteImageFilter()
 {
 }
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::BasicFilters::MacheteImageFilter::
-_GenerateData( )
+_GenerateData()
 {
   cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "MacheteImageFilter: No input image." );
+    this->GetInput< 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 );
-  else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
-  else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
+  cpPlugins_Image_Demangle_AllScalarTypes(2, image, itk_image, r, _GD0);
+  else cpPlugins_Image_Demangle_AllScalarTypes(3, image, itk_image, r, _GD0);
+  else cpPlugins_Image_Demangle_AllScalarTypes(4, image, itk_image, r, _GD0);
   else r = "MacheteImageFilter: Input image type not supported.";
-  return( r );
+  return(r);
 }
 
 // -------------------------------------------------------------------------
 template< class I >
 std::string cpPlugins::BasicFilters::MacheteImageFilter::
-_GD0( itk::DataObject* image )
+_GD0(itk::DataObject* image)
 {
   return(
     this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
-      image
-      )
+    image
+    )
     );
 }
 
 // -------------------------------------------------------------------------
 template< class I, class O >
 inline std::string cpPlugins::BasicFilters::MacheteImageFilter::
-_RealGD( itk::DataObject* image )
+_RealGD(itk::DataObject* image)
 {
   typedef cpExtensions::Algorithms::MacheteImageFilter< I, O > _F;
-  //typedef typename _F::radius _RT;
+  typedef typename I::PixelType _RT;
 
   // Get parameters
-  //_RT rad_val;
-  //rad_val.Fill( this->m_Parameters->GetUint( "Radius" ) );
+
+  _RT rad_val = _RT(this->m_Parameters->GetReal("Radius"));
+  
+  double pointx = this->m_Parameters->GetReal("X");
+  double pointy = this->m_Parameters->GetReal("Y");
+  double pointz = this->m_Parameters->GetReal("Z");
 
   // Configure filter
+    _F* filter = this->_CreateITK< _F >();
+  filter->SetInput(dynamic_cast<I*>(image));
+  filter->SetRadius(rad_val);
+   
+  filter->SetPoint(pointx, pointy, pointz);
 
-  _F* filter = this->_CreateITK< _F >();
-  filter->SetInput(dynamic_cast< I* >(image));
-  filter->SetRadius(this->m_Parameters->GetUint("Radius"));
   filter->Update();
 
-  //_F* filter = this->_CreateITK< _F >( );
-  //filter->SetInput( dynamic_cast< I* >( image ) );
-  //filter->Update( );
-
   // Connect output
   cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
+    this->GetOutput< cpPlugins::Interface::Image >("Output");
+  if (out != NULL)
   {
-    //out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
+    out->SetITK< O >( filter->GetOutput( ) );
+    return("");
   }
   else
-    return( "MacheteImageFilter: output not correctly created." );
+    return("MacheteImageFilter: output not correctly created.");
 }
 
 // eof - $RCSfile$
index ab7a6e93b6a872b77edb0e7fadc2228bdf036cbd..267f970e008fe47be1ca5fd5e7c8869f0b8de16e 100644 (file)
@@ -27,7 +27,7 @@ namespace cpPlugins
         );
       cpPlugins_Id_Macro(
         cpPlugins::BasicFilters::MacheteImageFilter,
-        "ImageToImageFilter"
+        "ImageToBinaryImageFilter"
         );
 
     protected:
index 1e491e79a989dff88a1cf2b9bcccffb6fe427cb5..c036a1ed9f77593e10db9f779b14ccb7134a8c51 100644 (file)
@@ -27,7 +27,7 @@ namespace cpPlugins
         );
       cpPlugins_Id_Macro(
         cpPlugins::BasicFilters::MedianImageFilter,
-        "ImageToImageFilter"
+        "ImageToBinaryImageFilter"
         );
 
     protected: